Queries the EMBL-EBI InterPro REST API for protein family, domain, and functional-site annotations from Pfam, PANTHER, and other member databases. Useful for protein function prediction, domain architecture analysis, and GO term mapping.
InterPro (https://www.ebi.ac.uk/interpro/) is a comprehensive resource for protein family and domain classification maintained by EMBL-EBI. It integrates predictive signatures from its member databases — including Pfam, PANTHER, PRINTS, ProSite, SMART, NCBIfam, SUPERFAMILY, CDD, Gene3D, and others (see the member-database table below) — into a unified set of entries, providing a single view of functional annotation across UniProtKB. (The legacy TIGRFAMs were absorbed into NCBIfam.)
InterPro classifies proteins into:
Key resources:
requestsscripts/query_interpro.py — query the InterPro REST API (stdlib only, JSON to stdout):
python scripts/query_interpro.py protein P04637 # InterPro entries for a UniProt protein
python scripts/query_interpro.py entry IPR000719 # entry details
python scripts/query_interpro.py entry-proteins IPR000719 --page-size 25 # proteins with an entry
Use InterPro when:
| Scenario | Use Instead |
|---|---|
| Retrieving a UniProt entry, FASTA sequence, or ID mapping | alterlab-uniprot |
| Predicted 3D models and pLDDT confidence | alterlab-alphafold-db |
| Experimental structures, ligands, resolution | alterlab-pdb |
| Protein-protein interaction networks and enrichment | alterlab-string-db |
| Sequence similarity search against a database | alterlab-blast |
Hand-off rule. When the request matches a row above, open your answer by naming that skill by its exact id (for example alterlab-uniprot) and saying in one line why it fits better, then stop applying this skill's procedure. Name it even when you also need to ask for missing input. If only part of the request is out of scope, name the skill for that part and do only the in-scope part. A brief general pointer is fine; the named skill does the work.
Base URL: https://www.ebi.ac.uk/interpro/api/
import requests
BASE_URL = "https://www.ebi.ac.uk/interpro/api"
def interpro_get(endpoint, params=None):
url = f"{BASE_URL}/{endpoint}"
headers = {"Accept": "application/json"}
response = requests.get(url, params=params, headers=headers)
response.raise_for_status()
return response.json()
Endpoint direction gotcha (read this first). In the InterPro API the first
path segment is the resource type you get back. To list entries for a
protein, the protein filter goes last: entry/InterPro/protein/UniProt/{id}/.
To list proteins for an entry, the protein resource goes first:
protein/UniProt/entry/InterPro/{id}/. The reversed forms
(protein/UniProt/{id}/entry/InterPro/, entry/InterPro/{id}/protein/UniProt/)
return only a *_url wrapper with no results and count: null — a silent
empty, not an error.
def get_protein_entries(uniprot_id):
"""Get all InterPro entries that match a UniProt protein."""
# Resource (entry) first, protein filter last — see direction gotcha above.
data = interpro_get(f"entry/InterPro/protein/UniProt/{uniprot_id}/")
return data
# Example: Human p53 (TP53)
result = get_protein_entries("P04637")
entries = result.get("results", [])
for entry in entries:
meta = entry["metadata"] # `name` is a string on this grouped endpoint
print(f" {meta['accession']} ({meta['type']}): {meta['name']}")
# e.g., IPR002117 (family): p53 tumour suppressor family
# IPR011615 (domain): p53, DNA-binding domain
# IPR010991 (domain): p53, tetramerisation domain
def get_entry(interpro_id):
"""Fetch details for an InterPro entry."""
return interpro_get(f"entry/InterPro/{interpro_id}/")
# Example: Get the InterPro entry the WW domain maps to
ww_entry = get_entry("IPR001202")
# On the single-entry detail endpoint, `name` is a dict {"name", "short"};
# on list/grouped endpoints it is a plain string. Handle both:
name = ww_entry["metadata"]["name"]
print(f"Name: {name['name'] if isinstance(name, dict) else name}")
print(f"Type: {ww_entry['metadata']['type']}") # -> domain
# Member-database accessions resolve through the same endpoint shape.
# Use lowercase db names (entry/pfam/...); the response carries the
# integrated InterPro accession under metadata['integrated'].
def get_pfam_entry(pfam_id):
return interpro_get(f"entry/pfam/{pfam_id}/")
pfam = get_pfam_entry("PF00397") # metadata['integrated'] == 'IPR001202'
def get_proteins_for_entry(interpro_id, database="UniProt", page_size=25):
"""Get all proteins annotated with an InterPro entry."""
params = {"page_size": page_size}
# Resource (protein) first, entry filter last — see direction gotcha above.
data = interpro_get(f"protein/{database}/entry/InterPro/{interpro_id}/", params)
return data
# Example: count proteins carrying the protein kinase domain
kinase_proteins = get_proteins_for_entry("IPR000719") # Protein kinase domain
print(f"Total proteins: {kinase_proteins['count']}") # response has count/next/results
Per-residue match locations live on the entry/protein grouped endpoint, not
on the bare protein/UniProt/{id}/ record (that record only carries
metadata, with no entries key). Each entry's hits are under
results[].proteins[].entry_protein_locations[].fragments[]:
def get_domain_architecture(uniprot_id):
"""Get the domain architecture of a protein with sequence positions."""
data = interpro_get(f"entry/InterPro/protein/UniProt/{uniprot_id}/")
arch = []
for result in data.get("results", []):
meta = result["metadata"]
for prot in result.get("proteins", []):
for loc in prot.get("entry_protein_locations", []):
for frag in loc.get("fragments", []):
arch.append({
"accession": meta["accession"],
"type": meta["type"],
"name": meta["name"],
"start": frag["start"],
"end": frag["end"],
})
# Order along the sequence to read off the architecture N->C terminus
arch.sort(key=lambda d: d["start"])
return arch
# Example: full domain architecture for EGFR, ordered along the sequence
for d in get_domain_architecture("P00533"):
print(f" {d['start']:>5}-{d['end']:<5} {d['accession']} ({d['type']}): {d['name']}")
The protein record aggregates GO terms from all of its InterPro signatures under
metadata.go_terms (already deduplicated), so no per-entry walk is needed:
def get_go_terms_for_protein(uniprot_id):
"""Get GO terms associated with a protein via InterPro."""
data = interpro_get(f"protein/UniProt/{uniprot_id}/")
# NB: go_terms can be present but null for proteins with no GO mapping,
# so coalesce to [] rather than relying on the dict default.
return data.get("metadata", {}).get("go_terms") or []
# GO terms look like:
# {"identifier": "GO:0004672", "name": "protein kinase activity",
# "category": {"code": "F", "name": "molecular_function"}}
# category.code is one of F (molecular_function), P (biological_process),
# C (cellular_component).
To attribute GO terms to specific signatures instead of the protein as a whole,
read metadata.go_terms on each entry from
entry/InterPro/protein/UniProt/{id}/ (each entry carries its own go_terms).
def batch_lookup_proteins(uniprot_ids, database="UniProt"):
"""Look up multiple proteins and collect their InterPro entries."""
import time
results = {}
for uid in uniprot_ids:
try:
data = interpro_get(f"entry/InterPro/protein/{database}/{uid}/")
entries = data.get("results", [])
results[uid] = [
{
"accession": e["metadata"]["accession"],
"name": e["metadata"]["name"],
"type": e["metadata"]["type"]
}
for e in entries
]
except Exception as e:
results[uid] = {"error": str(e)}
time.sleep(0.3) # Rate limiting
return results
# Example
proteins = ["P04637", "P00533", "P38398", "Q9Y6I9"]
domain_info = batch_lookup_proteins(proteins)
for uid, entries in domain_info.items():
print(f"\n{uid}:")
for e in entries[:3]:
print(f" - {e['accession']} ({e['type']}): {e['name']}")
def search_entries(query, entry_type=None, taxonomy_id=None):
"""Search InterPro entries by text."""
params = {"search": query, "page_size": 20}
if entry_type:
params["type"] = entry_type # family, domain, homologous_superfamily, etc.
endpoint = "entry/InterPro/"
if taxonomy_id:
# taxonomy is a filter, not the returned resource, so it can follow
# the entry resource directly (lowercase 'uniprot' in the path).
endpoint = f"entry/InterPro/taxonomy/uniprot/{taxonomy_id}/"
return interpro_get(endpoint, params)
# Search for kinase-related entries
kinase_entries = search_entries("kinase", entry_type="domain")
# After running InterProScan and getting a UniProt ID:
def characterize_protein(uniprot_id):
"""Complete characterization workflow."""
# 1. Get all annotations
entries = get_protein_entries(uniprot_id)
# 2. Group by type
by_type = {}
for e in entries.get("results", []):
t = e["metadata"]["type"]
by_type.setdefault(t, []).append({
"accession": e["metadata"]["accession"],
"name": e["metadata"]["name"]
})
# 3. Get GO terms
go_terms = get_go_terms_for_protein(uniprot_id)
return {
"families": by_type.get("family", []),
"domains": by_type.get("domain", []),
"superfamilies": by_type.get("homologous_superfamily", []),
"go_terms": go_terms
}
The returned-resource type is whatever comes first in the path; trailing
filters narrow it. Reversing the two halves yields a *_url-only wrapper.
| Endpoint | Description |
|---|---|
/protein/UniProt/{id}/ | Full annotation for a protein (incl. metadata.go_terms) |
/entry/InterPro/protein/UniProt/{id}/ | InterPro entries for a protein (with match locations) |
/entry/InterPro/{id}/ | Details of an InterPro entry (name is a {name,short} dict) |
/entry/pfam/{id}/ | Pfam member-db entry details (metadata.integrated = InterPro id) |
/protein/UniProt/entry/InterPro/{id}/ | Proteins carrying an entry (paginated, with count) |
/entry/InterPro/?search=... | Search/list InterPro entries (name is a string here) |
/entry/InterPro/taxonomy/uniprot/{tax_id}/ | InterPro entries seen in a taxon (paginated) |
/structure/PDB/entry/InterPro/{id}/ | Structures mapped to an entry |
Source-database names as the API returns them (the source_database field /
entry/{db}/... path segment) are shown in parentheses where they differ.
| Database | Focus |
|---|---|
Pfam (pfam) | Protein domains (HMM profiles) |
PANTHER (panther) | Protein families and subfamilies |
PRINTS (prints) | Protein fingerprints |
ProSite patterns (prosite) | Amino acid patterns |
ProSite profiles (profile) | Protein profile patterns |
SMART (smart) | Mobile signalling/extracellular domains |
NCBIfam (ncbifam) | NCBI curated families (absorbed the former TIGRFAMs) |
SUPERFAMILY (ssf) | SCOP structural classification |
CDD (cdd) | Conserved Domain Database (NCBI) |
HAMAP (hamap) | Microbial protein families |
Gene3D (cathgene3d) | CATH structural classification |
PIRSF (pirsf) | PIR whole-protein families |
SFLD (sfld) | Structure-Function Linkage Database (enzymes) |
AntiFam (antifam) | Spurious-ORF filter (false-positive removal) |
family gives broad classification; domain gives specific structural/functional unitsWhat SKILL.md sets; muted values are Claude Code's defaults
Not loaded · from alterlab-writing-tools
Claude Code won't load this skill
It ships in alterlab-writing-tools at skills/, but Claude Code only loads skills/<name>/SKILL.md and folders listed under skills in plugin.json. Installing the plugin doesn't add it.
Generated from the plugin's indexed repository (alterlab-ieu/alterlab-academic-skills) — no native marketplace selected
npx claudepluginhub p/alterlab-ieu-alterlab-writing-tools241 skills in this plugin
/alterlab-abm-mesaBuilds agent-based models of social systems with Mesa 3 — the current AgentSet API (model.agents.shuffle_do('step'), auto-assigned unique_id, mandatory super().__init__(rng=...)), cell spaces (mesa.discrete_space OrthogonalMooreGrid / classic mesa.space grids), the DataCollector, batch_run parameter sweeps, and SolaraViz — for emergence, segregation, diffusion, opinion dynamics, and cooperation models. It uses the Mesa 3.x API (the old mesa.time schedulers like RandomActivation are removed) and treats the model as a generative theory to be validated, not just run. Use when the request mentions an agent-based model, Mesa, simulating interacting agents, or emergent macro behavior from micro rules. For discrete-event (queueing/process) simulation prefer alterlab-simpy; for reinforcement learning prefer alterlab-stable-baselines3. Part of the AlterLab Academic Skills suite./alterlab-academic-careerPrepares academic career documents and professional-development materials for faculty and researchers. Use when drafting academic CVs, research statements, teaching philosophies, diversity statements, faculty-position cover letters, tenure dossiers, promotion narratives, academic portfolios, or mentorship statements, and when planning conference-networking strategy, building academic web presence, setting up ORCID profiles, or understanding impact metrics. Part of the AlterLab Academic Skills suite.2 plugins in one repository ship this exact skill · first indexed Nov 9, 2026
Other plugins' skills for the same job