Reactome

This module contains the methods to convert a Reactome RDF network into a BELGraph.

pathme.reactome.convert_to_bel.convert_to_bel(nodes: Dict[str, Dict], interactions: List[Tuple[str, str, Dict]], pathway_info: Dict, hgnc_manager: bio2bel_hgnc.manager.Manager, chebi_manager: bio2bel_chebi.manager.Manager) → pybel.struct.graph.BELGraph[source]

Convert RDF graph dictionary into BEL graph.

This module contains the methods that run SPARQL queries to convert the Reactome Pathways to BEL.

pathme.reactome.rdf_sparql.log = <Logger pathme.reactome.rdf_sparql (WARNING)>[source]

SPARQL string queries

pathme.reactome.rdf_sparql.PREFIXES = {'biopax3': Namespace('http://www.biopax.org/release/biopax-level3.owl#'), 'dbpedia': Namespace('http://dbpedia.org/property/'), 'dbpedia2': Namespace('http://dbpedia.org/'), 'dc': Namespace('http://purl.org/dc/elements/1.1/'), 'dcterms': Namespace('http://purl.org/dc/terms/'), 'foaf': Namespace('http://xmlns.com/foaf/0.1/'), 'owl': Namespace('http://www.w3.org/2002/07/owl#'), 'rdf': rdf.namespace.ClosedNamespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#'), 'rdfs': rdf.namespace.ClosedNamespace('http://www.w3.org/2000/01/rdf-schema#'), 'skos': Namespace('http://www.w3.org/2004/02/skos/core#'), 'xsd': Namespace('http://www.w3.org/2001/XMLSchema#')}

SPARQL prefixes.

pathme.reactome.rdf_sparql.GET_ALL_TYPES = '\nSELECT DISTINCT (STRAFTER(STR(?rdf_type), str(biopax3:)) AS ?entry_type)\nWHERE {\n ?uri_id rdf:type ?rdf_type .\n}\n'

SPARQL query string to get all the primary types of entries (Pathway, BiochemicalReaction) in a pathway network.

pathme.reactome.rdf_sparql.GET_ALL_PATHWAYS = '\nSELECT DISTINCT ?uri_id ?name\nWHERE {\n ?uri_id rdf:type biopax3:Pathway .\n ?uri_id biopax3:displayName ?name .\n}\n'

SPARQL query string to get pathway URIs and names in the RDF file.

pathme.reactome.rdf_sparql.GET_ALL_PATHWAY_COMPONENTS = '\nSELECT DISTINCT ?uri_id ?name ?comment (STRAFTER(STR(?uri_type), str(biopax3:)) AS ?component_type)\nWHERE {\n ?pathway biopax3:pathwayComponent ?uri_id .\n ?uri_id rdf:type ?uri_type .\n optional {?uri_id biopax3:displayName ?name .}\n optional {?uri_id biopax3:comment ?comment .}\n}\n'

SPARQL query string to get all components of a pathway (predicate biopax3:pathwayComponent).

pathme.reactome.rdf_sparql.GET_INTERACTION_PARTICIPANTS_AND_TYPE = "\nSELECT DISTINCT\n (STRAFTER(STR(?component), '#') AS ?identifier)\n ?reactant\n ?product\n (STR(?control_type) AS ?interaction_type)\nWHERE {\n ?component biopax3:left ?reactant .\n ?component biopax3:right ?product .\n optional {?control biopax3:controlled ?component .}\n optional {?control biopax3:controlType ?control_type }\n}\n"

SPARQL query string to get all participants in an interaction and its controlType (ACTIVATION or INHIBITION).

pathme.reactome.rdf_sparql.GET_ENTITY_METADATA = "\nSELECT DISTINCT\n (STRAFTER (STR(?uri_type), str(biopax3:)) AS ?entity_type)\n (STRAFTER(STR(?entity), '#') AS ?identifier)\n (STR(?entity) AS ?uri_id)\n (STRAFTER(STR(?entity), '#') AS ?reactome_id)\n (STR(?entity) AS ?uri_reactome_id)\n (STR(?entity_reference) AS ?uri_id)\n ?name\n ?cell_locat\n ?display_name\n ?complex_components\n ?comment\nWHERE {\n ?entity rdf:type ?uri_type .\n optional {?entity biopax3:comment ?comment .}\n optional {?entity biopax3:entityReference ?entity_reference .}\n optional {?entity biopax3:name ?name .}\n optional {?entity biopax3:displayName ?display_name .}\n optional {?entity biopax3:cellularLocation ?cell_locat .}\n optional {?entity biopax3:organism ?organism .}\n optional {?entity biopax3:component ?complex_components .}\n}\n"

Queries managers

pathme.reactome.rdf_sparql.get_reactome_statistics(resource_file, hgnc_manager, chebi_manager)[source]

Get types statistics for Reactome.

Parameters
  • resource_file (str) – RDF file

  • hgnc_manager (bio2bel_hgnc.Manager) – Hgnc Manager

pathme.reactome.rdf_sparql.reactome_pathway_to_bel(pathway_uri, rdf_graph, hgnc_manager, chebi_manager)[source]

Convert a Reactome pathway to BEL.

Parameters
  • filepath (str) – path to the file

  • hgnc_manager (bio2bel_hgnc.Manager) – Bio2BEL HGNC Manager

Return type

pybel.BELGraph

pathme.reactome.rdf_sparql.reactome_to_bel(resource_file, hgnc_manager, chebi_manager, export_folder='/home/docs/.pathme/reactome/bel')[source]

Create Reactome BEL graphs.

Parameters
  • resource_file (str) – rdf reactome file (there is only one)

  • hgnc_manager (bio2bel_hgnc.Manager) – uniprot id to hgnc symbol dictionary

Returns

This module has utilities method for parsing, handling WikiPathways RDF and data.

pathme.reactome.utils.log = <Logger pathme.reactome.utils (WARNING)>[source]

Download utilities

pathme.reactome.utils.get_hgnc_node_info(gene: pyhgnc.manager.models.HGNC) → Tuple[str, str, str][source]

Return HGNC identifier, symbol and namespace from HGNC entry.

Parameters

gene (bio2bel_hgnc.manager.models.HGNC) –

pathme.reactome.utils.get_valid_node_parameters(node, hgnc_manager: bio2bel_hgnc.manager.Manager, chebi_manager: bio2bel_chebi.manager.Manager) → Tuple[str, str, str][source]

Get valid node parameters.

pathme.reactome.utils.process_multiple_proteins(hgnc_entries: List) → List[source]

Create multiple nodes when UniProt identifer refers to multiple HGNC symbols.

Parameters

hgnc_entries – Results from query

Returns

List of Protein BEL nodes

pathme.reactome.utils.untar_file(file_path: str, export_folder: str) → None[source]

Unzip file into a destination folder.

Parameters
  • file_path – name of the file

  • export_folder – name of the file