$npx -y skills add LeonChaoX/qinyan-academic-skills --skill bioservicesUnified 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
| 1 | # BioServices |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | BioServices is a Python package providing programmatic access to approximately 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. The package handles both REST and SOAP/WSDL protocols transparently. |
| 6 | |
| 7 | ## When to Use This Skill |
| 8 | |
| 9 | This skill should be used when: |
| 10 | - Retrieving protein sequences, annotations, or structures from UniProt, PDB, Pfam |
| 11 | - Analyzing metabolic pathways and gene functions via KEGG or Reactome |
| 12 | - Searching compound databases (ChEBI, ChEMBL, PubChem) for chemical information |
| 13 | - Converting identifiers between different biological databases (KEGG↔UniProt, compound IDs) |
| 14 | - Running sequence similarity searches (BLAST, MUSCLE alignment) |
| 15 | - Querying gene ontology terms (QuickGO, GO annotations) |
| 16 | - Accessing protein-protein interaction data (PSICQUIC, IntactComplex) |
| 17 | - Mining genomic data (BioMart, ArrayExpress, ENA) |
| 18 | - Integrating data from multiple bioinformatics resources in a single workflow |
| 19 | |
| 20 | ## Core Capabilities |
| 21 | |
| 22 | ### 1. Protein Analysis |
| 23 | |
| 24 | Retrieve protein information, sequences, and functional annotations: |
| 25 | |
| 26 | ```python |
| 27 | from bioservices import UniProt |
| 28 | |
| 29 | u = UniProt(verbose=False) |
| 30 | |
| 31 | # Search for protein by name |
| 32 | results = u.search("ZAP70_HUMAN", frmt="tab", columns="id,genes,organism") |
| 33 | |
| 34 | # Retrieve FASTA sequence |
| 35 | sequence = u.retrieve("P43403", "fasta") |
| 36 | |
| 37 | # Map identifiers between databases |
| 38 | kegg_ids = u.mapping(fr="UniProtKB_AC-ID", to="KEGG", query="P43403") |
| 39 | ``` |
| 40 | |
| 41 | **Key methods:** |
| 42 | - `search()`: Query UniProt with flexible search terms |
| 43 | - `retrieve()`: Get protein entries in various formats (FASTA, XML, tab) |
| 44 | - `mapping()`: Convert identifiers between databases |
| 45 | |
| 46 | Reference: `references/services_reference.md` for complete UniProt API details. |
| 47 | |
| 48 | ### 2. Pathway Discovery and Analysis |
| 49 | |
| 50 | Access KEGG pathway information for genes and organisms: |
| 51 | |
| 52 | ```python |
| 53 | from bioservices import KEGG |
| 54 | |
| 55 | k = KEGG() |
| 56 | k.organism = "hsa" # Set to human |
| 57 | |
| 58 | # Search for organisms |
| 59 | k.lookfor_organism("droso") # Find Drosophila species |
| 60 | |
| 61 | # Find pathways by name |
| 62 | k.lookfor_pathway("B cell") # Returns matching pathway IDs |
| 63 | |
| 64 | # Get pathways containing specific genes |
| 65 | pathways = k.get_pathway_by_gene("7535", "hsa") # ZAP70 gene |
| 66 | |
| 67 | # Retrieve and parse pathway data |
| 68 | data = k.get("hsa04660") |
| 69 | parsed = k.parse(data) |
| 70 | |
| 71 | # Extract pathway interactions |
| 72 | interactions = k.parse_kgml_pathway("hsa04660") |
| 73 | relations = interactions['relations'] # Protein-protein interactions |
| 74 | |
| 75 | # Convert to Simple Interaction Format |
| 76 | sif_data = k.pathway2sif("hsa04660") |
| 77 | ``` |
| 78 | |
| 79 | **Key methods:** |
| 80 | - `lookfor_organism()`, `lookfor_pathway()`: Search by name |
| 81 | - `get_pathway_by_gene()`: Find pathways containing genes |
| 82 | - `parse_kgml_pathway()`: Extract structured pathway data |
| 83 | - `pathway2sif()`: Get protein interaction networks |
| 84 | |
| 85 | Reference: `references/workflow_patterns.md` for complete pathway analysis workflows. |
| 86 | |
| 87 | ### 3. Compound Database Searches |
| 88 | |
| 89 | Search and cross-reference compounds across multiple databases: |
| 90 | |
| 91 | ```python |
| 92 | from bioservices import KEGG, UniChem |
| 93 | |
| 94 | k = KEGG() |
| 95 | |
| 96 | # Search compounds by name |
| 97 | results = k.find("compound", "Geldanamycin") # Returns cpd:C11222 |
| 98 | |
| 99 | # Get compound information with database links |
| 100 | compound_info = k.get("cpd:C11222") # Includes ChEBI links |
| 101 | |
| 102 | # Cross-reference KEGG → ChEMBL using UniChem |
| 103 | u = UniChem() |
| 104 | chembl_id = u.get_compound_id_from_kegg("C11222") # Returns CHEMBL278315 |
| 105 | ``` |
| 106 | |
| 107 | **Common workflow:** |
| 108 | 1. Search compound by name in KEGG |
| 109 | 2. Extract KEGG compound ID |
| 110 | 3. Use UniChem for KEGG → ChEMBL mapping |
| 111 | 4. ChEBI IDs are often provided in KEGG entries |
| 112 | |
| 113 | Reference: `references/identifier_mapping.md` for complete cross-database mapping guide. |
| 114 | |
| 115 | ### 4. Sequence Analysis |
| 116 | |
| 117 | Run BLAST searches and sequence alignments: |
| 118 | |
| 119 | ```python |
| 120 | from bioservices import NCBIblast |
| 121 | |
| 122 | s = NCBIblast(verbose=False) |
| 123 | |
| 124 | # Run BLASTP against UniProtKB |
| 125 | jobid = s.run( |
| 126 | program="blastp", |
| 127 | sequence=protein_sequence, |
| 128 | stype="protein", |
| 129 | database="uniprotkb", |
| 130 | email="your.email@example.com" # Required by NCBI |
| 131 | ) |
| 132 | |
| 133 | # Check job status and retrieve results |
| 134 | s.getStatus(jobid) |
| 135 | results = s.getResult(jobid, "out") |
| 136 | ``` |
| 137 | |
| 138 | **Note:** BLAST jobs are asynchronous. Check status before retrieving results. |
| 139 | |
| 140 | ### 5. Identifier Mapping |
| 141 | |
| 142 | Convert identifiers between different biological databases: |
| 143 | |
| 144 | ```python |
| 145 | from bioservices import UniProt, KEGG |
| 146 | |
| 147 | # UniProt mapping (many database pairs supported) |
| 148 | u = UniProt() |
| 149 | results = u.mapping( |
| 150 | fr="UniProtKB_AC-ID", # Source database |
| 151 | to="KEGG", # Target database |
| 152 | query="P43403" |