Unified Python interface to 40+ bioinformatics services. Use when querying multiple databases (UniProt, KEGG, ChEMBL, Reactome) in a single workflow with consistent API. Best for cross-database analysis, ID mapping across services. For quick single-database lookups use gget; for sequence/file manipulation use biopython.
columns names — see upstream _legacy_names if parsing breaks. ChEMBL wrappers changed at 1.6.0 (2018 API); use get_similarity, get_substructure, get_molecule instead of pre-1.6 method names.from bioservices import UniProt
u = UniProt(verbose=False)
# Search for protein by name
results = u.search("ZAP70_HUMAN", frmt="tab", columns="id,genes,organism")
# Retrieve FASTA sequence
sequence = u.retrieve("P43403", "fasta")
# Map identifiers between databases
kegg_ids = u.mapping(fr="UniProtKB_AC-ID", to="KEGG", query="P43403")
search(): Query UniProt with flexible search termsretrieve(): Get protein entries in various formats (FASTA, XML, tab)mapping(): Convert identifiers between databasesreferences/services_reference.md for complete UniProt API details.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")
lookfor_organism(), lookfor_pathway(): Search by nameget_pathway_by_gene(): Find pathways containing genesparse_kgml_pathway(): Extract structured pathway datapathway2sif(): Get protein interaction networksreferences/workflow_patterns.md for complete pathway analysis workflows.from bioservices import KEGG, UniChem
k = KEGG()
# Search compounds by name
results = k.find("compound", "Geldanamycin") # Returns cpd:C11222
# Get compound information with database links
compound_info = k.get("cpd:C11222") # Includes ChEBI links
# Cross-reference KEGG → ChEMBL using UniChem
u = UniChem()
chembl_id = u.get_compound_id_from_kegg("C11222") # Returns CHEMBL278315
references/identifier_mapping.md for complete cross-database mapping guide.NCBI_EMAIL environment variable (same convention as BioPython Entrez and other repo skills):import os
from bioservices import NCBIblast
s = NCBIblast(verbose=False)
email = os.environ["NCBI_EMAIL"] # set before running: export NCBI_EMAIL=you@lab.org
# Run BLASTP against UniProtKB
jobid = s.run(
program="blastp",
sequence=protein_sequence,
stype="protein",
database="uniprotkb",
email=email,
)
# Check job status and retrieve results
s.getStatus(jobid)
results = s.getResult(jobid, "out")
from bioservices import UniProt, KEGG
# UniProt mapping (many database pairs supported)
u = UniProt()
results = u.mapping(
fr="UniProtKB_AC-ID", # Source database
to="KEGG", # Target database
query="P43403" # Identifier(s) to convert
)
# KEGG gene ID → UniProt
kegg_to_uniprot = u.mapping(fr="KEGG", to="UniProtKB_AC-ID", query="hsa:7535")
# For compounds, use UniChem
from bioservices import UniChem
u = UniChem()
chembl_from_kegg = u.get_compound_id_from_kegg("C11222")
references/identifier_mapping.md)from bioservices import QuickGO
g = QuickGO(verbose=False)
# Retrieve GO term information
term_info = g.Term("GO:0003824", frmt="obo")
# Search annotations
annotations = g.Annotation(protein="P43403", format="tsv")
from bioservices import PSICQUIC
s = PSICQUIC(verbose=False)
# Query specific database (e.g., MINT)
interactions = s.query("mint", "ZAP70 AND species:9606")
# List available interaction databases
databases = s.activeDBs
export NCBI_EMAIL=your.email@example.com
python scripts/protein_analysis_workflow.py ZAP70_HUMAN
# Or pass email as optional second argument if NCBI_EMAIL is unset
python scripts/protein_analysis_workflow.py ZAP70_HUMAN your.email@example.com
python scripts/pathway_analysis.py hsa output_directory/
python scripts/compound_cross_reference.py Geldanamycin
python scripts/batch_id_converter.py input_ids.txt --from UniProtKB_AC-ID --to KEGG
from bioservices import KEGG
k = KEGG(verbose=False) # Suppress HTTP request details
k.TIMEOUT = 30 # Adjust timeout for slow connections
try:
results = u.search("ambiguous_query")
if results:
# Process results
pass
except Exception as e:
print(f"Search failed: {e}")
hsa: Homo sapiens (human)mmu: Mus musculus (mouse)dme: Drosophila melanogastersce: Saccharomyces cerevisiae (yeast)k.list("organism") or k.organismIdsprotein_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 utilityservices_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 conversionuv pip install "bioservices==1.16.0"
| Service | Requirement |
|---|---|
| NCBI BLAST | Contact email via NCBI_EMAIL or email= in NCBIblast.run() |
| Some EBI services | Optional; check service docs if rate-limited |
export NCBI_EMAIL=your.email@example.com
references/services_reference.md