[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73GY05Q51G996D6TRGFSV6Y":3,"skill-same:01M73GY05Q51G996D6TRGFSV6Y":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M73GY05Q51G996D6TRGFSV6Y","interpro-database",null,"Query InterPro REST API for protein domain architecture, family classification, and member-DB integration. Search entries, retrieve a protein's domains, list family members, get taxonomic distribution, link to PDB. Unifies Pfam, PANTHER, PIRSF, PRINTS, PROSITE, SMART, CDD, NCBIfam. Use uniprot-protein-database for sequences; pdb-database for 3D structures.","bg-szy\u002FTOP-SKILLS","bg-szy","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F106576190?v=4","01M73A4E8KPV67SFXRY8XZGNBX","ShuZhiyong","01M73A4E96MQ294MHM74TZBVQD",6,"CC-BY-4.0","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fawesome-skills\u002Finterpro-database\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: \"interpro-database\"\ndescription: \"Query InterPro REST API for protein domain architecture, family classification, and member-DB integration. Search entries, retrieve a protein's domains, list family members, get taxonomic distribution, link to PDB. Unifies Pfam, PANTHER, PIRSF, PRINTS, PROSITE, SMART, CDD, NCBIfam. Use uniprot-protein-database for sequences; pdb-database for 3D structures.\"\nlicense: \"CC-BY-4.0\"\n---\n\n# InterPro Database\n\n## Overview\n\nInterPro is the EBI's integrated protein family, domain, and functional site database. It consolidates signatures from 13 member databases (Pfam, PANTHER, PIRSF, PRINTS, PROSITE, SMART, CDD, NCBIfam, and others) into unified InterPro entries, each describing a homologous superfamily, domain, family, repeat, or conserved site. The REST API at `https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\u002F` is free and requires no authentication.\n\n## When to Use\n\n- Identifying all domains and families present in a protein by UniProt accession (domain architecture)\n- Searching for proteins that contain a specific domain or belong to a specific family\n- Finding the taxonomic distribution of organisms that encode a given domain or family\n- Cross-linking a domain to experimental 3D structures in the PDB\n- Checking which source databases (Pfam, PANTHER, SMART, etc.) cover an InterPro entry\n- Discovering InterPro entries by keyword (e.g., \"kinase domain\") when you do not yet know the accession\n- For protein sequence retrieval, functional annotations (GO, pathways, active sites), and ID mapping use `uniprot-protein-database`\n- For downloading domain-aligned sequences or building HMM profiles use `Pfam` directly; InterPro is the meta-layer\n\n## Prerequisites\n\n- **Python packages**: `requests`, `pandas`, `matplotlib`\n- **Data requirements**: UniProt accessions (e.g., `P04637`) or InterPro accessions (e.g., `IPR011009`)\n- **Environment**: internet connection; no API key required\n- **Rate limits**: no published hard limit; use `time.sleep(1.0)` between requests for batch queries; paginate with `?cursor=` or `?page_size=`\n\n```bash\npip install requests pandas matplotlib\n```\n\n## Quick Start\n\n```python\nimport requests\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef interpro_get(path: str, params: dict = None) -> dict:\n    \"\"\"Send a GET request to the InterPro API and return parsed JSON.\"\"\"\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002F{path}\",\n        params=params,\n        headers={\"Accept\": \"application\u002Fjson\"},\n        timeout=30\n    )\n    r.raise_for_status()\n    return r.json()\n\n# Get domain architecture for TP53 (P04637)\n# Note: `protein\u002Funiprot\u002F{acc}\u002F` returns only {metadata}; the entries-per-protein\n# data lives at `entry\u002Finterpro\u002Fprotein\u002Funiprot\u002F{acc}\u002F` and is keyed `results`.\ndata = interpro_get(\"entry\u002Finterpro\u002Fprotein\u002Funiprot\u002FP04637\u002F\")\nentries = data.get(\"results\", [])\nprint(f\"InterPro entries for TP53: {data.get('count')}  (this page: {len(entries)})\")\nfor e in entries[:4]:\n    m = e[\"metadata\"]\n    print(f\"  {m['accession']}  {m['type']:\u003C25}  {m['name']}\")\n# InterPro entries for TP53: 9\n#   IPR002117  family                     p53 tumour suppressor family\n#   IPR036674  homologous_superfamily     p53-like tetramerisation domain superfamily\n```\n\n## Core API\n\n### Query 1: Entry Search\n\nSearch for InterPro entries by name keyword or fetch a specific entry by accession.\n\n```python\nimport requests\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef search_entries(query: str, entry_type: str = None,\n                   page_size: int = 20) -> list:\n    \"\"\"Search InterPro entries by keyword; optionally filter by type.\"\"\"\n    params = {\"search\": query, \"page_size\": page_size}\n    if entry_type:\n        params[\"type\"] = entry_type   # family, domain, homologous_superfamily, repeat, site\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002Fentry\u002Finterpro\u002F\",\n        params=params,\n        headers={\"Accept\": \"application\u002Fjson\"},\n        timeout=30\n    )\n    r.raise_for_status()\n    return r.json().get(\"results\", [])\n\nhits = search_entries(\"serine kinase\", entry_type=\"domain\")\nprint(f\"InterPro domain entries matching 'serine kinase': {len(hits)}\")\nfor h in hits[:5]:\n    m = h[\"metadata\"]\n    print(f\"  {m['accession']}  {m['type']:\u003C10}  {m['name']}\")\n# InterPro domain entries matching 'serine kinase': 8\n#   IPR000719  domain    Protein kinase domain\n#   IPR008271  domain    Serine\u002Fthreonine\u002Ftyrosine kinase, active site\n```\n\n```python\n# Fetch a specific InterPro entry by accession\nr = requests.get(\n    f\"{INTERPRO_BASE}\u002Fentry\u002Finterpro\u002FIPR000719\u002F\",\n    headers={\"Accept\": \"application\u002Fjson\"},\n    timeout=30\n)\nr.raise_for_status()\nmeta = r.json()[\"metadata\"]\nprint(f\"Accession    : {meta['accession']}\")\nprint(f\"Name         : {meta['name']}\")\nprint(f\"Type         : {meta['type']}\")\nprint(f\"Member DBs   : {list(meta.get('member_databases', {}).keys())}\")\ngo_terms = meta.get(\"go_terms\", [])\nprint(f\"GO terms     : {[g['identifier'] for g in go_terms[:3]]}\")\n# Accession    : IPR000719\n# Name         : Protein kinase domain\n# Type         : domain\n# Member DBs   : ['pfam', 'smart', 'cdd', 'ncbifam', 'panther']\n# GO terms     : ['GO:0004672', 'GO:0005524', 'GO:0006468']\n```\n\n### Query 2: Protein Domain Architecture\n\nRetrieve all InterPro entries (domains, families, sites) matched in a protein by UniProt accession.\n\n```python\nimport requests\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef get_protein_domain_architecture(uniprot_acc: str) -> dict:\n    \"\"\"Return all InterPro entry matches for a protein. Uses the\n    `entry\u002Finterpro\u002Fprotein\u002Funiprot\u002F{acc}\u002F` endpoint, which returns\n    {count, next, previous, results}. Each result has metadata + a\n    nested `proteins[0].entry_protein_locations` for the per-protein match.\"\"\"\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002Fentry\u002Finterpro\u002Fprotein\u002Funiprot\u002F{uniprot_acc}\u002F\",\n        headers={\"Accept\": \"application\u002Fjson\"},\n        timeout=60\n    )\n    r.raise_for_status()\n    return r.json()\n\ndata = get_protein_domain_architecture(\"P04637\")   # TP53\nresults = data.get(\"results\", [])\n# Pull length\u002Fsource from the first match's nested protein record\nprot0 = results[0][\"proteins\"][0] if results and results[0].get(\"proteins\") else {}\nprint(f\"Protein length : {prot0.get('protein_length')}\")\nprint(f\"Source DB      : {prot0.get('source_database')}\")\nprint(f\"InterPro entries: {data.get('count')}\")\nfor entry in results[:6]:\n    m = entry[\"metadata\"]\n    # Locations are nested under proteins[0].entry_protein_locations\n    locs = entry[\"proteins\"][0].get(\"entry_protein_locations\", []) if entry.get(\"proteins\") else []\n    loc_str = \", \".join(\n        f\"{frag['start']}-{frag['end']}\"\n        for loc in locs for frag in loc.get(\"fragments\", [])\n    )\n    print(f\"  {m['accession']}  {m['type']:\u003C25}  {m['name'][:35]:\u003C35}  [{loc_str}]\")\n```\n\n```python\n# Compare domain architectures of two proteins side-by-side\nimport pandas as pd\n\ndef domain_set(uniprot_acc: str) -> set:\n    data = get_protein_domain_architecture(uniprot_acc)\n    return {e[\"metadata\"][\"accession\"] for e in data.get(\"results\", [])}\n\nbrca1_domains = domain_set(\"P38398\")   # BRCA1\ntp53_domains   = domain_set(\"P04637\")  # TP53\n\nshared = brca1_domains & tp53_domains\nunique_brca1 = brca1_domains - tp53_domains\nunique_tp53  = tp53_domains - brca1_domains\nprint(f\"Shared InterPro entries: {len(shared)}\")\nprint(f\"BRCA1-unique           : {len(unique_brca1)}\")\nprint(f\"TP53-unique            : {len(unique_tp53)}\")\n```\n\n### Query 3: Entry Proteins\n\nList proteins that contain a specific InterPro entry (family or domain).\n\n```python\nimport requests, time\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef get_entry_proteins(interpro_acc: str, reviewed_only: bool = True,\n                       page_size: int = 50) -> list:\n    \"\"\"Return proteins (UniProt) containing a given InterPro entry.\n    Path order is `\u002Fprotein\u002F{db}\u002Fentry\u002Finterpro\u002F{IPR}\u002F` — the inverse\n    `entry\u002Finterpro\u002F{IPR}\u002Fprotein\u002F{db}\u002F` times out (408) on large families.\"\"\"\n    db = \"reviewed\" if reviewed_only else \"uniprot\"\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002Fprotein\u002F{db}\u002Fentry\u002Finterpro\u002F{interpro_acc}\u002F\",\n        params={\"page_size\": page_size},\n        headers={\"Accept\": \"application\u002Fjson\"},\n        timeout=60\n    )\n    r.raise_for_status()\n    return r.json().get(\"results\", [])\n\nproteins = get_entry_proteins(\"IPR011009\")   # Protein kinase-like domain SF\nprint(f\"Reviewed proteins with IPR011009 (page 1): {len(proteins)}\")\nfor p in proteins[:4]:\n    m = p[\"metadata\"]\n    # metadata fields: accession, gene, length, name, source_database, source_organism\n    print(f\"  {m['accession']}  {(m.get('gene') or ''):\u003C8}  \"\n          f\"len={m.get('length', '?')}  \"\n          f\"org={(m.get('source_organism') or {}).get('scientificName', '')[:30]}\")\n```\n\n```python\n# Paginate all proteins for a family using cursor\ndef get_all_entry_proteins(interpro_acc: str,\n                            reviewed_only: bool = True) -> list:\n    INTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n    db = \"reviewed\" if reviewed_only else \"uniprot\"\n    # Path-inverted: \u002Fprotein\u002F{db}\u002Fentry\u002Finterpro\u002F{IPR}\u002F is the working order\n    url = f\"{INTERPRO_BASE}\u002Fprotein\u002F{db}\u002Fentry\u002Finterpro\u002F{interpro_acc}\u002F\"\n    all_proteins = []\n    params = {\"page_size\": 200}\n    while url:\n        r = requests.get(url, params=params,\n                         headers={\"Accept\": \"application\u002Fjson\"}, timeout=60)\n        r.raise_for_status()\n        data = r.json()\n        all_proteins.extend(data.get(\"results\", []))\n        url = data.get(\"next\")\n        params = None   # next URL already has params encoded\n        if url:\n            time.sleep(1.0)\n    return all_proteins\n\nproteins = get_all_entry_proteins(\"IPR000719\")   # Protein kinase domain\nprint(f\"Total reviewed proteins with protein kinase domain: {len(proteins)}\")\n```\n\n### Query 4: Entry Taxonomy\n\nGet the taxonomic distribution of proteins annotated with a given InterPro entry.\n\n```python\nimport requests\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef get_entry_taxonomy(interpro_acc: str,\n                        page_size: int = 50) -> list:\n    \"\"\"Return taxonomic summary for proteins in a given InterPro entry.\n    Path-inverted: `\u002Ftaxonomy\u002Funiprot\u002Fentry\u002Finterpro\u002F{IPR}\u002F`. Each result\n    has `metadata` (taxon: accession=taxId, name, parent, children, rank)\n    and `entries[]` (representative protein-match locations for that taxon).\"\"\"\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002Ftaxonomy\u002Funiprot\u002Fentry\u002Finterpro\u002F{interpro_acc}\u002F\",\n        params={\"page_size\": page_size},\n        headers={\"Accept\": \"application\u002Fjson\"},\n        timeout=90\n    )\n    r.raise_for_status()\n    return r.json().get(\"results\", [])\n\n# Use a smaller entry (p53 DBD); IPR000719 (kinase) has ~270k taxa and times out.\ntaxa = get_entry_taxonomy(\"IPR011615\")\nprint(f\"Top taxa for IPR011615 (p53 DNA-binding domain):\")\nfor t in taxa[:8]:\n    m = t[\"metadata\"]\n    print(f\"  taxId={m['accession']:>10}  {m.get('name', ''):\u003C30}  \"\n          f\"rank={m.get('rank') or 'n\u002Fa'}\")\n```\n\n### Query 5: Structure Integration\n\nRetrieve PDB structures associated with an InterPro entry.\n\n```python\nimport requests\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef get_entry_structures(interpro_acc: str, page_size: int = 25) -> list:\n    \"\"\"Return PDB structures that include a match to a given InterPro entry.\n    Path-inverted: `\u002Fstructure\u002Fpdb\u002Fentry\u002Finterpro\u002F{IPR}\u002F`. The flat form with\n    `?entry_interpro=...` is silently slow \u002F 408s on this resource.\"\"\"\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002Fstructure\u002Fpdb\u002Fentry\u002Finterpro\u002F{interpro_acc}\u002F\",\n        params={\"page_size\": page_size},\n        headers={\"Accept\": \"application\u002Fjson\"},\n        timeout=60\n    )\n    r.raise_for_status()\n    return r.json().get(\"results\", [])\n\nstructures = get_entry_structures(\"IPR011009\")   # Protein kinase-like SF\nprint(f\"PDB structures linked to IPR011009 (page 1): {len(structures)}\")\nfor s in structures[:5]:\n    m = s[\"metadata\"]\n    print(f\"  {m['accession'].upper()}  resolution={m.get('resolution', 'N\u002FA')} Å  \"\n          f\"experiment={m.get('experiment_type', 'N\u002FA')}\")\n# PDB structures linked to IPR011009: ~8,000+\n#   1A06  resolution=2.5 Å  experiment=x-ray\n#   ...\n```\n\n### Query 6: Domain Sequence Retrieval\n\nDownload the FASTA sequences of proteins in an InterPro family for alignment or phylogenetics.\n\n```python\nimport requests, time\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef get_family_fasta(interpro_acc: str,\n                      reviewed_only: bool = True,\n                      max_sequences: int = 100) -> str:\n    \"\"\"Retrieve FASTA sequences for proteins in an InterPro entry.\"\"\"\n    db = \"reviewed\" if reviewed_only else \"uniprot\"\n    proteins = []\n    # Path-inverted: protein-list-for-entry is \u002Fprotein\u002F{db}\u002Fentry\u002Finterpro\u002F{IPR}\u002F\n    url = f\"{INTERPRO_BASE}\u002Fprotein\u002F{db}\u002Fentry\u002Finterpro\u002F{interpro_acc}\u002F\"\n    params = {\"page_size\": min(max_sequences, 200)}\n    while url and len(proteins) \u003C max_sequences:\n        r = requests.get(url, params=params,\n                         headers={\"Accept\": \"application\u002Fjson\"}, timeout=60)\n        r.raise_for_status()\n        data = r.json()\n        proteins.extend(data.get(\"results\", []))\n        url = data.get(\"next\") if len(proteins) \u003C max_sequences else None\n        params = None\n        if url:\n            time.sleep(1.0)\n\n    # Fetch FASTA from UniProt for each accession\n    accessions = [p[\"metadata\"][\"accession\"] for p in proteins[:max_sequences]]\n    fasta_url = \"https:\u002F\u002Frest.uniprot.org\u002Funiprotkb\u002Fstream\"\n    query = \" OR \".join(f\"accession:{acc}\" for acc in accessions)\n    r = requests.get(fasta_url,\n                     params={\"query\": query, \"format\": \"fasta\"},\n                     timeout=120)\n    r.raise_for_status()\n    return r.text\n\nfasta = get_family_fasta(\"IPR000719\", reviewed_only=True, max_sequences=20)\nseq_count = fasta.count(\">\")\nprint(f\"FASTA sequences retrieved: {seq_count}\")\nprint(fasta[:300])   # preview first sequence header + start\n```\n\n## Key Concepts\n\n### InterPro Entry Types\n\nInterPro classifies entries into five types. The type determines what biological relationship the match implies:\n\n| Type | Description | Example |\n|------|-------------|---------|\n| `family` | Homologous group of proteins sharing common ancestry and function | IPR000719 (Protein kinase) |\n| `domain` | Discrete structural and functional unit that can occur in multiple protein contexts | IPR011009 (Protein kinase-like SF) |\n| `homologous_superfamily` | Structurally similar domains that may have diverged in sequence | IPR011993 (Pleckstrin-like) |\n| `repeat` | Short, repeated sequence unit that occurs multiple times within a protein | IPR001440 (TPR repeat) |\n| `site` | Short conserved motif: active site, binding site, or post-translational modification site | IPR008271 (Ser\u002FThr kinase active site) |\n\n### Member Database Hierarchy\n\nEach InterPro entry integrates signatures from one or more member databases. The InterPro accession (`IPR...`) is the unified meta-entry; member database accessions point to the underlying models:\n\n| Member DB | Accession prefix | Modeling approach |\n|-----------|-----------------|-------------------|\n| Pfam | PF | Hidden Markov Models (profile HMMs) |\n| PANTHER | PTHR | Phylogenetic trees + HMMs |\n| PIRSF | PIRSF | Full-length HMMs |\n| PRINTS | PR | Fingerprint motif groups |\n| PROSITE | PS | Patterns and profiles |\n| SMART | SM | HMMs with database integration |\n| CDD | cd | Position-specific scoring matrices (PSSMs) |\n| NCBIfam | NF | NCBI-curated HMMs |\n\n### Pagination\n\nThe InterPro API paginates results at the collection level. Each response includes a `next` URL (or `null` when exhausted) and a `count` field. For large families (e.g., kinases: 10,000+ proteins) always iterate using the `next` cursor.\n\n```python\nimport requests, time\n\ndef iterate_interpro(url: str, page_size: int = 200) -> list:\n    \"\"\"Generic paginator for any InterPro list endpoint.\"\"\"\n    results = []\n    params = {\"page_size\": page_size}\n    while url:\n        r = requests.get(url, params=params,\n                         headers={\"Accept\": \"application\u002Fjson\"}, timeout=60)\n        r.raise_for_status()\n        data = r.json()\n        results.extend(data.get(\"results\", []))\n        url = data.get(\"next\")\n        params = None\n        if url:\n            time.sleep(1.0)\n    return results\n```\n\n## Common Workflows\n\n### Workflow 1: Domain Architecture Report for a Protein Set\n\n**Goal**: Retrieve all InterPro domains for a list of proteins and produce a summary table showing which domains each protein carries.\n\n```python\nimport requests, time, pandas as pd\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef get_domains(uniprot_acc: str) -> list:\n    \"\"\"List InterPro entries for a protein. Uses the\n    `entry\u002Finterpro\u002Fprotein\u002Funiprot\u002F{acc}\u002F` endpoint (keyed `results`).\"\"\"\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002Fentry\u002Finterpro\u002Fprotein\u002Funiprot\u002F{uniprot_acc}\u002F\",\n        headers={\"Accept\": \"application\u002Fjson\"}, timeout=60\n    )\n    if r.status_code == 404:\n        return []\n    r.raise_for_status()\n    data = r.json()\n    return [\n        {\n            \"protein\": uniprot_acc,\n            \"accession\": e[\"metadata\"][\"accession\"],\n            \"name\": e[\"metadata\"][\"name\"],\n            \"type\": e[\"metadata\"][\"type\"],\n            \"source_db\": list(e[\"metadata\"].get(\"member_databases\", {}).keys()),\n        }\n        for e in data.get(\"results\", [])\n    ]\n\nproteins = [\"P04637\", \"P38398\", \"Q00987\", \"P10415\"]  # TP53, BRCA1, MDM2, BCL2\nrows = []\nfor acc in proteins:\n    rows.extend(get_domains(acc))\n    time.sleep(1.0)\n\ndf = pd.DataFrame(rows)\nprint(f\"Total domain matches: {len(df)}\")\nprint(df.groupby([\"protein\", \"type\"])[\"accession\"].count().unstack(fill_value=0))\n\n# Pivot: proteins × domain accessions\npivot = df[df[\"type\"] == \"domain\"].pivot_table(\n    index=\"protein\", columns=\"accession\", aggfunc=\"size\", fill_value=0\n)\npivot.to_csv(\"domain_architecture_matrix.csv\")\nprint(f\"\\nDomain × protein matrix: {pivot.shape}\")\n```\n\n### Workflow 2: Find Kinase Family Members with PDB Structures\n\n**Goal**: Retrieve proteins in a kinase domain family that have experimental structures in the PDB, ranked by resolution.\n\n```python\nimport requests, time, pandas as pd\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\n# Step 1: Get PDB structures linked to the protein kinase-like SF entry.\n# Use the path-inverted form; the flat `?entry_interpro=` filter 408s.\nr = requests.get(\n    f\"{INTERPRO_BASE}\u002Fstructure\u002Fpdb\u002Fentry\u002Finterpro\u002FIPR011009\u002F\",\n    params={\"page_size\": 200},\n    headers={\"Accept\": \"application\u002Fjson\"}, timeout=60\n)\nr.raise_for_status()\nstructures = r.json().get(\"results\", [])\nprint(f\"PDB structures with IPR011009 (kinase-like SF, page 1): {len(structures)}\")\n\nrows = []\nfor s in structures:\n    m = s[\"metadata\"]\n    rows.append({\n        \"pdb_id\": m[\"accession\"],\n        \"resolution\": m.get(\"resolution\"),\n        \"experiment\": m.get(\"experiment_type\", \"\"),\n        \"name\": m.get(\"name\", \"\"),\n    })\n\ndf = pd.DataFrame(rows)\ndf = df.dropna(subset=[\"resolution\"]).sort_values(\"resolution\")\nprint(f\"\\nTop 10 highest-resolution kinase structures:\")\nprint(df[[\"pdb_id\", \"resolution\", \"experiment\", \"name\"]].head(10).to_string(index=False))\ndf.to_csv(\"kinase_structures.csv\", index=False)\nprint(f\"\\nSaved kinase_structures.csv ({len(df)} X-ray \u002F cryo-EM structures)\")\n```\n\n### Workflow 3: Taxonomic Coverage Bar Chart for a Domain\n\n**Goal**: Visualize how many reviewed proteins in each major kingdom carry a given InterPro domain.\n\n```python\nimport requests, time\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef get_taxonomy_counts(interpro_acc: str, page_size: int = 100,\n                        max_pages: int = 5) -> pd.DataFrame:\n    \"\"\"Walk the taxonomy results for an InterPro entry. The API does not\n    expose a per-taxon protein count at this endpoint — instead each\n    paged record is one (taxon × representative protein-match) row.\n    Aggregate client-side by taxon name to approximate frequency.\"\"\"\n    rows, url = [], f\"{INTERPRO_BASE}\u002Ftaxonomy\u002Funiprot\u002Fentry\u002Finterpro\u002F{interpro_acc}\u002F\"\n    params = {\"page_size\": page_size}\n    for _ in range(max_pages):\n        if not url:\n            break\n        r = requests.get(url, params=params,\n                         headers={\"Accept\": \"application\u002Fjson\"}, timeout=90)\n        r.raise_for_status()\n        data = r.json()\n        for t in data.get(\"results\", []):\n            m = t[\"metadata\"]\n            rows.append({\n                \"taxon_id\": m[\"accession\"],\n                \"name\": m.get(\"name\", \"\"),\n                \"rank\": m.get(\"rank\") or \"\",\n            })\n        url = data.get(\"next\")\n        params = None\n        if url:\n            time.sleep(1.0)\n    return pd.DataFrame(rows)\n\nIPR_ACC = \"IPR011615\"   # p53 DNA-binding domain (smaller; kinase 408s)\ndf = get_taxonomy_counts(IPR_ACC, max_pages=3)\nprint(f\"Tax entries pulled for {IPR_ACC}: {len(df)}\")\n\n# Aggregate by name and take top 15 (each row = one rep. protein-match)\ntop = (df.groupby(\"name\").size().sort_values(ascending=False).head(15)\n       .reset_index(name=\"rep_matches\"))\nfig, ax = plt.subplots(figsize=(10, 5))\nbars = ax.barh(top[\"name\"], top[\"rep_matches\"], color=\"#2171B5\")\nax.bar_label(bars, fmt=\"%d\", padding=3, fontsize=8)\nax.set_xlabel(\"Representative protein-matches\")\nax.set_title(f\"Taxonomic distribution of {IPR_ACC} (p53 DNA-binding domain)\")\nax.invert_yaxis()\nplt.tight_layout()\nplt.savefig(f\"{IPR_ACC}_taxonomy.png\", dpi=150, bbox_inches=\"tight\")\nprint(f\"Saved {IPR_ACC}_taxonomy.png\")\n```\n\n## Key Parameters\n\n| Parameter | Endpoint | Default | Range \u002F Options | Effect |\n|-----------|----------|---------|-----------------|--------|\n| `search` | `entry\u002Finterpro\u002F` | — | free-text string | Keyword filter on entry name and short name |\n| `type` | `entry\u002Finterpro\u002F` | all types | `family`, `domain`, `homologous_superfamily`, `repeat`, `site` | Filter entries by InterPro type |\n| `page_size` | all list endpoints | `20` | `1`–`200` | Results returned per page |\n| `entry_interpro` | `structure\u002Fpdb\u002F` | — | `IPR######` | Filter structures by linked InterPro entry |\n| `source_database` | `protein\u002F` | — | `reviewed`, `uniprot`, `trembl` | Filter proteins by UniProt curation level |\n| `reviewed` (URL path) | `entry\u002F{ipr}\u002F{acc}\u002Fprotein\u002F` | uniprot | `reviewed`, `uniprot` | Swiss-Prot reviewed only vs all UniProtKB |\n| `relations` | `entry\u002Finterpro\u002F{acc}\u002F` | — | `contains`, `contained_by`, `child_of`, `parent_of` | Navigate the InterPro hierarchy |\n| `next` | all list endpoints | — | URL from response | Cursor-based pagination; use the full URL from the `next` field |\n\n## Best Practices\n\n1. **Use `reviewed` proteins for curated domain lists**: The unreviewed TrEMBL set is 5–10× larger and contains automated predictions. For benchmarking, family analysis, or training sets, restrict to `reviewed` (Swiss-Prot) entries to avoid noise from unreviewed predictions.\n\n2. **Chunk large taxonomy or protein lists**: Retrieving all 10,000+ proteins for a broad family like the protein kinase superfamily can take minutes and produce large payloads. Limit queries with `page_size=200` and the `next` cursor; store intermediate results to disk.\n\n3. **Add `time.sleep(1.0)` between paginated calls**: The InterPro API is shared EBI infrastructure with no published rate limit. A 1-second pause per page is a safe minimum for batch scripts.\n\n4. **Prefer InterPro accessions over member DB accessions for cross-database queries**: A Pfam PF00069 and PANTHER PTHR24340 both model kinase domains but with different protein coverage. Using the parent InterPro `IPR000719` gives the union of all member DB matches in one query.\n\n5. **Check `type` before interpreting `entry_protein_locations`**: Only `domain`, `repeat`, and `site` entries carry meaningful position information. `family` and `homologous_superfamily` entries typically span the full protein and their coordinates are less informative.\n\n## Common Recipes\n\n### Recipe: Quick Domain Check for a Protein\n\nWhen to use: Given a UniProt accession, rapidly list which InterPro domains it contains.\n\n```python\nimport requests\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef list_protein_domains(uniprot_acc: str) -> list:\n    \"\"\"Return list of (accession, type, name) tuples for a protein.\"\"\"\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002Fentry\u002Finterpro\u002Fprotein\u002Funiprot\u002F{uniprot_acc}\u002F\",\n        headers={\"Accept\": \"application\u002Fjson\"}, timeout=60\n    )\n    r.raise_for_status()\n    return [\n        (e[\"metadata\"][\"accession\"], e[\"metadata\"][\"type\"], e[\"metadata\"][\"name\"])\n        for e in r.json().get(\"results\", [])\n    ]\n\ndomains = list_protein_domains(\"P00533\")   # EGFR\nprint(f\"InterPro entries in EGFR (P00533): {len(domains)}\")\nfor acc, etype, name in domains:\n    print(f\"  {acc}  {etype:\u003C25}  {name}\")\n# InterPro entries in EGFR (P00533): 10\n#   IPR009030  homologous_superfamily   Growth factor receptor, cysteine-rich\n#   IPR000719  domain                   Protein kinase domain\n```\n\n### Recipe: Find All Proteins in a Family with Source DB Coverage\n\nWhen to use: Map how many proteins in a domain family are covered by each member database (Pfam vs PANTHER vs SMART, etc.).\n\n```python\nimport requests, time\nimport pandas as pd\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ninterpro_acc = \"IPR000719\"   # Protein kinase domain\nr = requests.get(\n    f\"{INTERPRO_BASE}\u002Fentry\u002Finterpro\u002F{interpro_acc}\u002F\",\n    headers={\"Accept\": \"application\u002Fjson\"}, timeout=30\n)\nr.raise_for_status()\nmember_dbs = r.json()[\"metadata\"].get(\"member_databases\", {})\nprint(f\"Member databases for {interpro_acc}:\")\nfor db, details in member_dbs.items():\n    print(f\"  {db}: {details}\")\n\n# Visualize member database source breakdown\nlabels = list(member_dbs.keys())\nimport matplotlib.pyplot as plt\nfig, ax = plt.subplots(figsize=(7, 4))\nax.bar(labels, [1] * len(labels), color=\"#4472C4\")   # presence\u002Fabsence per DB\nax.set_ylabel(\"Integrated (1=yes)\")\nax.set_title(f\"Member databases in {interpro_acc}\")\nplt.tight_layout()\nplt.savefig(f\"{interpro_acc}_member_dbs.png\", dpi=150, bbox_inches=\"tight\")\n```\n\n### Recipe: Get GO Terms for an InterPro Entry\n\nWhen to use: Bridge from structural domain to functional GO annotation.\n\n```python\nimport requests\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef get_go_terms_for_entry(interpro_acc: str) -> list:\n    \"\"\"Return GO terms associated with an InterPro entry.\"\"\"\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002Fentry\u002Finterpro\u002F{interpro_acc}\u002F\",\n        headers={\"Accept\": \"application\u002Fjson\"}, timeout=30\n    )\n    r.raise_for_status()\n    go_terms = r.json()[\"metadata\"].get(\"go_terms\", [])\n    return [\n        {\"id\": g[\"identifier\"], \"name\": g[\"name\"],\n         \"category\": g.get(\"category\", {}).get(\"name\", \"\")}\n        for g in go_terms\n    ]\n\ngo_terms = get_go_terms_for_entry(\"IPR000719\")\nprint(f\"GO terms for IPR000719 (protein kinase domain): {len(go_terms)}\")\nfor g in go_terms:\n    print(f\"  {g['id']}  [{g['category'][:2].upper()}]  {g['name']}\")\n# GO terms for IPR000719 (protein kinase domain): 3\n#   GO:0004672  [MO]  protein kinase activity\n#   GO:0005524  [MO]  ATP binding\n#   GO:0006468  [BI]  protein phosphorylation\n```\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| `HTTP 404` on protein lookup | Accession not found in InterPro | Verify the UniProt accession exists; isoform accessions (P12345-2) may not be indexed separately |\n| Empty entries list for a protein | Protein has no InterPro matches (e.g., intrinsically disordered) | Check UniProt directly; not all proteins have classified domains |\n| `protein\u002Funiprot\u002F{acc}\u002F` returns only `metadata` (no entries) | That endpoint is *protein-only*; entry matches live elsewhere | Use `entry\u002Finterpro\u002Fprotein\u002Funiprot\u002F{acc}\u002F` and read the `results[]` key |\n| `entry\u002Finterpro\u002F{IPR}\u002Fprotein\u002F{db}\u002F` returns 408 \u002F hangs | The path with `entry\u002F...` first does a slow join | Invert the path: `protein\u002F{db}\u002Fentry\u002Finterpro\u002F{IPR}\u002F` |\n| `structure\u002Fpdb\u002F?entry_interpro={IPR}` times out (408) | Same join order issue | Use `structure\u002Fpdb\u002Fentry\u002Finterpro\u002F{IPR}\u002F` |\n| `entry\u002Finterpro\u002F{IPR}\u002Ftaxonomy\u002Funiprot\u002F` 408s for large families | Same | Use `taxonomy\u002Funiprot\u002Fentry\u002Finterpro\u002F{IPR}\u002F`; for very large entries (e.g. IPR000719 kinase) the inverted form may still 408 — fall back to a more specific sub-family entry |\n| `HTTP 400` on entry search | Invalid query parameters or unsupported `type` value | Use one of: `family`, `domain`, `homologous_superfamily`, `repeat`, `site` |\n| Pagination stops early | `next` is `null` before expected count | This is correct; all results have been returned |\n| Very slow response for large families | Protein set has thousands of members | Increase `page_size` to `200`; persist results after each page |\n| `ConnectionError` or `Timeout` | Transient network or server issue | Retry with exponential backoff; EBI services occasionally have brief downtimes |\n| Member DB accessions missing | Entry is new and member DB integration is pending | Use the InterPro accession for queries; member DB-level details update with each release |\n\n## Related Skills\n\n- `uniprot-protein-database` — UniProt REST API for protein sequences, Swiss-Prot functional annotations (active sites, PTMs, disease associations), and ID mapping\n- `esm-protein-language-model` — Generate protein language model embeddings for sequences; useful after identifying a protein family with InterPro\n- `pdb-database` — Retrieve and download experimental 3D structures by PDB ID; cross-reference structure IDs discovered via InterPro structure queries\n\n## References\n\n- [InterPro REST API documentation](https:\u002F\u002Finterpro-documentation.readthedocs.io\u002Fen\u002Flatest\u002Fapi.html) — Endpoint reference, filters, and example queries\n- [Blum et al., Nucleic Acids Research 2021](https:\u002F\u002Fdoi.org\u002F10.1093\u002Fnar\u002Fgkaa977) — InterPro flagship paper describing member database integration\n- [InterPro web portal](https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002F) — Interactive protein domain browser\n- [Paysan-Lafosse et al., Nucleic Acids Research 2023](https:\u002F\u002Fdoi.org\u002F10.1093\u002Fnar\u002Fgkac993) — InterPro 2023 update describing new entry types and member databases\n","# InterPro Database\n\n## Overview\n\nInterPro is the EBI's integrated protein family, domain, and functional site database. It consolidates signatures from 13 member databases (Pfam, PANTHER, PIRSF, PRINTS, PROSITE, SMART, CDD, NCBIfam, and others) into unified InterPro entries, each describing a homologous superfamily, domain, family, repeat, or conserved site. The REST API at `https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\u002F` is free and requires no authentication.\n\n## When to Use\n\n- Identifying all domains and families present in a protein by UniProt accession (domain architecture)\n- Searching for proteins that contain a specific domain or belong to a specific family\n- Finding the taxonomic distribution of organisms that encode a given domain or family\n- Cross-linking a domain to experimental 3D structures in the PDB\n- Checking which source databases (Pfam, PANTHER, SMART, etc.) cover an InterPro entry\n- Discovering InterPro entries by keyword (e.g., \"kinase domain\") when you do not yet know the accession\n- For protein sequence retrieval, functional annotations (GO, pathways, active sites), and ID mapping use `uniprot-protein-database`\n- For downloading domain-aligned sequences or building HMM profiles use `Pfam` directly; InterPro is the meta-layer\n\n## Prerequisites\n\n- **Python packages**: `requests`, `pandas`, `matplotlib`\n- **Data requirements**: UniProt accessions (e.g., `P04637`) or InterPro accessions (e.g., `IPR011009`)\n- **Environment**: internet connection; no API key required\n- **Rate limits**: no published hard limit; use `time.sleep(1.0)` between requests for batch queries; paginate with `?cursor=` or `?page_size=`\n\n```bash\npip install requests pandas matplotlib\n```\n\n## Quick Start\n\n```python\nimport requests\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef interpro_get(path: str, params: dict = None) -> dict:\n    \"\"\"Send a GET request to the InterPro API and return parsed JSON.\"\"\"\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002F{path}\",\n        params=params,\n        headers={\"Accept\": \"application\u002Fjson\"},\n        timeout=30\n    )\n    r.raise_for_status()\n    return r.json()\n\n# Get domain architecture for TP53 (P04637)\n# Note: `protein\u002Funiprot\u002F{acc}\u002F` returns only {metadata}; the entries-per-protein\n# data lives at `entry\u002Finterpro\u002Fprotein\u002Funiprot\u002F{acc}\u002F` and is keyed `results`.\ndata = interpro_get(\"entry\u002Finterpro\u002Fprotein\u002Funiprot\u002FP04637\u002F\")\nentries = data.get(\"results\", [])\nprint(f\"InterPro entries for TP53: {data.get('count')}  (this page: {len(entries)})\")\nfor e in entries[:4]:\n    m = e[\"metadata\"]\n    print(f\"  {m['accession']}  {m['type']:\u003C25}  {m['name']}\")\n# InterPro entries for TP53: 9\n#   IPR002117  family                     p53 tumour suppressor family\n#   IPR036674  homologous_superfamily     p53-like tetramerisation domain superfamily\n```\n\n## Core API\n\n### Query 1: Entry Search\n\nSearch for InterPro entries by name keyword or fetch a specific entry by accession.\n\n```python\nimport requests\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef search_entries(query: str, entry_type: str = None,\n                   page_size: int = 20) -> list:\n    \"\"\"Search InterPro entries by keyword; optionally filter by type.\"\"\"\n    params = {\"search\": query, \"page_size\": page_size}\n    if entry_type:\n        params[\"type\"] = entry_type   # family, domain, homologous_superfamily, repeat, site\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002Fentry\u002Finterpro\u002F\",\n        params=params,\n        headers={\"Accept\": \"application\u002Fjson\"},\n        timeout=30\n    )\n    r.raise_for_status()\n    return r.json().get(\"results\", [])\n\nhits = search_entries(\"serine kinase\", entry_type=\"domain\")\nprint(f\"InterPro domain entries matching 'serine kinase': {len(hits)}\")\nfor h in hits[:5]:\n    m = h[\"metadata\"]\n    print(f\"  {m['accession']}  {m['type']:\u003C10}  {m['name']}\")\n# InterPro domain entries matching 'serine kinase': 8\n#   IPR000719  domain    Protein kinase domain\n#   IPR008271  domain    Serine\u002Fthreonine\u002Ftyrosine kinase, active site\n```\n\n```python\n# Fetch a specific InterPro entry by accession\nr = requests.get(\n    f\"{INTERPRO_BASE}\u002Fentry\u002Finterpro\u002FIPR000719\u002F\",\n    headers={\"Accept\": \"application\u002Fjson\"},\n    timeout=30\n)\nr.raise_for_status()\nmeta = r.json()[\"metadata\"]\nprint(f\"Accession    : {meta['accession']}\")\nprint(f\"Name         : {meta['name']}\")\nprint(f\"Type         : {meta['type']}\")\nprint(f\"Member DBs   : {list(meta.get('member_databases', {}).keys())}\")\ngo_terms = meta.get(\"go_terms\", [])\nprint(f\"GO terms     : {[g['identifier'] for g in go_terms[:3]]}\")\n# Accession    : IPR000719\n# Name         : Protein kinase domain\n# Type         : domain\n# Member DBs   : ['pfam', 'smart', 'cdd', 'ncbifam', 'panther']\n# GO terms     : ['GO:0004672', 'GO:0005524', 'GO:0006468']\n```\n\n### Query 2: Protein Domain Architecture\n\nRetrieve all InterPro entries (domains, families, sites) matched in a protein by UniProt accession.\n\n```python\nimport requests\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef get_protein_domain_architecture(uniprot_acc: str) -> dict:\n    \"\"\"Return all InterPro entry matches for a protein. Uses the\n    `entry\u002Finterpro\u002Fprotein\u002Funiprot\u002F{acc}\u002F` endpoint, which returns\n    {count, next, previous, results}. Each result has metadata + a\n    nested `proteins[0].entry_protein_locations` for the per-protein match.\"\"\"\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002Fentry\u002Finterpro\u002Fprotein\u002Funiprot\u002F{uniprot_acc}\u002F\",\n        headers={\"Accept\": \"application\u002Fjson\"},\n        timeout=60\n    )\n    r.raise_for_status()\n    return r.json()\n\ndata = get_protein_domain_architecture(\"P04637\")   # TP53\nresults = data.get(\"results\", [])\n# Pull length\u002Fsource from the first match's nested protein record\nprot0 = results[0][\"proteins\"][0] if results and results[0].get(\"proteins\") else {}\nprint(f\"Protein length : {prot0.get('protein_length')}\")\nprint(f\"Source DB      : {prot0.get('source_database')}\")\nprint(f\"InterPro entries: {data.get('count')}\")\nfor entry in results[:6]:\n    m = entry[\"metadata\"]\n    # Locations are nested under proteins[0].entry_protein_locations\n    locs = entry[\"proteins\"][0].get(\"entry_protein_locations\", []) if entry.get(\"proteins\") else []\n    loc_str = \", \".join(\n        f\"{frag['start']}-{frag['end']}\"\n        for loc in locs for frag in loc.get(\"fragments\", [])\n    )\n    print(f\"  {m['accession']}  {m['type']:\u003C25}  {m['name'][:35]:\u003C35}  [{loc_str}]\")\n```\n\n```python\n# Compare domain architectures of two proteins side-by-side\nimport pandas as pd\n\ndef domain_set(uniprot_acc: str) -> set:\n    data = get_protein_domain_architecture(uniprot_acc)\n    return {e[\"metadata\"][\"accession\"] for e in data.get(\"results\", [])}\n\nbrca1_domains = domain_set(\"P38398\")   # BRCA1\ntp53_domains   = domain_set(\"P04637\")  # TP53\n\nshared = brca1_domains & tp53_domains\nunique_brca1 = brca1_domains - tp53_domains\nunique_tp53  = tp53_domains - brca1_domains\nprint(f\"Shared InterPro entries: {len(shared)}\")\nprint(f\"BRCA1-unique           : {len(unique_brca1)}\")\nprint(f\"TP53-unique            : {len(unique_tp53)}\")\n```\n\n### Query 3: Entry Proteins\n\nList proteins that contain a specific InterPro entry (family or domain).\n\n```python\nimport requests, time\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef get_entry_proteins(interpro_acc: str, reviewed_only: bool = True,\n                       page_size: int = 50) -> list:\n    \"\"\"Return proteins (UniProt) containing a given InterPro entry.\n    Path order is `\u002Fprotein\u002F{db}\u002Fentry\u002Finterpro\u002F{IPR}\u002F` — the inverse\n    `entry\u002Finterpro\u002F{IPR}\u002Fprotein\u002F{db}\u002F` times out (408) on large families.\"\"\"\n    db = \"reviewed\" if reviewed_only else \"uniprot\"\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002Fprotein\u002F{db}\u002Fentry\u002Finterpro\u002F{interpro_acc}\u002F\",\n        params={\"page_size\": page_size},\n        headers={\"Accept\": \"application\u002Fjson\"},\n        timeout=60\n    )\n    r.raise_for_status()\n    return r.json().get(\"results\", [])\n\nproteins = get_entry_proteins(\"IPR011009\")   # Protein kinase-like domain SF\nprint(f\"Reviewed proteins with IPR011009 (page 1): {len(proteins)}\")\nfor p in proteins[:4]:\n    m = p[\"metadata\"]\n    # metadata fields: accession, gene, length, name, source_database, source_organism\n    print(f\"  {m['accession']}  {(m.get('gene') or ''):\u003C8}  \"\n          f\"len={m.get('length', '?')}  \"\n          f\"org={(m.get('source_organism') or {}).get('scientificName', '')[:30]}\")\n```\n\n```python\n# Paginate all proteins for a family using cursor\ndef get_all_entry_proteins(interpro_acc: str,\n                            reviewed_only: bool = True) -> list:\n    INTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n    db = \"reviewed\" if reviewed_only else \"uniprot\"\n    # Path-inverted: \u002Fprotein\u002F{db}\u002Fentry\u002Finterpro\u002F{IPR}\u002F is the working order\n    url = f\"{INTERPRO_BASE}\u002Fprotein\u002F{db}\u002Fentry\u002Finterpro\u002F{interpro_acc}\u002F\"\n    all_proteins = []\n    params = {\"page_size\": 200}\n    while url:\n        r = requests.get(url, params=params,\n                         headers={\"Accept\": \"application\u002Fjson\"}, timeout=60)\n        r.raise_for_status()\n        data = r.json()\n        all_proteins.extend(data.get(\"results\", []))\n        url = data.get(\"next\")\n        params = None   # next URL already has params encoded\n        if url:\n            time.sleep(1.0)\n    return all_proteins\n\nproteins = get_all_entry_proteins(\"IPR000719\")   # Protein kinase domain\nprint(f\"Total reviewed proteins with protein kinase domain: {len(proteins)}\")\n```\n\n### Query 4: Entry Taxonomy\n\nGet the taxonomic distribution of proteins annotated with a given InterPro entry.\n\n```python\nimport requests\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef get_entry_taxonomy(interpro_acc: str,\n                        page_size: int = 50) -> list:\n    \"\"\"Return taxonomic summary for proteins in a given InterPro entry.\n    Path-inverted: `\u002Ftaxonomy\u002Funiprot\u002Fentry\u002Finterpro\u002F{IPR}\u002F`. Each result\n    has `metadata` (taxon: accession=taxId, name, parent, children, rank)\n    and `entries[]` (representative protein-match locations for that taxon).\"\"\"\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002Ftaxonomy\u002Funiprot\u002Fentry\u002Finterpro\u002F{interpro_acc}\u002F\",\n        params={\"page_size\": page_size},\n        headers={\"Accept\": \"application\u002Fjson\"},\n        timeout=90\n    )\n    r.raise_for_status()\n    return r.json().get(\"results\", [])\n\n# Use a smaller entry (p53 DBD); IPR000719 (kinase) has ~270k taxa and times out.\ntaxa = get_entry_taxonomy(\"IPR011615\")\nprint(f\"Top taxa for IPR011615 (p53 DNA-binding domain):\")\nfor t in taxa[:8]:\n    m = t[\"metadata\"]\n    print(f\"  taxId={m['accession']:>10}  {m.get('name', ''):\u003C30}  \"\n          f\"rank={m.get('rank') or 'n\u002Fa'}\")\n```\n\n### Query 5: Structure Integration\n\nRetrieve PDB structures associated with an InterPro entry.\n\n```python\nimport requests\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef get_entry_structures(interpro_acc: str, page_size: int = 25) -> list:\n    \"\"\"Return PDB structures that include a match to a given InterPro entry.\n    Path-inverted: `\u002Fstructure\u002Fpdb\u002Fentry\u002Finterpro\u002F{IPR}\u002F`. The flat form with\n    `?entry_interpro=...` is silently slow \u002F 408s on this resource.\"\"\"\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002Fstructure\u002Fpdb\u002Fentry\u002Finterpro\u002F{interpro_acc}\u002F\",\n        params={\"page_size\": page_size},\n        headers={\"Accept\": \"application\u002Fjson\"},\n        timeout=60\n    )\n    r.raise_for_status()\n    return r.json().get(\"results\", [])\n\nstructures = get_entry_structures(\"IPR011009\")   # Protein kinase-like SF\nprint(f\"PDB structures linked to IPR011009 (page 1): {len(structures)}\")\nfor s in structures[:5]:\n    m = s[\"metadata\"]\n    print(f\"  {m['accession'].upper()}  resolution={m.get('resolution', 'N\u002FA')} Å  \"\n          f\"experiment={m.get('experiment_type', 'N\u002FA')}\")\n# PDB structures linked to IPR011009: ~8,000+\n#   1A06  resolution=2.5 Å  experiment=x-ray\n#   ...\n```\n\n### Query 6: Domain Sequence Retrieval\n\nDownload the FASTA sequences of proteins in an InterPro family for alignment or phylogenetics.\n\n```python\nimport requests, time\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef get_family_fasta(interpro_acc: str,\n                      reviewed_only: bool = True,\n                      max_sequences: int = 100) -> str:\n    \"\"\"Retrieve FASTA sequences for proteins in an InterPro entry.\"\"\"\n    db = \"reviewed\" if reviewed_only else \"uniprot\"\n    proteins = []\n    # Path-inverted: protein-list-for-entry is \u002Fprotein\u002F{db}\u002Fentry\u002Finterpro\u002F{IPR}\u002F\n    url = f\"{INTERPRO_BASE}\u002Fprotein\u002F{db}\u002Fentry\u002Finterpro\u002F{interpro_acc}\u002F\"\n    params = {\"page_size\": min(max_sequences, 200)}\n    while url and len(proteins) \u003C max_sequences:\n        r = requests.get(url, params=params,\n                         headers={\"Accept\": \"application\u002Fjson\"}, timeout=60)\n        r.raise_for_status()\n        data = r.json()\n        proteins.extend(data.get(\"results\", []))\n        url = data.get(\"next\") if len(proteins) \u003C max_sequences else None\n        params = None\n        if url:\n            time.sleep(1.0)\n\n    # Fetch FASTA from UniProt for each accession\n    accessions = [p[\"metadata\"][\"accession\"] for p in proteins[:max_sequences]]\n    fasta_url = \"https:\u002F\u002Frest.uniprot.org\u002Funiprotkb\u002Fstream\"\n    query = \" OR \".join(f\"accession:{acc}\" for acc in accessions)\n    r = requests.get(fasta_url,\n                     params={\"query\": query, \"format\": \"fasta\"},\n                     timeout=120)\n    r.raise_for_status()\n    return r.text\n\nfasta = get_family_fasta(\"IPR000719\", reviewed_only=True, max_sequences=20)\nseq_count = fasta.count(\">\")\nprint(f\"FASTA sequences retrieved: {seq_count}\")\nprint(fasta[:300])   # preview first sequence header + start\n```\n\n## Key Concepts\n\n### InterPro Entry Types\n\nInterPro classifies entries into five types. The type determines what biological relationship the match implies:\n\n| Type | Description | Example |\n|------|-------------|---------|\n| `family` | Homologous group of proteins sharing common ancestry and function | IPR000719 (Protein kinase) |\n| `domain` | Discrete structural and functional unit that can occur in multiple protein contexts | IPR011009 (Protein kinase-like SF) |\n| `homologous_superfamily` | Structurally similar domains that may have diverged in sequence | IPR011993 (Pleckstrin-like) |\n| `repeat` | Short, repeated sequence unit that occurs multiple times within a protein | IPR001440 (TPR repeat) |\n| `site` | Short conserved motif: active site, binding site, or post-translational modification site | IPR008271 (Ser\u002FThr kinase active site) |\n\n### Member Database Hierarchy\n\nEach InterPro entry integrates signatures from one or more member databases. The InterPro accession (`IPR...`) is the unified meta-entry; member database accessions point to the underlying models:\n\n| Member DB | Accession prefix | Modeling approach |\n|-----------|-----------------|-------------------|\n| Pfam | PF | Hidden Markov Models (profile HMMs) |\n| PANTHER | PTHR | Phylogenetic trees + HMMs |\n| PIRSF | PIRSF | Full-length HMMs |\n| PRINTS | PR | Fingerprint motif groups |\n| PROSITE | PS | Patterns and profiles |\n| SMART | SM | HMMs with database integration |\n| CDD | cd | Position-specific scoring matrices (PSSMs) |\n| NCBIfam | NF | NCBI-curated HMMs |\n\n### Pagination\n\nThe InterPro API paginates results at the collection level. Each response includes a `next` URL (or `null` when exhausted) and a `count` field. For large families (e.g., kinases: 10,000+ proteins) always iterate using the `next` cursor.\n\n```python\nimport requests, time\n\ndef iterate_interpro(url: str, page_size: int = 200) -> list:\n    \"\"\"Generic paginator for any InterPro list endpoint.\"\"\"\n    results = []\n    params = {\"page_size\": page_size}\n    while url:\n        r = requests.get(url, params=params,\n                         headers={\"Accept\": \"application\u002Fjson\"}, timeout=60)\n        r.raise_for_status()\n        data = r.json()\n        results.extend(data.get(\"results\", []))\n        url = data.get(\"next\")\n        params = None\n        if url:\n            time.sleep(1.0)\n    return results\n```\n\n## Common Workflows\n\n### Workflow 1: Domain Architecture Report for a Protein Set\n\n**Goal**: Retrieve all InterPro domains for a list of proteins and produce a summary table showing which domains each protein carries.\n\n```python\nimport requests, time, pandas as pd\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef get_domains(uniprot_acc: str) -> list:\n    \"\"\"List InterPro entries for a protein. Uses the\n    `entry\u002Finterpro\u002Fprotein\u002Funiprot\u002F{acc}\u002F` endpoint (keyed `results`).\"\"\"\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002Fentry\u002Finterpro\u002Fprotein\u002Funiprot\u002F{uniprot_acc}\u002F\",\n        headers={\"Accept\": \"application\u002Fjson\"}, timeout=60\n    )\n    if r.status_code == 404:\n        return []\n    r.raise_for_status()\n    data = r.json()\n    return [\n        {\n            \"protein\": uniprot_acc,\n            \"accession\": e[\"metadata\"][\"accession\"],\n            \"name\": e[\"metadata\"][\"name\"],\n            \"type\": e[\"metadata\"][\"type\"],\n            \"source_db\": list(e[\"metadata\"].get(\"member_databases\", {}).keys()),\n        }\n        for e in data.get(\"results\", [])\n    ]\n\nproteins = [\"P04637\", \"P38398\", \"Q00987\", \"P10415\"]  # TP53, BRCA1, MDM2, BCL2\nrows = []\nfor acc in proteins:\n    rows.extend(get_domains(acc))\n    time.sleep(1.0)\n\ndf = pd.DataFrame(rows)\nprint(f\"Total domain matches: {len(df)}\")\nprint(df.groupby([\"protein\", \"type\"])[\"accession\"].count().unstack(fill_value=0))\n\n# Pivot: proteins × domain accessions\npivot = df[df[\"type\"] == \"domain\"].pivot_table(\n    index=\"protein\", columns=\"accession\", aggfunc=\"size\", fill_value=0\n)\npivot.to_csv(\"domain_architecture_matrix.csv\")\nprint(f\"\\nDomain × protein matrix: {pivot.shape}\")\n```\n\n### Workflow 2: Find Kinase Family Members with PDB Structures\n\n**Goal**: Retrieve proteins in a kinase domain family that have experimental structures in the PDB, ranked by resolution.\n\n```python\nimport requests, time, pandas as pd\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\n# Step 1: Get PDB structures linked to the protein kinase-like SF entry.\n# Use the path-inverted form; the flat `?entry_interpro=` filter 408s.\nr = requests.get(\n    f\"{INTERPRO_BASE}\u002Fstructure\u002Fpdb\u002Fentry\u002Finterpro\u002FIPR011009\u002F\",\n    params={\"page_size\": 200},\n    headers={\"Accept\": \"application\u002Fjson\"}, timeout=60\n)\nr.raise_for_status()\nstructures = r.json().get(\"results\", [])\nprint(f\"PDB structures with IPR011009 (kinase-like SF, page 1): {len(structures)}\")\n\nrows = []\nfor s in structures:\n    m = s[\"metadata\"]\n    rows.append({\n        \"pdb_id\": m[\"accession\"],\n        \"resolution\": m.get(\"resolution\"),\n        \"experiment\": m.get(\"experiment_type\", \"\"),\n        \"name\": m.get(\"name\", \"\"),\n    })\n\ndf = pd.DataFrame(rows)\ndf = df.dropna(subset=[\"resolution\"]).sort_values(\"resolution\")\nprint(f\"\\nTop 10 highest-resolution kinase structures:\")\nprint(df[[\"pdb_id\", \"resolution\", \"experiment\", \"name\"]].head(10).to_string(index=False))\ndf.to_csv(\"kinase_structures.csv\", index=False)\nprint(f\"\\nSaved kinase_structures.csv ({len(df)} X-ray \u002F cryo-EM structures)\")\n```\n\n### Workflow 3: Taxonomic Coverage Bar Chart for a Domain\n\n**Goal**: Visualize how many reviewed proteins in each major kingdom carry a given InterPro domain.\n\n```python\nimport requests, time\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef get_taxonomy_counts(interpro_acc: str, page_size: int = 100,\n                        max_pages: int = 5) -> pd.DataFrame:\n    \"\"\"Walk the taxonomy results for an InterPro entry. The API does not\n    expose a per-taxon protein count at this endpoint — instead each\n    paged record is one (taxon × representative protein-match) row.\n    Aggregate client-side by taxon name to approximate frequency.\"\"\"\n    rows, url = [], f\"{INTERPRO_BASE}\u002Ftaxonomy\u002Funiprot\u002Fentry\u002Finterpro\u002F{interpro_acc}\u002F\"\n    params = {\"page_size\": page_size}\n    for _ in range(max_pages):\n        if not url:\n            break\n        r = requests.get(url, params=params,\n                         headers={\"Accept\": \"application\u002Fjson\"}, timeout=90)\n        r.raise_for_status()\n        data = r.json()\n        for t in data.get(\"results\", []):\n            m = t[\"metadata\"]\n            rows.append({\n                \"taxon_id\": m[\"accession\"],\n                \"name\": m.get(\"name\", \"\"),\n                \"rank\": m.get(\"rank\") or \"\",\n            })\n        url = data.get(\"next\")\n        params = None\n        if url:\n            time.sleep(1.0)\n    return pd.DataFrame(rows)\n\nIPR_ACC = \"IPR011615\"   # p53 DNA-binding domain (smaller; kinase 408s)\ndf = get_taxonomy_counts(IPR_ACC, max_pages=3)\nprint(f\"Tax entries pulled for {IPR_ACC}: {len(df)}\")\n\n# Aggregate by name and take top 15 (each row = one rep. protein-match)\ntop = (df.groupby(\"name\").size().sort_values(ascending=False).head(15)\n       .reset_index(name=\"rep_matches\"))\nfig, ax = plt.subplots(figsize=(10, 5))\nbars = ax.barh(top[\"name\"], top[\"rep_matches\"], color=\"#2171B5\")\nax.bar_label(bars, fmt=\"%d\", padding=3, fontsize=8)\nax.set_xlabel(\"Representative protein-matches\")\nax.set_title(f\"Taxonomic distribution of {IPR_ACC} (p53 DNA-binding domain)\")\nax.invert_yaxis()\nplt.tight_layout()\nplt.savefig(f\"{IPR_ACC}_taxonomy.png\", dpi=150, bbox_inches=\"tight\")\nprint(f\"Saved {IPR_ACC}_taxonomy.png\")\n```\n\n## Key Parameters\n\n| Parameter | Endpoint | Default | Range \u002F Options | Effect |\n|-----------|----------|---------|-----------------|--------|\n| `search` | `entry\u002Finterpro\u002F` | — | free-text string | Keyword filter on entry name and short name |\n| `type` | `entry\u002Finterpro\u002F` | all types | `family`, `domain`, `homologous_superfamily`, `repeat`, `site` | Filter entries by InterPro type |\n| `page_size` | all list endpoints | `20` | `1`–`200` | Results returned per page |\n| `entry_interpro` | `structure\u002Fpdb\u002F` | — | `IPR######` | Filter structures by linked InterPro entry |\n| `source_database` | `protein\u002F` | — | `reviewed`, `uniprot`, `trembl` | Filter proteins by UniProt curation level |\n| `reviewed` (URL path) | `entry\u002F{ipr}\u002F{acc}\u002Fprotein\u002F` | uniprot | `reviewed`, `uniprot` | Swiss-Prot reviewed only vs all UniProtKB |\n| `relations` | `entry\u002Finterpro\u002F{acc}\u002F` | — | `contains`, `contained_by`, `child_of`, `parent_of` | Navigate the InterPro hierarchy |\n| `next` | all list endpoints | — | URL from response | Cursor-based pagination; use the full URL from the `next` field |\n\n## Best Practices\n\n1. **Use `reviewed` proteins for curated domain lists**: The unreviewed TrEMBL set is 5–10× larger and contains automated predictions. For benchmarking, family analysis, or training sets, restrict to `reviewed` (Swiss-Prot) entries to avoid noise from unreviewed predictions.\n\n2. **Chunk large taxonomy or protein lists**: Retrieving all 10,000+ proteins for a broad family like the protein kinase superfamily can take minutes and produce large payloads. Limit queries with `page_size=200` and the `next` cursor; store intermediate results to disk.\n\n3. **Add `time.sleep(1.0)` between paginated calls**: The InterPro API is shared EBI infrastructure with no published rate limit. A 1-second pause per page is a safe minimum for batch scripts.\n\n4. **Prefer InterPro accessions over member DB accessions for cross-database queries**: A Pfam PF00069 and PANTHER PTHR24340 both model kinase domains but with different protein coverage. Using the parent InterPro `IPR000719` gives the union of all member DB matches in one query.\n\n5. **Check `type` before interpreting `entry_protein_locations`**: Only `domain`, `repeat`, and `site` entries carry meaningful position information. `family` and `homologous_superfamily` entries typically span the full protein and their coordinates are less informative.\n\n## Common Recipes\n\n### Recipe: Quick Domain Check for a Protein\n\nWhen to use: Given a UniProt accession, rapidly list which InterPro domains it contains.\n\n```python\nimport requests\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef list_protein_domains(uniprot_acc: str) -> list:\n    \"\"\"Return list of (accession, type, name) tuples for a protein.\"\"\"\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002Fentry\u002Finterpro\u002Fprotein\u002Funiprot\u002F{uniprot_acc}\u002F\",\n        headers={\"Accept\": \"application\u002Fjson\"}, timeout=60\n    )\n    r.raise_for_status()\n    return [\n        (e[\"metadata\"][\"accession\"], e[\"metadata\"][\"type\"], e[\"metadata\"][\"name\"])\n        for e in r.json().get(\"results\", [])\n    ]\n\ndomains = list_protein_domains(\"P00533\")   # EGFR\nprint(f\"InterPro entries in EGFR (P00533): {len(domains)}\")\nfor acc, etype, name in domains:\n    print(f\"  {acc}  {etype:\u003C25}  {name}\")\n# InterPro entries in EGFR (P00533): 10\n#   IPR009030  homologous_superfamily   Growth factor receptor, cysteine-rich\n#   IPR000719  domain                   Protein kinase domain\n```\n\n### Recipe: Find All Proteins in a Family with Source DB Coverage\n\nWhen to use: Map how many proteins in a domain family are covered by each member database (Pfam vs PANTHER vs SMART, etc.).\n\n```python\nimport requests, time\nimport pandas as pd\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ninterpro_acc = \"IPR000719\"   # Protein kinase domain\nr = requests.get(\n    f\"{INTERPRO_BASE}\u002Fentry\u002Finterpro\u002F{interpro_acc}\u002F\",\n    headers={\"Accept\": \"application\u002Fjson\"}, timeout=30\n)\nr.raise_for_status()\nmember_dbs = r.json()[\"metadata\"].get(\"member_databases\", {})\nprint(f\"Member databases for {interpro_acc}:\")\nfor db, details in member_dbs.items():\n    print(f\"  {db}: {details}\")\n\n# Visualize member database source breakdown\nlabels = list(member_dbs.keys())\nimport matplotlib.pyplot as plt\nfig, ax = plt.subplots(figsize=(7, 4))\nax.bar(labels, [1] * len(labels), color=\"#4472C4\")   # presence\u002Fabsence per DB\nax.set_ylabel(\"Integrated (1=yes)\")\nax.set_title(f\"Member databases in {interpro_acc}\")\nplt.tight_layout()\nplt.savefig(f\"{interpro_acc}_member_dbs.png\", dpi=150, bbox_inches=\"tight\")\n```\n\n### Recipe: Get GO Terms for an InterPro Entry\n\nWhen to use: Bridge from structural domain to functional GO annotation.\n\n```python\nimport requests\n\nINTERPRO_BASE = \"https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002Fapi\"\n\ndef get_go_terms_for_entry(interpro_acc: str) -> list:\n    \"\"\"Return GO terms associated with an InterPro entry.\"\"\"\n    r = requests.get(\n        f\"{INTERPRO_BASE}\u002Fentry\u002Finterpro\u002F{interpro_acc}\u002F\",\n        headers={\"Accept\": \"application\u002Fjson\"}, timeout=30\n    )\n    r.raise_for_status()\n    go_terms = r.json()[\"metadata\"].get(\"go_terms\", [])\n    return [\n        {\"id\": g[\"identifier\"], \"name\": g[\"name\"],\n         \"category\": g.get(\"category\", {}).get(\"name\", \"\")}\n        for g in go_terms\n    ]\n\ngo_terms = get_go_terms_for_entry(\"IPR000719\")\nprint(f\"GO terms for IPR000719 (protein kinase domain): {len(go_terms)}\")\nfor g in go_terms:\n    print(f\"  {g['id']}  [{g['category'][:2].upper()}]  {g['name']}\")\n# GO terms for IPR000719 (protein kinase domain): 3\n#   GO:0004672  [MO]  protein kinase activity\n#   GO:0005524  [MO]  ATP binding\n#   GO:0006468  [BI]  protein phosphorylation\n```\n\n## Troubleshooting\n\n| Problem | Cause | Solution |\n|---------|-------|----------|\n| `HTTP 404` on protein lookup | Accession not found in InterPro | Verify the UniProt accession exists; isoform accessions (P12345-2) may not be indexed separately |\n| Empty entries list for a protein | Protein has no InterPro matches (e.g., intrinsically disordered) | Check UniProt directly; not all proteins have classified domains |\n| `protein\u002Funiprot\u002F{acc}\u002F` returns only `metadata` (no entries) | That endpoint is *protein-only*; entry matches live elsewhere | Use `entry\u002Finterpro\u002Fprotein\u002Funiprot\u002F{acc}\u002F` and read the `results[]` key |\n| `entry\u002Finterpro\u002F{IPR}\u002Fprotein\u002F{db}\u002F` returns 408 \u002F hangs | The path with `entry\u002F...` first does a slow join | Invert the path: `protein\u002F{db}\u002Fentry\u002Finterpro\u002F{IPR}\u002F` |\n| `structure\u002Fpdb\u002F?entry_interpro={IPR}` times out (408) | Same join order issue | Use `structure\u002Fpdb\u002Fentry\u002Finterpro\u002F{IPR}\u002F` |\n| `entry\u002Finterpro\u002F{IPR}\u002Ftaxonomy\u002Funiprot\u002F` 408s for large families | Same | Use `taxonomy\u002Funiprot\u002Fentry\u002Finterpro\u002F{IPR}\u002F`; for very large entries (e.g. IPR000719 kinase) the inverted form may still 408 — fall back to a more specific sub-family entry |\n| `HTTP 400` on entry search | Invalid query parameters or unsupported `type` value | Use one of: `family`, `domain`, `homologous_superfamily`, `repeat`, `site` |\n| Pagination stops early | `next` is `null` before expected count | This is correct; all results have been returned |\n| Very slow response for large families | Protein set has thousands of members | Increase `page_size` to `200`; persist results after each page |\n| `ConnectionError` or `Timeout` | Transient network or server issue | Retry with exponential backoff; EBI services occasionally have brief downtimes |\n| Member DB accessions missing | Entry is new and member DB integration is pending | Use the InterPro accession for queries; member DB-level details update with each release |\n\n## Related Skills\n\n- `uniprot-protein-database` — UniProt REST API for protein sequences, Swiss-Prot functional annotations (active sites, PTMs, disease associations), and ID mapping\n- `esm-protein-language-model` — Generate protein language model embeddings for sequences; useful after identifying a protein family with InterPro\n- `pdb-database` — Retrieve and download experimental 3D structures by PDB ID; cross-reference structure IDs discovered via InterPro structure queries\n\n## References\n\n- [InterPro REST API documentation](https:\u002F\u002Finterpro-documentation.readthedocs.io\u002Fen\u002Flatest\u002Fapi.html) — Endpoint reference, filters, and example queries\n- [Blum et al., Nucleic Acids Research 2021](https:\u002F\u002Fdoi.org\u002F10.1093\u002Fnar\u002Fgkaa977) — InterPro flagship paper describing member database integration\n- [InterPro web portal](https:\u002F\u002Fwww.ebi.ac.uk\u002Finterpro\u002F) — Interactive protein domain browser\n- [Paysan-Lafosse et al., Nucleic Acids Research 2023](https:\u002F\u002Fdoi.org\u002F10.1093\u002Fnar\u002Fgkac993) — InterPro 2023 update describing new entry types and member databases\n",{"name":5,"license":15,"description":7},"master","63f17866001c5ca854bf2fa0b678ce277133de5b","skills\u002Fawesome-skills\u002Finterpro-database",0,"https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS","https:\u002F\u002Fbg-szy.github.io\u002FTOP-SKILLS\u002F","https:\u002F\u002Fgithub.com\u002Fbg-szy","https:\u002F\u002Fwww.ecust.edu.cn\u002F","a student of East China University of Science and Technology","2026-11-15 03:38:02",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add bg-szy\u002FTOP-SKILLS --skill interpro-database",{"tool":40,"command":41},"bunx","bunx skills add bg-szy\u002FTOP-SKILLS --skill interpro-database",{"tool":43,"command":44},"pnpm","pnpm dlx skills add bg-szy\u002FTOP-SKILLS --skill interpro-database","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fawesome-skills\u002Finterpro-database\u002FSKILL.md",true,[],[49,58,65,72,79,86],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":54,"categories":55,"keywords":56,"publishedAt":57},"01M7DXW9N826PKXK174PVW3038","serpmaven","Scrape Google search results (SERP) to JSON with SERP Maven (serpmaven) - a real Chrome browser on a residential proxy with sticky sessions. Run it as a CLI, a Python library, a local HTTP search API (`serve`), an MCP server or a Docker image; set the proxy login, workers, pages and cost tracking. Use when the user wants Google results, rank tracking, a self-hosted SERP API, or live Google search for an AI agent.","MIT","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Fserpmaven\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":59,"name":60,"nameZh":6,"description":61,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":62,"categories":63,"keywords":64,"publishedAt":57},"01M7DXVHSTWDV65475QEQ915M7","revnu-landing-page-audit","Find out why a landing page isn't turning visitors into signups, demos or sales. Audits one page against what the ad, post or search that sends people there promised, then checks the first screen, proof, call to action, friction and mobile. Returns at most 7 prioritized fixes, plus what is fine and what could not be checked; rewrites specific lines and fixes the page in the repo when asked. Never promises a conversion lift. Works without a Revnu account. Use when the user says or asks: \"audit my landing page\", \"why isn't this page converting\", \"review my homepage\", \"my ads get clicks but no signups\", \"people bounce from the pricing page\", \"CRO review\", \"improve conversion rate\", \"is my hero section clear\", \"roast my landing page\", \"rewrite my headline\", \"what's wrong with this page\", \"landing page feedback\", \"make the signup page convert better\". Not for SEO or AI-search audits, page speed engineering on its own, or building a new page from scratch.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-landing-page-audit\u002FSKILL.md",[],[],{"skillNo":66,"name":67,"nameZh":6,"description":68,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":57},"01M7DXV8X2D7B3VTD4HHYYHTGR","revnu-growth-context","Write down once who buys, what they're stuck on, what it costs, what proof you have and what you've already tried, so every growth task starts from facts instead of a questionnaire. Creates or updates .agents\u002Frevnu-growth.md from the repo, the live site and the user, and imports an existing product-marketing.md. Use when the user says \"set up our marketing context\", \"who is our ideal customer\", \"write our ICP\", \"describe the product for marketing\", \"positioning doc\", \"what's our brand voice\", \"remember this about our customers\", \"log what we tried\", \"what have we learned from marketing\", \"we changed pricing, update the context\", \"update our growth notes\", \"summarize the business for the agent\", \"import my product-marketing.md\", \"start a growth doc\", or before a first marketing, SEO, outreach or launch task when no context file exists. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-growth-context\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":76,"categories":77,"keywords":78,"publishedAt":57},"01M7DXV0DGJ1G0A60PAHC6J3C5","revnu-get-listed","Get onto the third-party pages AI answers and search cite when buyers ask for the best tool in your category: \"best X\" roundups, directories, review sites, GitHub awesome lists, community threads and comparison pages. Finds which ones are cited, ranks them by fit and effort, and drafts each submission, PR or pitch by the target's own rules. Use when the user says \"get us listed\", \"which directories should we submit to\", \"how do we get into best-of lists\", \"why does ChatGPT recommend competitors and not us\", \"get mentioned in AI answers\", \"submit to awesome lists\", \"get on G2\", \"where are our competitors listed\", \"pitch listicle authors\", \"find backlink opportunities\", \"launch directories\", \"get into roundups\", \"Product Hunt alternatives\", \"where should we be listed\", \"get cited by Perplexity\". Never submits, pays or posts without a yes. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-get-listed\u002FSKILL.md",[],[],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":57},"01M7DXTSPMGT9D6DSS0HP9BSTA","revnu-ai-readiness-audit","Audit whether your website gives ChatGPT, Perplexity, Claude, Gemini and Google's AI Overviews something worth quoting, and fix the pages that don't. Use when the user says or asks \"is my site ready for AI search\", \"audit my site for AI answers\", \"AEO audit\", \"GEO audit\", \"why doesn't ChatGPT quote our pricing\", \"make our pages citable by AI\", \"do I need llms.txt\", \"does schema help with ChatGPT\", \"check our structured data\", \"is our content visible without JavaScript\", \"AI SEO audit\", \"optimize our homepage for AI answers\", \"LLM SEO check\", \"why does AI get our product wrong\", \"fix our site for AI Overviews\". Checks fetchability and indexability, answers in the raw HTML, entity facts, schema (including JS-injected markup), headings, dates and llms.txt, then gives at most 10 prioritised fixes and edits the repo when asked. Works without a Revnu account.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Frevnu-ai-readiness-audit\u002FSKILL.md",[],[],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":53,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":57},"01M7DXSZHCVTRS620GC3S97JZV","proxy-troubleshooting","Diagnose residential proxy failures, with NodeMaven's gateway as the reference - 407 with correct credentials, 406, 410, 500, a connection that hangs, ERR_TUNNEL_CONNECTION_FAILED in a browser, Playwright or Puppeteer ignoring proxy credentials, a sticky session that changes IP, geo-targeting that is silently ignored, passwords with special characters, and unexpected traffic from headless Chrome. Use when a proxy connection fails, returns the wrong location, or costs more traffic than expected.","https:\u002F\u002Fgithub.com\u002Fbg-szy\u002FTOP-SKILLS\u002Fblob\u002Fmaster\u002Fskills\u002Fmarketplace\u002Fproxy-troubleshooting\u002FSKILL.md",[],[]]