Manager

The Manager is a key component of HMDB. This class is used to create, populate and query the local HMDB version.

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

Metabolite-proteins and metabolite-disease associations.

count_biofunctions() → int[source]

Count the number of biofunctions in the database.

count_cellular_locations()[source]

Count the number of cellular locations in the database.

count_diseases() → int[source]

Count the number of diseases in the database.

count_metabolites() → int[source]

Count the number of metabolites in the database.

count_pathways() → int[source]

Count the number of pathways in the database.

count_proteins() → int[source]

Count the number of proteins in the database.

count_references()[source]

Count the number of literature references in the database.

count_tissues() → int[source]

Count the number of tissues in the database.

get_hmdb_accession()[source]

Create a list of all HMDB metabolite identifiers present in the database.

Return type:list
get_hmdb_diseases()[source]

Create a list of all disease names present in the database.

Return type:list
get_metabolite_by_accession(hmdb_metabolite_accession: str) → Optional[bio2bel_hmdb.models.Metabolite][source]

Query the constructed HMDB database and extract a metabolite object.

Parameters:hmdb_metabolite_accession – HMDB metabolite identifier

Example:

>>> import bio2bel_hmdb
>>> manager = bio2bel_hmdb.Manager()
>>> manager.get_metabolite_by_accession("HMDB00072")
get_reference_by_pubmed_id(pubmed_id: str) → Optional[bio2bel_hmdb.models.Reference][source]

Get a reference by its PubMed identifier if it exists.

Parameters:pubmed_id – The PubMed identifier to search
is_populated() → bool[source]

Check if the database is already populated.

populate(source: Optional[str] = None, map_dis: bool = True, group_size: int = 500000)[source]

Populate the database with the HMDB data.

Parameters:
  • source – Path to an .xml file. If None the whole HMDB will be downloaded and used for population.
  • map_dis – Should diseases be mapped?
query_disease_associated_metabolites(disease_name: str) → List[bio2bel_hmdb.models.Metabolite][source]

Query function that returns a list of metabolite-disease interactions, which are associated to a disease.

Parameters:disease_name – HMDB disease name
query_metabolite_associated_diseases(hmdb_metabolite_id: str) → List[bio2bel_hmdb.models.Disease][source]

Query the constructed HMDB database to get the metabolite associated disease relations for BEL enrichment

Parameters:hmdb_metabolite_id – HMDB metabolite identifier
query_metabolite_associated_proteins(hmdb_metabolite_id: str) → Optional[List[bio2bel_hmdb.models.Protein]][source]

Query the constructed HMDB database to get the metabolite associated protein relations for BEL enrichment

Parameters:hmdb_metabolite_id – HMDB metabolite identifier
query_protein_associated_metabolites(uniprot_id)[source]

Query function that returns a list of metabolite-disease interactions, which are associated to a disease.

Parameters:uniprot_id (str) – uniprot identifier of a protein for which the associated metabolite relations should be outputted
Return type:list
summarize() → Mapping[str, int][source]

Summarize the contents of the database in a dictionary.