ontology-term-resolution

Resolve free-text labels to ontology term IDs and validate CURIEs against the EBI OLS4 API.

41.1k|3.8k|Updated Oct 19, 2025
One-click install
npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill ontology-term-resolution
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ontology-term-resolution
Source: https://github.com/K-Dense-AI/scientific-agent-skills/tree/main/skills/ontology-term-resolution
Command: npx skills add https://github.com/K-Dense-AI/scientific-agent-skills --skill ontology-term-resolution

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

Ontology IDs written from memory or copied between files are silently wrong: a well-formed CURIE like UBERON:0002108 passes every downstream check while describing the wrong anatomical structure. This Skill resolves free-text scientific labels to verified ontology term IDs and audits existing CURIEs against the live EBI Ontology Lookup Service (OLS4), catching obsolete terms, label mismatches, and wrong-ontology assignments before they reach a submission.

Core Features & Use Cases

  • Text-to-ID resolution: Search OLS4 with an escalating exact/token/fulltext strategy ladder, with every candidate labelled exact_label, exact_synonym, or partial so weak matches are never mistaken for exact ones.
  • CURIE validation: Check that IDs exist, are not obsolete (with replacement terms reported), match their claimed labels, and sit in the required ontology and branch; exit codes make it usable as a CI gate on metadata files.
  • Ontology selection guidance: Reference tables map concepts to the right ontology (MONDO for disease, HP for phenotype, UBERON for tissue, CL for cell type, ChEBI for compounds, NCBITaxon for organism, PATO for sex) with branch roots for constraint checks.
  • Use Case: While preparing a CELLxGENE submission, resolve a column of tissue names to UBERON terms with exact-match enforcement, then validate the resulting ID/label pairs in strict mode to catch any drift before upload.

Quick Start

Ask the agent to resolve the tissue names in your metadata file to UBERON ontology IDs and validate that every resulting CURIE is current and correctly labelled.

Frequently Asked Questions about ontology-term-resolution

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I resolve free-text labels to ontology term IDs?

Run resolve_terms.py with the label and a target ontology, for example python3 resolve_terms.py "liver" --ontology uberon. It searches OLS4 with an exact-to-fulltext strategy ladder and labels each candidate as exact_label, exact_synonym, or partial so you can judge match quality.

How do I check whether an ontology CURIE is obsolete?

Run validate_terms.py with the CURIE, such as python3 validate_terms.py EFO:0001067. It queries the OLS4 term-detail endpoint, the only one that reports is_obsolete and term_replaced_by, and returns the replacement CURIE when one exists.

Which ontology should I use for disease, tissue, or cell type annotation?

Use MONDO for disease, HP for phenotype, UBERON for tissue and anatomy, CL for cell type, EFO for assays, ChEBI for chemicals, NCBITaxon for organism, and PATO for sex. The references/ontology-registry.md file lists prefix-to-OLS-id mappings and branch roots for constraint checks.

Does ontology term resolution require an API key or Python packages?

No API key is needed; the EBI OLS4 API at www.ebi.ac.uk/ols4 is public. The scripts require Python 3.11 or later and use only the standard library, so no third-party packages must be installed.

Why does an OLS search with exact=true return hundreds of hits?

The exact=true parameter performs exact token matching, not exact label matching, so a query for liver returns 161 UBERON hits. Restricting queryFields to label or label,synonym narrows it to true label matches, which the resolve script does automatically.

Can ontology validation run as a CI gate on metadata files?

Yes. validate_terms.py accepts a TSV or CSV with id and label columns and exits with code 1 when any term fails, 0 when all pass, and 2 on usage or network errors. The --strict flag promotes warnings like matched_synonym to failures.