Manager

Manager for Bio2BEL ChEBI.

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

Chemical multi-hierarchy.

namespace_model

alias of bio2bel_chebi.models.Chemical

is_populated() → bool[source]

Check if the database is already populated.

count_chemicals() → int[source]

Count the number of chemicals stored.

count_parent_chemicals() → int[source]

Count the number of parent chemicals stored.

count_child_chemicals() → int[source]

Count the number of child chemicals stored.

count_xrefs() → int[source]

Count the number of cross-references stored.

count_synonyms() → int[source]

Count the number of synonyms stored.

count_inchis() → int[source]

Count the number of inchis stored.

count_relations() → int[source]

Count the relations in the database.

list_relations() → List[bio2bel_chebi.models.Relation][source]

List the relations in the database.

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

Return a summary dictionary over the content of the database.

get_or_create_chemical(chebi_id: str, **kwargs) → bio2bel_chebi.models.Chemical[source]

Get a chemical from the database by ChEBI.

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

Get a chemical from the database.

get_chemical_by_chebi_name(name: str) → Optional[bio2bel_chebi.models.Chemical][source]

Get a chemical from the database.

build_chebi_id_name_mapping() → Mapping[str, str][source]

Build a mapping from ChEBI identifier to ChEBI name.

build_chebi_name_id_mapping() → Mapping[str, str][source]

Build a mapping from ChEBI name to ChEBI identifier.

populate(inchis_url: Optional[str] = None, compounds_url: Optional[str] = None, relations_url: Optional[str] = None, names_url: Optional[str] = None, accessions_url: Optional[str] = None) → None[source]

Populate all tables.

iter_chemicals(graph: pybel.struct.graph.BELGraph, use_tqdm: bool = False) → Iterable[Tuple[pybel.dsl.node_classes.BaseEntity, bio2bel_chebi.models.Chemical]][source]

Iterate over pairs of BEL nodes and ChEBI chemicals.

enrich_chemical_hierarchy(graph: pybel.struct.graph.BELGraph) → None[source]

Enrich the parents for all ChEBI chemicals in the graph.

to_bel() → pybel.struct.graph.BELGraph[source]

Export BEL.