Manager

Database Manager and query functions

This module populates the tables of bio2bel_reactome.

class bio2bel_reactome.manager.Manager(*args, **kwargs)[source]

Protein-pathway and chemical-pathway memberships.

Doesn’t let this class get instantiated if the pathway_model.

protein_model

alias of bio2bel_reactome.models.Protein

namespace_model

alias of bio2bel_reactome.models.Pathway

pathway_model

alias of bio2bel_reactome.models.Pathway

summarize() → Mapping[str, int][source]

Summarize the database.

count_chemicals()int[source]

Count the chemicals in the database.

count_species()int[source]

Count the species in the database.

get_gene_sets(only_human: bool = False) → Mapping[str, Set[str]][source]

Return pathway - genesets mapping.

get_or_create_pathway(*, reactome_id: str, name: str, species: bio2bel_reactome.models.Species, chemicals: Optional[List[bio2bel_reactome.models.Chemical]])bio2bel_reactome.models.Pathway[source]

Get a pathway from the database or creates it.

Parameters
  • reactome_id – pathway identifier

  • name – name of the pathway

  • species – Species object

  • chemicals – An optional list of chemicals that belong too this pathway

get_or_create_chemical(*, chebi_id: str, chebi_name: str)bio2bel_reactome.models.Chemical[source]

Get a Chemical from the database or creates it.

Parameters
  • chebi_id – ChEBI identifier

  • chebi_name – ChEBI name

get_or_create_species(*, taxonomy_id: str, name: str)bio2bel_reactome.models.Species[source]

Get a Species from the database or creates it.

get_or_create_protein(uniprot_id: str, hgnc_symbol: Optional[str] = None, hgnc_id: Optional[str] = None)bio2bel_reactome.models.Protein[source]

Get a protein from the database or creates it.

Parameters
  • uniprot_id – pathway identifier

  • hgnc_symbol – name of the pathway

  • hgnc_id – Species object

get_species_by_name(species_name: str) → Optional[bio2bel_reactome.models.Species][source]

Get a Species by its species_name.

Parameters

species_name – name

get_pathway_names_to_ids(only_human: bool = False)[source]

Return a dictionary of pathway names to ids.

Return type

dict[str,str]

get_pathway_parent_by_id(reactome_id: str) → Optional[bio2bel_reactome.models.Pathway][source]

Get parent pathway by its reactome id.

Parameters

reactome_id – reactome identifier

get_top_hiearchy_parent_by_id(reactome_id: str) → Optional[bio2bel_reactome.models.Pathway][source]

Get the oldest pathway at the top of the hierarchy a pathway by its reactome id.

Parameters

reactome_id – reactome identifier

get_all_top_hierarchy_pathways() → List[bio2bel_reactome.models.Pathway][source]

Get all pathways without a parent (top hierarchy).

get_human_pathways() → List[bio2bel_reactome.models.Pathway][source]

Get human pathways.

get_pathways_by_species(species_name: str) → Optional[List[bio2bel_reactome.models.Pathway]][source]

Get pathways by species.

get_chemical_by_chebi_id(chebi_id: str) → Optional[bio2bel_reactome.models.Chemical][source]

Get chemical by ChEBI id.

get_protein_by_uniprot_id(uniprot_id: str) → Optional[bio2bel_reactome.models.Protein][source]

Get protein by UniProt id.

populate(pathways_path: Optional[str] = None, pathways_hierarchy_path: Optional[str] = None, pathways_proteins_path: Optional[str] = None, pathways_chemicals_path: Optional[str] = None)None[source]

Populate all tables.

Parameters
  • pathways_path – url from pathway table file

  • pathways_hierarchy_path – url from pathway hierarchy file

  • pathways_proteins_path – url from pathway protein file

  • pathways_chemicals_path – url from pathway chemical file