Manager

Bio2BEL CTD Manager.

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

Bio2BEL manager for the CTD.

is_populated() → bool[source]

Check if the database is already populated.

populate(urls=None, force_download=False, only_tables=None, exclude_tables=None) → None[source]

Updates the CTD database

  1. downloads all files from CTD
  2. drops all tables in database
  3. creates all tables in database
  4. import all data from CTD files
Parameters:
  • urls (iter[str]) – An iterable of URL strings
  • force_download (bool) – force method to download
count_genes() → int[source]

Count the genes in the database.

list_chemicals() → List[pyctd.manager.models.Chemical][source]

List all chemicals.

count_chemicals() → int[source]

Count the chemicals in the database.

list_chemical_gene_interactions() → List[pyctd.manager.models.ChemGeneIxn][source]

List all chemical-gene interactions.

count_chemical_gene_interactions() → int[source]

Count the chemical-gene interactions in the database.

count_pathways() → int[source]

Count the pathways in the database.

count_diseases() → int[source]

Count the diseases in the database.

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

Return a summary dictionary of the database.

get_chemical_by_mesh(mesh_id: str) → Optional[pyctd.manager.models.Chemical][source]

Get a chemical by its MeSH identifier, if it exists.

Parameters:mesh_id – A MeSH identifier of a chemical
get_chemical_by_cas(cas_rn: str) → Optional[pyctd.manager.models.Chemical][source]

Get a chemical by its CAS Registry Number, if it exists.

Parameters:cas_rn (str) – A CAS Registry Number
Return type:Optional[Chemical]
get_gene_by_entrez_id(entrez_id: str) → Optional[pyctd.manager.models.Gene][source]

Get a gene by its Entrez Gene identifier, if it exists.

Parameters:entrez_id – An Entrez Gene identifier of a gene
Return type:Optional[Gene]
get_interaction_by_id(ixn_id: int) → Optional[pyctd.manager.models.ChemGeneIxn][source]

Get an interaction by its database identifier

Parameters:ixn_id – An interaction database identifier
enrich_graph_chemical(graph: pybel.struct.graph.BELGraph, mesh_id: str) → None[source]

Enrich the BEL graph with chemical-gene interactions for the given chemical.

Parameters:
  • graph – A BEL graph
  • mesh_id – A MeSH identifier of a chemical
enrich_graph_gene(graph: pybel.struct.graph.BELGraph, entrez_id: str) → None[source]

Enrich the BEL graph with chemical-gene interactions for the given gene.

Parameters:
  • graph – A BEL graph
  • entrez_id – An Entrez Gene identifier of a gene
enrich_graph_genes(graph: pybel.struct.graph.BELGraph) → None[source]

Enrich the BEL graph with chemical-gene interactions for all Entrez genes.

Parameters:graph – A BEL graph
enrich_chemicals(graph: pybel.struct.graph.BELGraph) → None[source]

Find chemicals that can be mapped and enriched with the CTD.

Parameters:graph (pybel.BELGraph) – A BEL graph
to_bel() → pybel.struct.graph.BELGraph[source]

Convert all possible aspects of the database to BEL.

Warning

Not complete!

To do:

  • add namespaces
  • use cursors
  • multiprocessing