Search API (indra_network_search.search_api)

The INDRA Network Search API

This class represents an API that executes search queries

Queries for specific searches are found in indra_network_search.query

class indra_network_search.search_api.IndraNetworkSearchAPI(unsigned_graph, signed_node_graph)[source]

The search API class

Get results from running bfs_search

Parameters:
  • breadth_first_search_query (BreadthFirstSearchQuery) – The input query holding the options to the algorithm

  • is_signed (bool) – Whether the query is signed or not

Return type:

BreadthFirstSearchResultManager

Returns:

An instance of the BreadthFirstSearchResultManager, holding results from running bfs_search

dijkstra(dijkstra_query, is_signed)[source]

Get results from running open_dijkstra_search

Parameters:
  • dijkstra_query (DijkstraQuery) – The input query holding options for open_dijkstra_search and DijkstraResultManager

  • is_signed (bool) – Whether the query is signed or not

Return type:

DijkstraResultManager

Returns:

An instance of the DijkstraResultManager, holding results from running open_dijkstra_search

get_graph(signed=False)[source]

Returns the graph used for pathfinding

Return type:

DiGraph

get_node(node_name)[source]

Returns an instance of a Node matching the input name, if it exists

Parameters:

node_name (str) – Name of node to look up

Return type:

Optional[Node]

Returns:

An instance of a node corresponding to the input name

handle_multi_interactors_query(multi_interactors_rest_query)[source]

Interface with pathfinding.direct_multi_interactors

Parameters:

multi_interactors_rest_query (MultiInteractorsRestQuery) – The input query holding options for direct multi interactors

Return type:

MultiInteractorsResults

Returns:

Results holding node and edge data

handle_query(rest_query)[source]

Handle a NetworkSearchQuery and return the corresponding results

Parameters:

rest_query (NetworkSearchQuery) – A query from the rest api with all relevant information to execute path queries and other related queries. See available queries in indra_network_search.query

Return type:

Results

Returns:

A model containing all results from the query. For more information about the data structure, see indra_network_search.data_models

handle_subgraph_query(subgraph_rest_query)[source]

Interface for handling queries to get_subgraph_edges

Parameters:

subgraph_rest_query (SubgraphRestQuery) – A rest query containing the list of nodes needed for get_subgraph_edges

Return type:

SubgraphResults

Returns:

The data put together from the results of get_subgraph_edges

multi_interactors_query(query)[source]

Run direct_multi_interactors and return the result manager

Parameters:

query (MultiInteractorsQuery) – An instance of MultiInteractorsQuery, that interfaces with the algorithm and the result manager

Return type:

MultiInteractorsResultManager

Returns:

A MultiInteractorsResultManager holding the results of running direct_multi_interactors

path_query(path_query, is_signed)[source]

Wrapper for the mutually exclusive path queries

Parameters:
  • path_query (Union[Query, PathQuery]) – An instance of a Query or PathQuery

  • is_signed (bool) – Signifies if the path query is signed or not

Return type:

ResultManager

Returns:

A ResultManager with the path generator loaded before get_results() have been executed for the first time

shared_parents(ontology_query)[source]

Get results from running shared_parents

Parameters:

ontology_query (OntologyQuery) – The input query holding options for shared_parents

Return type:

OntologyResultManager

Returns:

An instance of the OntologyResultManager, holding results from running shared_parents

shared_regulators(shared_regulators_query, is_signed)[source]

Get results from running shared_interactors looking for regulators

Parameters:
  • shared_regulators_query (SharedRegulatorsQuery) – The input query holding options for shared_interactors

  • is_signed (bool) – Whether the query is signed or not

Return type:

SharedInteractorsResultManager

Returns:

An instance of the SharedInteractorsResultManager, holding results from running shared_interactors looking for regulators

shared_targets(shared_targets_query, is_signed)[source]

Get results from running shared_interactors looking for targets

Parameters:
  • shared_targets_query (SharedTargetsQuery) – The input query holding options for shared_interactors

  • is_signed (bool) – Whether the query is signed or not

Return type:

SharedInteractorsResultManager

Returns:

An instance of the SharedInteractorsResultManager, holding results from running shared_interactors looking for targets

shortest_simple_paths(shortest_simple_paths_query, is_signed)[source]

Get results from running shortest_simple_paths

Parameters:
  • shortest_simple_paths_query (ShortestSimplePathsQuery) – The input query holding the options to the algorithm

  • is_signed (bool) – Whether the query is signed or not

Return type:

ShortestSimplePathsResultManager

Returns:

An instance of the ShortestSimplePathsResultManager, holding results from running shortest_simple_paths_query

subgraph_query(query)[source]

Get results from running get_subgraph_edges

Parameters:

query (SubgraphQuery) – The input query holding the options for get_subgraph_edges

Return type:

SubgraphResultManager

Returns:

An instance of the SubgraphResultManager, holding results from running get_subgraph_edges