| name | hmdb-database |
| description | Access the Human Metabolome Database (HMDB) to search metabolites by name/structure/ID and extract chemical/biological/clinical fields when you need metabolomics research data or automated HMDB XML mining. |
| license | MIT |
| author | AIPOCH |
Source: https://github.com/aipoch/medical-research-skills
When to Use
- You need to look up a metabolite by common name (e.g., “Caffeine”) and retrieve its HMDB entry data.
- You have an HMDB ID (e.g.,
HMDB0000001) and want to extract standardized chemical/biological/clinical fields for downstream analysis.
- You want to build a local, scriptable pipeline to mine the HMDB XML dump instead of manually browsing the website.
- You need to map HMDB identifiers to external resources (e.g., KEGG, PubChem, ChEBI) for integration tasks.
- You are preparing metabolomics datasets and need pathway/enzyme/transporter annotations from HMDB entries.
Key Features
- Search metabolites by:
- Text name
- HMDB identifier (e.g.,
HMDB0000001)
- Structure-related query (as supported by the parser/search implementation)
- Parse the HMDB XML dataset and extract:
- Chemical data (formula, molecular weight, InChI/SMILES where available)
- Biological data (pathways, enzymes, transporters)
- Clinical data (disease associations, biofluid concentrations)
- Optional structuring of extracted results for analysis workflows (e.g., tabular outputs).
- Supports integration workflows by exposing identifiers suitable for cross-database mapping.
Dependencies
- Python
>=3.9
- Standard library:
xml.etree.ElementTree (built-in)
- Optional:
Example Usage
1) Download HMDB XML
Download the HMDB metabolite XML dataset from:
Assume you saved it as:
data/hmdb_metabolites.xml
2) Search and Extract Fields (Runnable Example)
from scripts.hmdb_parser import HMDBParser
def main():
xml_path = "data/hmdb_metabolites.xml"
parser = HMDBParser(xml_path)
results = parser.search("Caffeine")
if not results:
print("No results found.")
return
first = results[0]
print("Top match:")
print(first)
if __name__ == "__main__":
main()
3) Field Reference
For a curated list of extractable fields and how they map to HMDB XML elements, see:
references/hmdb_data_fields.md
Implementation Details