Query Classes (indra_network_search.query)

This file contains the Query classes mapping incoming rest queries to different algorithms used in the search api.

class indra_network_search.query.BreadthFirstSearchQuery(query, hash_blacklist=None)[source]

Check queries that will use the bfs_search algorithm

alg_options()[source]

Match arguments of bfs_search from query

Return type:

Dict[str, Any]

Returns:

The argument to provide bfs_search

mesh_options(graph=None)[source]

Get mesh options for bfs_search

Parameters:

graph (Optional[DiGraph]) – The graph

Return type:

Dict[str, Union[Set, bool, Callable]]

Returns:

The mesh option for bfs_search

options

alias of BreadthFirstSearchOptions

class indra_network_search.query.DijkstraQuery(query, hash_blacklist=None)[source]

Check queries that will use the open_dijkstra_search algorithm

alg_options()[source]

Match arguments of open_dijkstra_search from query

Return type:

Dict[str, Any]

Returns:

A dict with arguments for open_dijkstra_search

mesh_options(graph=None)[source]

Produces mesh arguments matching open_dijkstra_search from query

Return type:

Dict[str, Union[Set, bool, Callable]]

Returns:

The mesh options for open_dijkstra_query

options

alias of DijkstraOptions

exception indra_network_search.query.InvalidParametersError[source]

Raise when conflicting or otherwise invalid parameters

exception indra_network_search.query.MissingParametersError[source]

Raise for missing query parameters

class indra_network_search.query.MultiInteractorsQuery(rest_query)[source]

Check queries that will use pathfinding.direct_multi_interactors

options

alias of MultiInteractorsOptions

result_options()[source]

Return a dict with options for the MultiInteractorsResultManager

Return type:

Dict[str, Any]

Returns:

A dict with the options for the MultiInteractorsResultManager

run_options()[source]

Return options needed for direct_multi_interactors

Return type:

Dict[str, Any]

Returns:

The options needed for direct_multi_interactors

class indra_network_search.query.OntologyQuery(query)[source]

Check queries that will use shared_parents

alg_options()[source]

Match arguments of shared_parents from query

Return type:

Dict[str, Any]

Returns:

A dict with arguments for shared_parents

options

alias of OntologyOptions

result_options()[source]

Provide args to OntologyResultManager in result_handler

Return type:

Dict

Returns:

The arguments for the Ontology Result manger

run_options(graph=None)[source]

Check query options and return them for shared_parents

Parameters:

graph (Optional[DiGraph]) – The graph used in the search. Must contains node attributes ‘ns’ and ‘id’ for each node.

Return type:

Dict[str, Any]

Returns:

The options for shared_parents

class indra_network_search.query.PathQuery(query, hash_blacklist)[source]

Parent Class for ShortestSimplePaths, Dijkstra and BreadthFirstSearch

alg_options()[source]

Returns the options for the algorithm used, excl mesh options

Return type:

Dict[str, Any]

mesh_options(graph=None)[source]

Return algorithm specific mesh options

Return type:

Dict[str, Any]

result_options()[source]

Provide args to corresponding result class in result_handler

Return type:

Dict

Returns:

Options for the PathResult class

run_options(graph=None)[source]

Combines all options to one dict that can be sent to algorithm

Return type:

Dict[str, Any]

class indra_network_search.query.Query(query)[source]

Parent class to all Query classes

The Query classes are helpers that make sure the methods of the IndraNetworkSearchAPI receive the data needed from a NetworkSearchQuery or other Rest query.

alg_options()[source]

Returns the options for the algorithm used

Return type:

Dict[str, Any]

api_options()[source]

These options are used when IndraNetworkSearchAPI handles the query

The options here impact decisions on which extra search algorithms to include and which graph to pick

Return type:

Dict[str, Any]

Returns:

A dict of ApiOptions

result_options()[source]

Provide args to corresponding result class in result_handler

Return type:

Dict

run_options(graph=None)[source]

Combines all options to one dict that can be sent to algorithm

Return type:

Dict[str, Any]

class indra_network_search.query.SharedRegulatorsQuery(query, hash_blacklist=None)[source]

Check queries that will use shared_interactors(regulators=True)

class indra_network_search.query.SharedTargetsQuery(query, hash_blacklist=None)[source]

Check queries that will use shared_interactors(regulators=False)

class indra_network_search.query.ShortestSimplePathsQuery(query, hash_blacklist=None)[source]

Check queries that will use the shortest_simple_paths algorithm

alg_options()[source]

Match arguments of shortest_simple_paths from query

Return type:

Dict[str, Any]

Returns:

A dict with arguments for shortest_simple_paths

mesh_options(graph=None)[source]

Match input to shortest_simple_paths

Return type:

Dict[str, Union[Set, int, bool, Callable]]

Returns:

The mesh options for shortest_simple_paths

options

alias of ShortestSimplePathOptions

class indra_network_search.query.SubgraphQuery(query)[source]

Check queries that gets the subgraph

alg_options(graph)[source]

Match arguments of get_subgraph_edges

Parameters:

graph (DiGraph) – The graph the search will be performed with

Return type:

Dict[str, List[Node]]

Returns:

A dict with the arguments for get_subgraph_edges

options

alias of SubgraphOptions

result_options()[source]

Return options needed for SubgraphResultManager

Return type:

Dict[str, Any]

Returns:

A dict with options for the SubgraphResultManager

run_options(graph)[source]

Return options needed for get_subgraph_edges

Parameters:

graph (DiGraph) – The graph the search will be performed with

Return type:

Dict[str, Any]

Returns:

A dict with the arguments for get_subgraph_edges

class indra_network_search.query.UIQuery(query, hash_blacklist=None)[source]

Parent Class for all possible queries that come from the web UI

alg_options()[source]

Returns the options for the algorithm used

Return type:

Dict[str, Any]

result_options()[source]

Provide args to corresponding result class in result_handler

Return type:

Dict

run_options(graph=None)[source]

Combines all options to one dict that can be sent to algorithm

Return type:

Dict[str, Any]