Tooluniverse metabolomics

From mims-harvard/ToolUniverse · View interactive version

Tooluniverse metabolomics is an AI agent skill from the GitHub repository mims-harvard/ToolUniverse. Metabolomics research — metabolite identification, study analysis, and database searches across HMDB, MetaboLights, Metabolomics Workbench, KEGG. Use for annotating mass-spec features to known metabolites, finding metabolomics studies of a disease, and structured metabolomics research reports with m

How to use this skill

Skill file

Metabolomics Research

Comprehensive metabolomics research skill that identifies metabolites, analyzes studies, and searches metabolomics databases. Generates structured research reports with annotated metabolite information, study details, and database statistics.

Use Case

Use this skill when asked to:

Example queries:

Databases Covered

Primary metabolite databases:

Research Workflow

The skill executes a 4-phase analysis pipeline:

Phase 1: Metabolite Identification & Annotation

For each metabolite in the input list:

  1. Search HMDB by metabolite name
  2. Retrieve HMDB ID, chemical formula, molecular weight
  3. Get detailed metabolite information (description, pathways)
  4. Fallback to PubChem for CID and chemical properties if HMDB unavailable

Phase 2: Study Details Retrieval

For provided study IDs:

  1. Detect database type (MTBLS = MetaboLights, ST = Metabolomics Workbench)
  2. Retrieve study metadata (title, description, organism, status)
  3. Extract experimental design and data availability

Phase 3: Study Search

For keyword searches:

  1. Search MetaboLights studies by query term
  2. Return matching study IDs with preview information
  3. Report total number of results

Phase 4: Database Overview

Always included in reports:

  1. Sample recent studies from MetaboLights
  2. Database statistics and availability
  3. Integration information for all databases

Usage Patterns

Pattern 1: Metabolite Identification

Input:

Output report includes:

Pattern 2: Study Retrieval

Input:

Output report includes:

Pattern 3: Study Search

Input:

Output report includes:

Pattern 4: Comprehensive Analysis

Input:

Output report includes:

Input Parameters

metabolite_list (optional)

List of metabolite names to identify and annotate.

study_id (optional)

MetaboLights or Metabolomics Workbench study identifier.

search_query (optional)

Keyword to search metabolomics studies.

organism (optional)

Target organism for study filtering.

output_file (optional)

Path for the generated markdown report.

Output Format

All analyses generate a structured markdown report with:

Header section:

Phase sections:

Database overview:

Error handling:

Implementation Notes

SOAP Tool Handling

HMDB tools are SOAP-based and require special parameter handling:

Response Format Variations

Tools return different response formats - handle all three:

  1. Standard format: {status: "success", data: [...], metadata: {...}}
  2. Direct list: [...] (e.g., metabolights_list_studies)
  3. Direct dict: {field1: ..., field2: ...} (e.g., some detail endpoints)

Always check response type with isinstance() before accessing fields.

Fallback Strategy

Follow this hierarchy for robustness:

  1. Primary source: Try main database first (HMDB for metabolites, MetaboLights for studies)
  2. Fallback source: Use alternative database if primary fails (PubChem for chemical properties)
  3. Default behavior: Show error message with context, continue with remaining phases

Progressive Report Writing

Write report incrementally to avoid memory issues:

  1. Create output file early in pipeline
  2. Append sections as each phase completes
  3. Flush to disk regularly for long analyses
  4. Return file path for user access

Tool Discovery

The skill automatically discovers and uses these tools from ToolUniverse:

HMDB Tools:

MetaboLights Tools:

Metabolomics Workbench Tools:

PubChem Tools:

No manual tool configuration required - all tools loaded automatically.

Common Issues

Issue: HMDB returns "Error querying HMDB: 0"

Cause: HMDB search returned empty results or index error accessing first result

Solution: This is expected for uncommon metabolites; PubChem fallback will be attempted

Issue: Study details show "N/A" for all fields

Cause: Study ID not found or API unavailable

Solution: Verify study ID format (MTBLS* or ST*), check if study is public

Issue: Tool not found errors

Cause: Missing API keys for some databases

Solution: Check .env.template, add required API keys to .env file (most metabolomics tools work without keys)

Issue: Large metabolite lists cause slow execution

Cause: Pipeline queries each metabolite individually

Solution: Reports limit to first 10 metabolites; consider batching for >20 metabolites

Summary

The Metabolomics Research skill provides comprehensive metabolomics analysis through a 4-phase pipeline that:

  1. Identifies metabolites using HMDB (primary) and PubChem (fallback) databases
  2. Retrieves study details from MetaboLights and Metabolomics Workbench repositories
  3. Searches studies by keywords across metabolomics databases
  4. Generates structured reports with all findings in readable markdown format

Key Features:

Best for:

Reasoning Framework

Starting Point: Mass Spectrum Analysis

Metabolite identification starts with the mass spectrum. LOOK UP DON'T GUESS — always search HMDB/PubChem with the calculated neutral mass rather than guessing identity from m/z alone.

Evidence Grading (Metabolite Identification Confidence)

Interpretation Guidance

Metabolite identification: HMDB IDs provide the strongest annotation when paired with experimental validation. A PubChem-only match (fallback) indicates the metabolite is chemically characterized but may lack biological context (pathways, disease associations). Always report the identification confidence level.

Pathway enrichment strategy: When multiple metabolites map to the same KEGG or HMDB pathway, enrichment is meaningful only if the input list is unbiased (not pre-selected for that pathway). Report hits vs. pathway size (3/5 detected is more informative than 3/500). LOOK UP DON'T GUESS — use HMDB_get_metabolite to get pathway annotations for each metabolite rather than assuming pathway membership from names alone.

Biomarker discovery reasoning: A candidate biomarker should show: (1) consistent direction of change across samples (fold-change > 1.5), (2) statistical significance (FDR-adjusted p < 0.05), (3) biological plausibility — LOOK UP the metabolite's known disease associations via HMDB, and (4) reproducibility in an independent cohort. Single-study HMDB associations are hypothesis-generating, not confirmatory. Check MetaboLights/Metabolomics Workbench for independent validation datasets.

Synthesis Questions

A complete metabolomics report should answer:

  1. What is the identification confidence level for each metabolite (L1-L4)?
  2. Which biological pathways are enriched among the identified metabolites?
  3. Do any metabolites meet biomarker criteria (fold-change, significance, plausibility)?
  4. Are there relevant metabolomics studies (MTBLS/ST) for the disease or condition of interest?
  5. What cross-database evidence supports the biological relevance of key findings (HMDB pathways, PubChem bioactivity)?

Limitations:

See QUICK_START.md for Python SDK examples, MCP integration, and step-by-step tutorials.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.