Queries 40+ bioinformatics web services (UniProt, KEGG, ChEMBL, Reactome, Ensembl, NCBI) through a consistent Python API. Useful for cross-database analyses, identifier mapping, and multi-service workflows.
Ships in alterlab-bioinformatics. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
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.
Recent changes that break old scripts (verified against bioservices 1.16.0):
WSDLService class and its suds dependency are gone.PSICQUIC and BioGRID were removed in 1.14. For protein interactions use the
STRING class (added in 1.14) or IntactComplex; from bioservices import PSICQUIC
raises ImportError.UniProt.mapping() returns the raw UniProt job payload —
{"results": [{"from": ..., "to": ...}, ...], "failedIds": [...]} — not a
{source_id: [target_ids]} dict. See "Identifier Mapping" below.get_status, get_result, get_result_types,
wait); the old getStatus/getResult camelCase names are gone. 1.16 also adds
ncbiblastapi.NCBIBlastAPI, which submits to NCBI directly instead of EBI.This skill should be used when:
| Scenario | Use Instead |
|---|---|
| A single quick lookup of gene/transcript info, a sequence, or an enrichment list | alterlab-gget |
| Parsing sequence/structure files or scripting Entrez directly | alterlab-biopython |
Local BLAST+ / makeblastdb / DIAMOND on your own database | alterlab-blast |
| Deep work in one database (full KEGG, UniProt, or ChEMBL feature set) | alterlab-kegg, alterlab-uniprot, alterlab-chembl |
| Cheminformatics on the retrieved structures (descriptors, fingerprints) | alterlab-rdkit |
Hand-off rule. When the request matches a row above, open your answer by naming that skill by its exact id (for example alterlab-gget) and saying in one line why it fits better, then stop applying this skill's procedure. Name it even when you also need to ask for missing input. If only part of the request is out of scope, name the skill for that part and do only the in-scope part. A brief general pointer is fine; the named skill does the work.
Retrieve protein information, sequences, and functional annotations:
from bioservices import UniProt
u = UniProt(verbose=False)
# Search for protein by name. frmt is one of xlsx/fasta/json/gff/tsv — "tab" was
# retired with the June-2022 UniProt API and now raises.
results = u.search("ZAP70_HUMAN", frmt="tsv", columns="accession,gene_names,organism_name")
# Retrieve FASTA sequence (frmt defaults to json)
sequence = u.retrieve("P43403", frmt="fasta")
# Map identifiers between databases -> {"results": [{"from": ..., "to": ...}], "failedIds": [...]}
job = u.mapping(fr="UniProtKB_AC-ID", to="KEGG", query="P43403")
kegg_ids = [r["to"] for r in job["results"]]
Key methods:
search(): Query UniProt with flexible search terms (frmt="tsv", columns as UniProt
return-field names such as accession, gene_names, organism_name, length)retrieve(): Get protein entries in various formats (json, txt, xml, rdf, gff, fasta)mapping(): Submit an ID-mapping job and return its results payloadReference: references/services_reference.md for complete UniProt API details.
Access KEGG pathway information for genes and organisms:
from bioservices import KEGG
k = KEGG()
k.organism = "hsa" # Set to human
# Search for organisms
k.lookfor_organism("droso") # Find Drosophila species
# Find pathways by name
k.lookfor_pathway("B cell") # Returns matching pathway IDs
# Get pathways containing specific genes
pathways = k.get_pathway_by_gene("7535", "hsa") # ZAP70 gene
# Retrieve and parse pathway data
data = k.get("hsa04660")
parsed = k.parse(data)
# Extract pathway interactions
interactions = k.parse_kgml_pathway("hsa04660")
relations = interactions['relations'] # Protein-protein interactions
# Convert to Simple Interaction Format
sif_data = k.pathway2sif("hsa04660")
Key methods:
lookfor_organism(), lookfor_pathway(): Search by nameget_pathway_by_gene(): Find pathways containing genesparse_kgml_pathway(): Extract structured pathway datapathway2sif(): Get protein interaction networksReference: references/workflow_patterns.md for complete pathway analysis workflows.
Search and cross-reference compounds across multiple databases:
from bioservices import KEGG
k = KEGG()
# Search compounds by name — the tab-separated result rows are "C11222\tGeldanamycin"
results = k.find("compound", "Geldanamycin")
# Get compound information with database links
compound_info = k.get("cpd:C11222") # Includes ChEBI links
# Cross-reference KEGG compound → ChEBI (KEGG→ChEMBL has no direct API)
mapping = k.conv("chebi", "compound")
mapping["cpd:C11222"] # -> 'chebi:5292' (Geldanamycin)
Known breakage (bioservices ≤ 1.16, verified 2026-10):
KEGG().find(...)andKEGG().conv(...)currently raiseAttributeError: 'HTTPResponseError' object has no attribute 'split'. Before searching, bioservices validates the database name against the KEGG organism list, buthttps://rest.kegg.jp/list/organismnow returns HTTP 400, and the library chokes on the error object. Until it is fixed, call the KEGG REST endpoints directly (they work):import requests hits = requests.get("https://rest.kegg.jp/find/compound/Geldanamycin").text # -> "C11222\tGeldanamycin\nC15823\tProgeldanamycin" chebi = requests.get("https://rest.kegg.jp/conv/chebi/cpd:C11222").text # -> "cpd:C11222\tchebi:5292"This hits
rest.kegg.jponly (no organism-list call), so it sidesteps the HTTP 400.
Common workflow:
KEGG.conv for KEGG → ChEBI mapping (ChEBI IDs are also embedded in KEGG entries)chembl_webresource_client, or the live UniChem REST API directly) — there is no bioservices UniChem convenience method for KEGG → ChEMBLReference: references/identifier_mapping.md for complete cross-database mapping guide.
Run BLAST searches and sequence alignments:
from bioservices import NCBIblast
s = NCBIblast(verbose=False)
# Run BLASTP against UniProtKB via the EBI job service
jobid = s.run(
program="blastp",
sequence=protein_sequence,
stype="protein",
database="uniprotkb",
email="[email protected]" # a real address is required; jobs are killed without one
)
# Poll, then fetch. Method names are snake_case since the API refresh.
s.wait(jobid) # blocks until the job leaves RUNNING
status = s.get_status(jobid) # RUNNING | FINISHED | ERROR | FAILURE | NOT_FOUND
results = s.get_result(jobid, "out")
print(s.get_result_types(jobid)) # what formats this job can return
BLAST jobs are asynchronous — check the status (or call wait) before retrieving results.
For jobs submitted to NCBI rather than EBI, bioservices 1.16 adds
from bioservices import NCBIBlastAPI with the same run/get_status/get_result shape.
Convert identifiers between different biological databases:
from bioservices import UniProt, KEGG
# UniProt mapping (many database pairs supported)
u = UniProt()
job = u.mapping(
fr="UniProtKB_AC-ID", # Source database
to="KEGG", # Target database
query="P43403" # Identifier(s) to convert; a list is also accepted
)
# The payload is {"results": [{"from": ..., "to": ...}], "failedIds": [...]}.
# Collapse it yourself when you want a per-source-ID dict:
from collections import defaultdict
mapped = defaultdict(list)
for row in job["results"]:
mapped[row["from"]].append(row["to"])
# KEGG gene ID -> UniProt. Non-UniProt sources may only map *to* UniProtKB,
# so "KEGG" -> "UniProtKB" is valid while "KEGG" -> "UniProtKB_AC-ID" is not.
kegg_to_uniprot = u.mapping(fr="KEGG", to="UniProtKB", query="hsa:7535")
# For compounds, map KEGG → ChEBI via KEGG.conv
# (KEGG → ChEMBL has no direct API; obtain ChEMBL IDs separately
# via the ChEMBL web service / chembl_webresource_client or the
# live UniChem REST API directly)
k = KEGG()
kegg_to_chebi = k.conv("chebi", "compound")
chebi_from_kegg = kegg_to_chebi["cpd:C11222"] # -> 'chebi:5292'
Supported mappings (UniProt):
references/identifier_mapping.md)Access GO terms and annotations:
from bioservices import QuickGO
g = QuickGO(verbose=False)
# Retrieve GO term information (returns parsed JSON from the QuickGO REST API)
term_info = g.get_go_terms("GO:0003824")
ancestors = g.get_go_ancestors("GO:0003824")
# Annotations: the parameters follow the QuickGO REST API, not the old
# protein=/format= signature. geneProductId is prefixed, limit is capped at 100.
annotations = g.Annotation(
geneProductId="UniProtKB:P43403",
includeFields="goName",
limit=100,
page=1,
)
for row in annotations["results"][:5]:
print(row["goId"], row["goName"], row["goAspect"])
Annotation returns a dict with numberOfHits and results; page through it rather than
raising limit (values above 100 raise a TypeError).
Querying PPI partners from STRING or IntAct is this skill's job — even for a single protein.
It is not a "quick lookup" to hand to alterlab-gget; gget has no STRING/IntAct PPI route.
PSICQUIC and BioGRID were removed from bioservices in 1.14. Use the STRING service (or
IntactComplex for curated complexes):
from bioservices import STRING
s = STRING()
# Functional + physical partners of a protein
partners = s.get_interaction_partners("ZAP70", species=9606, limit=20)
# Interactions within a given set of proteins
network = s.get_interactions(["ZAP70", "CD247", "LCK"], species=9606)
for row in partners:
print(row["preferredName_A"], row["preferredName_B"], row["score"])
network_type="physical" restricts to physical complexes; required_score (0–1000) sets
the confidence floor. STRING scores are 0–1 in the JSON output.
BioServices excels at combining multiple services for comprehensive analysis. Common integration patterns:
Execute a full protein characterization workflow:
python scripts/protein_analysis_workflow.py ZAP70_HUMAN [email protected]
This script demonstrates:
Analyze all pathways for an organism:
python scripts/pathway_analysis.py hsa output_directory/
Extracts and analyzes:
Map compound identifiers across databases:
python scripts/compound_cross_reference.py Geldanamycin
Retrieves:
Convert multiple identifiers at once:
python scripts/batch_id_converter.py input_ids.txt --from UniProtKB_AC-ID --to KEGG
Different services return data in various formats:
Control API request behavior:
from bioservices import KEGG
k = KEGG(verbose=False) # Suppress HTTP request details
k.TIMEOUT = 30 # Adjust timeout for slow connections
Wrap service calls in try-except blocks:
try:
results = u.search("ambiguous_query")
if results:
# Process results
pass
except Exception as e:
print(f"Search failed: {e}")
Use standard organism abbreviations:
hsa: Homo sapiens (human)mmu: Mus musculus (mouse)dme: Drosophila melanogastersce: Saccharomyces cerevisiae (yeast)List all organisms: k.list("organism") or k.organismIds
BioServices works well with:
Executable Python scripts demonstrating complete workflows:
protein_analysis_workflow.py: End-to-end protein characterizationpathway_analysis.py: KEGG pathway discovery and network extractioncompound_cross_reference.py: Multi-database compound searchingbatch_id_converter.py: Bulk identifier mapping utilityScripts can be executed directly or adapted for specific use cases.
Detailed documentation loaded as needed:
services_reference.md: Comprehensive list of all 40+ services with methodsworkflow_patterns.md: Detailed multi-step analysis workflowsidentifier_mapping.md: Complete guide to cross-database ID conversionLoad references when working with specific services or complex integration tasks.
uv pip install bioservices
Dependencies are automatically managed. Package is tested on Python 3.9-3.12.
For detailed API documentation and advanced features, refer to:
references/services_reference.mdPart of the AlterLab Academic Skills suite.
evals/evals.json (opens in a new tab)references/identifier_mapping.md (opens in a new tab)references/services_reference.md (opens in a new tab)references/workflow_patterns.md (opens in a new tab)scripts/batch_id_converter.py (opens in a new tab)scripts/compound_cross_reference.py (opens in a new tab)scripts/pathway_analysis.py (opens in a new tab)scripts/protein_analysis_workflow.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/alterlab-bioinformatics:alterlab-bioservicesfrom alterlab-bioinformatics
npx claudepluginhub alterlab-ieu/alterlab-academic-skills --plugin alterlab-bioinformatics2 plugins in one repository ship this exact skill · first indexed Nov 9, 2026
38 skills in this plugin
/alterlab-alphafoldPredict protein 3D structures with AlphaFold2 via ColabFold — MMseqs2-accelerated MSAs, monomer and AlphaFold2-Multimer complex folding, and confidence-based validation (pLDDT, pTM/ipTM, PAE). Use when folding a protein sequence or complex from FASTA, generating a predicted structure with confidence metrics, ranking models, or checking self-consistency of a design. For co-folding a protein WITH a small-molecule ligand or predicting binding affinity prefer alterlab-boltz; for antibody–antigen or one-FASTA multi-entity complexes prefer alterlab-chai; to LOOK UP an already-computed structure prefer alterlab-alphafold-db; for ESM embeddings or inverse folding prefer alterlab-esm. Part of the AlterLab Academic Skills suite./alterlab-anndataBuild, slice, concatenate, read, and write AnnData annotated data matrices (obs, var, X, layers, obsm, uns) — the scverse data STRUCTURE, not an analysis pipeline. Use when creating or wrangling .h5ad/zarr files, managing cell and gene annotations, concatenating batches, or handling layers/obsm/backed-mode; for the QC, normalization, clustering, UMAP, and differential-expression analysis pipeline prefer alterlab-scanpy instead, and for RNA velocity from spliced/unspliced layers prefer alterlab-scvelo instead. Part of the AlterLab Academic Skills suite.Other plugins' skills for the same job