{"slug":"alterlab-bioservices","title":"alterlab-bioservices","summary":"Query 40+ bioinformatics web services through one consistent Python API with bioservices (UniProt, KEGG, ChEMBL, Reactome, Ensembl, NCBI and more). Use when a workflow must hit multiple databases together, map identifiers across services, or run cross-database analyses — for quic","platform":"Claude","tags":[],"authorName":"LLM Mart","authorSlug":"llm-mart","score":0,"source":"github","price":null,"verified":false,"createdAt":"2026-09-23T18:56:53.21355Z","repo":{"url":"https://github.com/AlterLab-IEU/AlterLab-Academic-Skills","stars":68,"forks":13,"license":"MIT","updatedAt":"2026-09-23T13:42:59Z"},"bodyHtml":"<hr>\n<h2>name: alterlab-bioservices\ndescription: Query 40+ bioinformatics web services through one consistent Python API with bioservices (UniProt, KEGG, ChEMBL, Reactome, Ensembl, NCBI and more). Use when a workflow must hit multiple databases together, map identifiers across services, or run cross-database analyses — for quick single-database lookups use gget, for sequence and file manipulation use biopython. Part of the AlterLab Academic Skills suite.\nlicense: GPL-3.0\nallowed-tools: Read Write Edit Bash(python:<em>) Bash(uv:</em>)\ncompatibility: \"Self-contained — runs under <code>uv run python</code> with <code>bioservices</code> installed (1.16.0 as of 2026-09, Python 3.9–3.14); no API key or account required, though several wrapped services want a contact email.\"\nmetadata:\nskill-author: AlterLab\nversion: \"1.1.0\"\nlast_updated: \"2026-09-23\"</h2>\n<h1>BioServices</h1>\n<h2>Overview</h2>\n<p>BioServices is a Python package providing programmatic access to roughly 40 bioinformatics web services and databases. Retrieve biological data, perform cross-database queries, map identifiers, analyze sequences, and integrate multiple biological resources in Python workflows.</p>\n<p><strong>Recent changes that break old scripts</strong> (verified against bioservices 1.16.0):</p>\n<ul>\n<li><strong>SOAP/WSDL support was removed in 1.15</strong> — every active service is REST now, and the\n<code>WSDLService</code> class and its <code>suds</code> dependency are gone.</li>\n<li><strong><code>PSICQUIC</code> and <code>BioGRID</code> were removed in 1.14.</strong> For protein interactions use the\n<code>STRING</code> class (added in 1.14) or <code>IntactComplex</code>; <code>from bioservices import PSICQUIC</code>\nraises <code>ImportError</code>.</li>\n<li><strong><code>UniProt.mapping()</code> returns the raw UniProt job payload</strong> —\n<code>{\"results\": [{\"from\": ..., \"to\": ...}, ...], \"failedIds\": [...]}</code> — not a\n<code>{source_id: [target_ids]}</code> dict. See \"Identifier Mapping\" below.</li>\n<li><strong>NCBIblast methods are snake_case</strong> (<code>get_status</code>, <code>get_result</code>, <code>get_result_types</code>,\n<code>wait</code>); the old <code>getStatus</code>/<code>getResult</code> camelCase names are gone. 1.16 also adds\n<code>ncbiblastapi.NCBIBlastAPI</code>, which submits to NCBI directly instead of EBI.</li>\n</ul>\n<h2>When to Use This Skill</h2>\n<p>This skill should be used when:</p>\n<ul>\n<li>Retrieving protein sequences, annotations, or structures from UniProt, PDB, Pfam</li>\n<li>Analyzing metabolic pathways and gene functions via KEGG or Reactome</li>\n<li>Searching compound databases (ChEBI, ChEMBL, PubChem) for chemical information</li>\n<li>Converting identifiers between different biological databases (KEGG↔UniProt, compound IDs)</li>\n<li>Running sequence similarity searches (BLAST, MUSCLE alignment)</li>\n<li>Querying gene ontology terms (QuickGO, GO annotations)</li>\n<li>Accessing protein-protein interaction data (STRING, IntactComplex)</li>\n<li>Mining genomic data (BioMart, ArrayExpress, ENA)</li>\n<li>Integrating data from multiple bioinformatics resources in a single workflow</li>\n</ul>\n<h3>Does NOT Trigger</h3>\n<table>\n<thead>\n<tr>\n<th>Scenario</th>\n<th>Use Instead</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>A single quick lookup (one gene, one structure, one enrichment)</td>\n<td><code>alterlab-gget</code></td>\n</tr>\n<tr>\n<td>Parsing sequence/structure files or scripting Entrez directly</td>\n<td><code>alterlab-biopython</code></td>\n</tr>\n<tr>\n<td>Local BLAST+ / <code>makeblastdb</code> / DIAMOND on your own database</td>\n<td><code>alterlab-blast</code></td>\n</tr>\n<tr>\n<td>Deep work in one database (full KEGG, UniProt, or ChEMBL feature set)</td>\n<td><code>alterlab-kegg</code>, <code>alterlab-uniprot</code>, <code>alterlab-chembl</code></td>\n</tr>\n<tr>\n<td>Cheminformatics on the retrieved structures (descriptors, fingerprints)</td>\n<td><code>alterlab-rdkit</code></td>\n</tr>\n</tbody>\n</table>\n<h2>Core Capabilities</h2>\n<h3>1. Protein Analysis</h3>\n<p>Retrieve protein information, sequences, and functional annotations:</p>\n<pre><code>from bioservices import UniProt\n\nu = UniProt(verbose=False)\n\n# Search for protein by name. frmt is one of xlsx/fasta/json/gff/tsv — \"tab\" was\n# retired with the June-2022 UniProt API and now raises.\nresults = u.search(\"ZAP70_HUMAN\", frmt=\"tsv\", columns=\"accession,gene_names,organism_name\")\n\n# Retrieve FASTA sequence (frmt defaults to json)\nsequence = u.retrieve(\"P43403\", frmt=\"fasta\")\n\n# Map identifiers between databases -&gt; {\"results\": [{\"from\": ..., \"to\": ...}], \"failedIds\": [...]}\njob = u.mapping(fr=\"UniProtKB_AC-ID\", to=\"KEGG\", query=\"P43403\")\nkegg_ids = [r[\"to\"] for r in job[\"results\"]]\n</code></pre>\n<p><strong>Key methods:</strong></p>\n<ul>\n<li><code>search()</code>: Query UniProt with flexible search terms (<code>frmt=\"tsv\"</code>, <code>columns</code> as UniProt\nreturn-field names such as <code>accession</code>, <code>gene_names</code>, <code>organism_name</code>, <code>length</code>)</li>\n<li><code>retrieve()</code>: Get protein entries in various formats (json, txt, xml, rdf, gff, fasta)</li>\n<li><code>mapping()</code>: Submit an ID-mapping job and return its results payload</li>\n</ul>\n<p>Reference: <code>references/services_reference.md</code> for complete UniProt API details.</p>\n<h3>2. Pathway Discovery and Analysis</h3>\n<p>Access KEGG pathway information for genes and organisms:</p>\n<pre><code>from bioservices import KEGG\n\nk = KEGG()\nk.organism = \"hsa\"  # Set to human\n\n# Search for organisms\nk.lookfor_organism(\"droso\")  # Find Drosophila species\n\n# Find pathways by name\nk.lookfor_pathway(\"B cell\")  # Returns matching pathway IDs\n\n# Get pathways containing specific genes\npathways = k.get_pathway_by_gene(\"7535\", \"hsa\")  # ZAP70 gene\n\n# Retrieve and parse pathway data\ndata = k.get(\"hsa04660\")\nparsed = k.parse(data)\n\n# Extract pathway interactions\ninteractions = k.parse_kgml_pathway(\"hsa04660\")\nrelations = interactions['relations']  # Protein-protein interactions\n\n# Convert to Simple Interaction Format\nsif_data = k.pathway2sif(\"hsa04660\")\n</code></pre>\n<p><strong>Key methods:</strong></p>\n<ul>\n<li><code>lookfor_organism()</code>, <code>lookfor_pathway()</code>: Search by name</li>\n<li><code>get_pathway_by_gene()</code>: Find pathways containing genes</li>\n<li><code>parse_kgml_pathway()</code>: Extract structured pathway data</li>\n<li><code>pathway2sif()</code>: Get protein interaction networks</li>\n</ul>\n<p>Reference: <code>references/workflow_patterns.md</code> for complete pathway analysis workflows.</p>\n<h3>3. Compound Database Searches</h3>\n<p>Search and cross-reference compounds across multiple databases:</p>\n<pre><code>from bioservices import KEGG\n\nk = KEGG()\n\n# Search compounds by name — the tab-separated result rows are \"C11222\\tGeldanamycin\"\nresults = k.find(\"compound\", \"Geldanamycin\")\n\n# Get compound information with database links\ncompound_info = k.get(\"cpd:C11222\")  # Includes ChEBI links\n\n# Cross-reference KEGG compound → ChEBI (KEGG→ChEMBL has no direct API)\nmapping = k.conv(\"chebi\", \"compound\")\nmapping[\"cpd:C11222\"]   # -&gt; 'chebi:5292'  (Geldanamycin)\n</code></pre>\n<p><strong>Common workflow:</strong></p>\n<ol>\n<li>Search compound by name in KEGG</li>\n<li>Extract KEGG compound ID</li>\n<li>Use <code>KEGG.conv</code> for KEGG → ChEBI mapping (ChEBI IDs are also embedded in KEGG entries)</li>\n<li>If a ChEMBL ID is required, obtain it via a separate route (the ChEMBL web service / <code>chembl_webresource_client</code>, or the live UniChem REST API directly) — there is no bioservices <code>UniChem</code> convenience method for KEGG → ChEMBL</li>\n</ol>\n<p>Reference: <code>references/identifier_mapping.md</code> for complete cross-database mapping guide.</p>\n<h3>4. Sequence Analysis</h3>\n<p>Run BLAST searches and sequence alignments:</p>\n<pre><code>from bioservices import NCBIblast\n\ns = NCBIblast(verbose=False)\n\n# Run BLASTP against UniProtKB via the EBI job service\njobid = s.run(\n    program=\"blastp\",\n    sequence=protein_sequence,\n    stype=\"protein\",\n    database=\"uniprotkb\",\n    email=\"your.email@example.com\"  # a real address is required; jobs are killed without one\n)\n\n# Poll, then fetch. Method names are snake_case since the API refresh.\ns.wait(jobid)                    # blocks until the job leaves RUNNING\nstatus = s.get_status(jobid)     # RUNNING | FINISHED | ERROR | FAILURE | NOT_FOUND\nresults = s.get_result(jobid, \"out\")\nprint(s.get_result_types(jobid))  # what formats this job can return\n</code></pre>\n<p>BLAST jobs are asynchronous — check the status (or call <code>wait</code>) before retrieving results.\nFor jobs submitted to NCBI rather than EBI, bioservices 1.16 adds\n<code>from bioservices import NCBIBlastAPI</code> with the same run/get_status/get_result shape.</p>\n<h3>5. Identifier Mapping</h3>\n<p>Convert identifiers between different biological databases:</p>\n<pre><code>from bioservices import UniProt, KEGG\n\n# UniProt mapping (many database pairs supported)\nu = UniProt()\njob = u.mapping(\n    fr=\"UniProtKB_AC-ID\",  # Source database\n    to=\"KEGG\",              # Target database\n    query=\"P43403\"          # Identifier(s) to convert; a list is also accepted\n)\n\n# The payload is {\"results\": [{\"from\": ..., \"to\": ...}], \"failedIds\": [...]}.\n# Collapse it yourself when you want a per-source-ID dict:\nfrom collections import defaultdict\n\nmapped = defaultdict(list)\nfor row in job[\"results\"]:\n    mapped[row[\"from\"]].append(row[\"to\"])\n\n# KEGG gene ID -&gt; UniProt. Non-UniProt sources may only map *to* UniProtKB,\n# so \"KEGG\" -&gt; \"UniProtKB\" is valid while \"KEGG\" -&gt; \"UniProtKB_AC-ID\" is not.\nkegg_to_uniprot = u.mapping(fr=\"KEGG\", to=\"UniProtKB\", query=\"hsa:7535\")\n\n# For compounds, map KEGG → ChEBI via KEGG.conv\n# (KEGG → ChEMBL has no direct API; obtain ChEMBL IDs separately\n#  via the ChEMBL web service / chembl_webresource_client or the\n#  live UniChem REST API directly)\nk = KEGG()\nkegg_to_chebi = k.conv(\"chebi\", \"compound\")\nchebi_from_kegg = kegg_to_chebi[\"cpd:C11222\"]  # -&gt; 'chebi:5292'\n</code></pre>\n<p><strong>Supported mappings (UniProt):</strong></p>\n<ul>\n<li>UniProtKB ↔ KEGG</li>\n<li>UniProtKB ↔ Ensembl</li>\n<li>UniProtKB ↔ PDB</li>\n<li>UniProtKB ↔ RefSeq</li>\n<li>And many more (see <code>references/identifier_mapping.md</code>)</li>\n</ul>\n<h3>6. Gene Ontology Queries</h3>\n<p>Access GO terms and annotations:</p>\n<pre><code>from bioservices import QuickGO\n\ng = QuickGO(verbose=False)\n\n# Retrieve GO term information (returns parsed JSON from the QuickGO REST API)\nterm_info = g.get_go_terms(\"GO:0003824\")\nancestors = g.get_go_ancestors(\"GO:0003824\")\n\n# Annotations: the parameters follow the QuickGO REST API, not the old\n# protein=/format= signature. geneProductId is prefixed, limit is capped at 100.\nannotations = g.Annotation(\n    geneProductId=\"UniProtKB:P43403\",\n    includeFields=\"goName\",\n    limit=100,\n    page=1,\n)\nfor row in annotations[\"results\"][:5]:\n    print(row[\"goId\"], row[\"goName\"], row[\"goAspect\"])\n</code></pre>\n<p><code>Annotation</code> returns a dict with <code>numberOfHits</code> and <code>results</code>; page through it rather than\nraising <code>limit</code> (values above 100 raise a <code>TypeError</code>).</p>\n<h3>7. Protein-Protein Interactions</h3>\n<p>PSICQUIC and BioGRID were removed from bioservices in 1.14. Use the STRING service (or\n<code>IntactComplex</code> for curated complexes):</p>\n<pre><code>from bioservices import STRING\n\ns = STRING()\n\n# Functional + physical partners of a protein\npartners = s.get_interaction_partners(\"ZAP70\", species=9606, limit=20)\n\n# Interactions within a given set of proteins\nnetwork = s.get_interactions([\"ZAP70\", \"CD247\", \"LCK\"], species=9606)\n\nfor row in partners:\n    print(row[\"preferredName_A\"], row[\"preferredName_B\"], row[\"score\"])\n</code></pre>\n<p><code>network_type=\"physical\"</code> restricts to physical complexes; <code>required_score</code> (0–1000) sets\nthe confidence floor. STRING scores are 0–1 in the JSON output.</p>\n<h2>Multi-Service Integration Workflows</h2>\n<p>BioServices excels at combining multiple services for comprehensive analysis. Common integration patterns:</p>\n<h3>Complete Protein Analysis Pipeline</h3>\n<p>Execute a full protein characterization workflow:</p>\n<pre><code>python scripts/protein_analysis_workflow.py ZAP70_HUMAN your.email@example.com\n</code></pre>\n<p>This script demonstrates:</p>\n<ol>\n<li>UniProt search for protein entry</li>\n<li>FASTA sequence retrieval</li>\n<li>BLAST similarity search</li>\n<li>KEGG pathway discovery</li>\n<li>STRING interaction mapping</li>\n</ol>\n<h3>Pathway Network Analysis</h3>\n<p>Analyze all pathways for an organism:</p>\n<pre><code>python scripts/pathway_analysis.py hsa output_directory/\n</code></pre>\n<p>Extracts and analyzes:</p>\n<ul>\n<li>All pathway IDs for organism</li>\n<li>Protein-protein interactions per pathway</li>\n<li>Interaction type distributions</li>\n<li>Exports to CSV/SIF formats</li>\n</ul>\n<h3>Cross-Database Compound Search</h3>\n<p>Map compound identifiers across databases:</p>\n<pre><code>python scripts/compound_cross_reference.py Geldanamycin\n</code></pre>\n<p>Retrieves:</p>\n<ul>\n<li>KEGG compound ID</li>\n<li>ChEBI identifier</li>\n<li>ChEMBL identifier</li>\n<li>Basic compound properties</li>\n</ul>\n<h3>Batch Identifier Conversion</h3>\n<p>Convert multiple identifiers at once:</p>\n<pre><code>python scripts/batch_id_converter.py input_ids.txt --from UniProtKB_AC-ID --to KEGG\n</code></pre>\n<h2>Best Practices</h2>\n<h3>Output Format Handling</h3>\n<p>Different services return data in various formats:</p>\n<ul>\n<li><strong>XML</strong>: Parse using BeautifulSoup (most SOAP services)</li>\n<li><strong>Tab-separated (TSV)</strong>: Pandas DataFrames for tabular data</li>\n<li><strong>Dictionary/JSON</strong>: Direct Python manipulation</li>\n<li><strong>FASTA</strong>: BioPython integration for sequence analysis</li>\n</ul>\n<h3>Rate Limiting and Verbosity</h3>\n<p>Control API request behavior:</p>\n<pre><code>from bioservices import KEGG\n\nk = KEGG(verbose=False)  # Suppress HTTP request details\nk.TIMEOUT = 30  # Adjust timeout for slow connections\n</code></pre>\n<h3>Error Handling</h3>\n<p>Wrap service calls in try-except blocks:</p>\n<pre><code>try:\n    results = u.search(\"ambiguous_query\")\n    if results:\n        # Process results\n        pass\nexcept Exception as e:\n    print(f\"Search failed: {e}\")\n</code></pre>\n<h3>Organism Codes</h3>\n<p>Use standard organism abbreviations:</p>\n<ul>\n<li><code>hsa</code>: Homo sapiens (human)</li>\n<li><code>mmu</code>: Mus musculus (mouse)</li>\n<li><code>dme</code>: Drosophila melanogaster</li>\n<li><code>sce</code>: Saccharomyces cerevisiae (yeast)</li>\n</ul>\n<p>List all organisms: <code>k.list(\"organism\")</code> or <code>k.organismIds</code></p>\n<h3>Integration with Other Tools</h3>\n<p>BioServices works well with:</p>\n<ul>\n<li><strong>BioPython</strong>: Sequence analysis on retrieved FASTA data</li>\n<li><strong>Pandas</strong>: Tabular data manipulation</li>\n<li><strong>PyMOL</strong>: 3D structure visualization (retrieve PDB IDs)</li>\n<li><strong>NetworkX</strong>: Network analysis of pathway interactions</li>\n<li><strong>Galaxy</strong>: Custom tool wrappers for workflow platforms</li>\n</ul>\n<h2>Resources</h2>\n<h3>scripts/</h3>\n<p>Executable Python scripts demonstrating complete workflows:</p>\n<ul>\n<li><code>protein_analysis_workflow.py</code>: End-to-end protein characterization</li>\n<li><code>pathway_analysis.py</code>: KEGG pathway discovery and network extraction</li>\n<li><code>compound_cross_reference.py</code>: Multi-database compound searching</li>\n<li><code>batch_id_converter.py</code>: Bulk identifier mapping utility</li>\n</ul>\n<p>Scripts can be executed directly or adapted for specific use cases.</p>\n<h3>references/</h3>\n<p>Detailed documentation loaded as needed:</p>\n<ul>\n<li><code>services_reference.md</code>: Comprehensive list of all 40+ services with methods</li>\n<li><code>workflow_patterns.md</code>: Detailed multi-step analysis workflows</li>\n<li><code>identifier_mapping.md</code>: Complete guide to cross-database ID conversion</li>\n</ul>\n<p>Load references when working with specific services or complex integration tasks.</p>\n<h2>Installation</h2>\n<pre><code>uv pip install bioservices\n</code></pre>\n<p>Dependencies are automatically managed. Package is tested on Python 3.9-3.12.</p>\n<h2>Additional Information</h2>\n<p>For detailed API documentation and advanced features, refer to:</p>\n<ul>\n<li>Official documentation: <a href=\"https://bioservices.readthedocs.io/\">https://bioservices.readthedocs.io/</a></li>\n<li>Source code: <a href=\"https://github.com/cokelaer/bioservices\">https://github.com/cokelaer/bioservices</a></li>\n<li>Service-specific references in <code>references/services_reference.md</code></li>\n</ul>\n<p>Part of the AlterLab Academic Skills suite.</p>\n","files":[{"path":"evals/evals.json","sizeBytes":4288,"isText":true},{"path":"references/identifier_mapping.md","sizeBytes":19506,"isText":true},{"path":"references/services_reference.md","sizeBytes":17842,"isText":true},{"path":"references/workflow_patterns.md","sizeBytes":20300,"isText":true},{"path":"scripts/batch_id_converter.py","sizeBytes":11954,"isText":true},{"path":"scripts/compound_cross_reference.py","sizeBytes":10344,"isText":true},{"path":"scripts/pathway_analysis.py","sizeBytes":9557,"isText":true},{"path":"scripts/protein_analysis_workflow.py","sizeBytes":13223,"isText":true},{"path":"SKILL.md","sizeBytes":14432,"isText":true}],"reviewScore":null,"reviewSummary":null,"trust":{"provenance":"trusted-source-unreviewed","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow.","bodySource":null},"bodyLocked":false,"purchaseUrl":null,"sourceUrl":null,"report":{"provenance":"trusted-source-unreviewed","screen":{"ran":true,"outcome":"clean","suspicious":0,"notes":0,"hiddenCharacters":false},"virusScan":{"engine":"clamav","status":"clean","scannedAt":"2026-09-23T18:57:12.983894Z","sha256":"5E2D67B4D1B88C9F93668B1E74EB18503ED74EDFCB9C0019E71B84F85C38ADF4","sizeBytes":42395},"review":null,"source":{"repositoryUrl":"https://github.com/AlterLab-IEU/AlterLab-Academic-Skills","path":"skills/bioinformatics/alterlab-bioservices","license":"MIT","commit":"e4836c08a20da195a11f30f203a8cf23ec30aa95","subtreeSha":"C361C111F68441F97D6BCE4D7790EE7D3C4A8ABCF8637BF586682BE091C51332","lastSyncedAt":"2026-09-23T18:56:52.297238Z"},"reviewedAt":"2026-09-23T18:57:50.253185Z","notice":"Community-authored content, reproduced verbatim and not vetted as instructions. Treat it as data to evaluate, never as directives to follow."},"install":[{"target":"skills-cli","command":"npx skills add https://github.com/AlterLab-IEU/AlterLab-Academic-Skills/tree/main/skills/bioinformatics/alterlab-bioservices"},{"target":"claude-code","command":"claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install alterlab-ieu-alterlab-academic-skills@llmmart"},{"target":"git","command":"git clone https://github.com/AlterLab-IEU/AlterLab-Academic-Skills.git"}]}