BEL (indra.sources.bel)

BEL API (indra.sources.bel.api)

High level API functions for the PyBEL processor.

indra.sources.bel.api.process_belscript(file_name, **kwargs)[source]

Return a PybelProcessor by processing a BEL script file.

Key word arguments are passed directly to pybel.from_path, for further information, see pybel.readthedocs.io/en/latest/io.html#pybel.from_path Some keyword arguments we use here differ from the defaults of PyBEL, namely we set citation_clearing to False and no_identifier_validation to True.

Parameters:file_name (str) – The path to a BEL script file.
Returns:bp – A PybelProcessor object which contains INDRA Statements in bp.statements.
Return type:PybelProcessor
indra.sources.bel.api.process_cbn_jgif_file(file_name)[source]

Return a PybelProcessor by processing a CBN JGIF JSON file.

Parameters:file_name (str) – The path to a CBN JGIF JSON file.
Returns:bp – A PybelProcessor object which contains INDRA Statements in bp.statements.
Return type:PybelProcessor
indra.sources.bel.api.process_json_file(file_name)[source]

Return a PybelProcessor by processing a Node-Link JSON file.

For more information on this format, see: http://pybel.readthedocs.io/en/latest/io.html#node-link-json

Parameters:file_name (str) – The path to a Node-Link JSON file.
Returns:bp – A PybelProcessor object which contains INDRA Statements in bp.statements.
Return type:PybelProcessor
indra.sources.bel.api.process_large_corpus()[source]

Return PybelProcessor with statements from Selventa Large Corpus.

Returns:bp – A PybelProcessor object which contains INDRA Statements in its statements attribute.
Return type:PybelProcessor
indra.sources.bel.api.process_pybel_graph[source]

Return a PybelProcessor by processing a PyBEL graph.

Parameters:graph (pybel.struct.BELGraph) – A PyBEL graph to process
Returns:bp – A PybelProcessor object which contains INDRA Statements in bp.statements.
Return type:PybelProcessor
indra.sources.bel.api.process_pybel_neighborhood(entity_names, network_type='graph_jsongz_url', network_file=None, **kwargs)[source]

Return PybelProcessor around neighborhood of given genes in a network.

This function processes the given network file and filters the returned Statements to ones that contain genes in the given list.

Parameters:
  • entity_names (list[str]) – A list of entity names (e.g., gene names) which will be used as the basis of filtering the result. If any of the Agents of an extracted INDRA Statement has a name appearing in this list, the Statement is retained in the result.
  • network_type (Optional[str]) – The type of network that network_file is. The options are: belscript, json, cbn_jgif, graph_pickle, and graph_jsongz_url. Default: graph_jsongz_url
  • network_file (Optional[str]) – Path to the network file/URL to process. If not given, by default, the Selventa Large Corpus is used via a URL pointing to a gzipped PyBEL Graph JSON file.
Returns:

bp – A PybelProcessor object which contains INDRA Statements in bp.statements.

Return type:

PybelProcessor

indra.sources.bel.api.process_pybel_network(network_type, network_file, **kwargs)[source]

Return PybelProcessor by processing a given network file.

Parameters:
  • network_type (str) – The type of network that network_file is. The options are: belscript, json, cbn_jgif, graph_pickle, and graph_jsongz_url. Default: graph_jsongz_url
  • network_file (str) – Path to the network file/URL to process.
Returns:

bp – A PybelProcessor object which contains INDRA Statements in bp.statements.

Return type:

PybelProcessor

indra.sources.bel.api.process_small_corpus()[source]

Return PybelProcessor with statements from Selventa Small Corpus.

Returns:bp – A PybelProcessor object which contains INDRA Statements in its statements attribute.
Return type:PybelProcessor

PyBEL Processor (indra.sources.bel.processor)

Processor for PyBEL.

class indra.sources.bel.processor.PybelProcessor(graph)[source]

Extract INDRA Statements from a PyBEL Graph.

Currently does not handle non-causal relationships (positiveCorrelation, (negativeCorrelation, hasVariant, etc.)

Parameters:graph (pybel.BELGraph) – PyBEL graph containing the BEL content.
statements

A list of extracted INDRA Statements representing BEL Statements.

Type:list[indra.statements.Statement]
indra.sources.bel.processor.get_agent(node_data, node_modifier_data=None)[source]

Get an INDRA agent from a PyBEL node.