Skill Tracer
Skills › Scientific Agent Skills › bioservices

bioservices

skill · 247 lines · GPLv3 license · skills/bioservices/SKILL.md

The facts

Its description

Provides a Python interface to bioinformatics services including UniProt, KEGG, ChEMBL, Reactome, QuickGO, and UniChem. Used for cross-database protein annotation, pathway retrieval, chemical identifier mapping, and integrated biological data workflows with BioServices.

The description the agent reads to decide when to use it.

From its settingsline 3

Tools it may use, or may not

allowed-tools: Read Write Edit Bash

Tools it may use while it runs without asking you first.

From its settingsline 5

Runs scripts

python scripts/protein_analysis_workflow.py, python scripts/pathway_analysis.py, python scripts/compound_cross_reference.py, python scripts/batch_id_converter.py (first 5 of 9 lines)

Scripts the text names. Found by matching words, so treat them as pointers.

Found by matching wordsline 195 line 196 line 197 line 198 line 199

Files it mentions

references/services_reference.md, references/identifier_mapping.md, scripts/protein_analysis_workflow.py, scripts/pathway_analysis.py, scripts/compound_cross_reference.py (first 5 of 7 lines)

Files the text names, such as ones to read or write. Found by matching words, so treat them as pointers.

Found by matching wordsline 25 line 79 line 202 line 205 line 207

Licence

GPLv3 license, from the skill file

The terms its author shares it under, which let it be shown here.

From its settingsline 4 licence text

Other settings

compatibility: Requires Python >=3.9,<4 with bioservices==1.16.0 and internet access. EMBL-EBI BLAST submission requires a real contact email; the bundled script reads NCBI_EMAIL or an explicit parameter. metadata: name: NCBI_EMAIL

More settings at the top of the file, shown as written.

From its settingsline 6 line 7
Other files in this skill (7) Close

The text

Open on GitHub

Most marks come from matching words in the file, so treat them as pointers.

1---
2name: bioservices
3description: Provides a Python interface to bioinformatics services including UniProt, KEGG, ChEMBL, Reactome, QuickGO, and UniChem. Used for cross-database protein annotation, pathway retrieval, chemical identifier mapping, and integrated biological data workflows with BioServices.
4license: GPLv3 license
5allowed-tools: Read Write Edit Bash
6compatibility: Requires Python >=3.9,<4 with bioservices==1.16.0 and internet access. EMBL-EBI BLAST submission requires a real contact email; the bundled script reads NCBI_EMAIL or an explicit parameter.
7metadata:
8 version: "1.7"
9 last-reviewed: "2026-09-30"
10 skill-author: K-Dense Inc.
11 openclaw:
12 envVars:
13 - name: NCBI_EMAIL
14 required: false
15 description: Contact email for the EMBL-EBI hosted NCBI BLAST service.
16---
18# BioServices
20## When to use
22Use BioServices when combining protein annotation, gene/pathway membership,
23compound cross-references, or genomic resources in Python. Its service clients
24share transport helpers, but their request parameters and return types differ.
25Use [the service reference](references/services_reference.md) before composing
26clients; method names from PubChemPy, mygene, or older BioServices are not portable.
28Targets **bioservices 1.16.0**, the current PyPI release at review. Package metadata
29allows Python >=3.9,<4; the bundled tests were run in an isolated Python 3.13
30environment. The previous 3.12 upper bound was not a package requirement.
32```bash
33uv pip install "bioservices==1.16.0"
34```

When to use

Use BioServices when combining protein annotation, gene/pathway membership, compound cross-references, or genomic resources in Python. Its service clients share transport helpers, but their request parameters and return types differ. Use the service reference before composing clients; method names from PubChemPy, mygene, or older BioServices are not portable.

Targets bioservices 1.16.0, the current PyPI release at review. Package metadata allows Python >=3.9,<4; the bundled tests were run in an isolated Python 3.13 environment. The previous 3.12 upper bound was not a package requirement.

uv pip install "bioservices==1.16.0"
Raw lines 20 to 35
36## Workflow
381. Resolve the requested organism and entity to stable accessions. Review search
39 hits before selecting one; gene symbols and compound names may be ambiguous.
402. Inspect the service's actual response type, including pagination and errors.
41 BioServices can return an integer-like HTTP error or `None`, not only raise.
423. Preserve one-to-many mappings, failed identifiers, taxonomy, database release,
43 query parameters, and retrieval date alongside derived tables.
444. Distinguish annotations and inferred associations from experimental evidence.
45 Pathway membership alone is not an enrichment analysis or causal finding.
465. Run a small lookup before batching; honor provider limits and retain failures
47 separately from confirmed empty results.

Workflow

  1. Resolve the requested organism and entity to stable accessions. Review search hits before selecting one; gene symbols and compound names may be ambiguous.
  2. Inspect the service's actual response type, including pagination and errors. BioServices can return an integer-like HTTP error or None, not only raise.
  3. Preserve one-to-many mappings, failed identifiers, taxonomy, database release, query parameters, and retrieval date alongside derived tables.
  4. Distinguish annotations and inferred associations from experimental evidence. Pathway membership alone is not an enrichment analysis or causal finding.
  5. Run a small lookup before batching; honor provider limits and retain failures separately from confirmed empty results.
Raw lines 36 to 48
49## Protein search, sequence retrieval, and mapping
51```python
52from bioservices import UniProt
54u = UniProt(verbose=False)
55u.services.TIMEOUT = 30
56rows = u.search(
57 "gene_exact:ZAP70 AND organism_id:9606 AND reviewed:true",
58 frmt="tsv", columns="accession,gene_names,organism_name,length",
59 limit=5, size=5,
61if not isinstance(rows, str):
62 raise RuntimeError("UniProt search failed")
63print(rows)
64fasta = u.retrieve("P43403", frmt="fasta")
65record = u.retrieve("P43403", frmt="json")
67mapping = u.mapping(fr="UniProtKB_AC-ID", to="KEGG", query="P43403")
68if not isinstance(mapping, dict) or "results" not in mapping:
69 raise RuntimeError("Mapping incomplete or failed")
70kegg_ids = [row["to"] for row in mapping["results"] if row["from"] == "P43403"]
71print(kegg_ids, mapping.get("failedIds", []))
72```
74Use `frmt="tsv"`, not `"tab"`; current field names include `accession`,
75`gene_names`, `organism_name`, `protein_name`, `go_id`, and `xref_pdb`.
76`mapping()` returns a `results`/`failedIds` envelope, **not** a source-to-list
77dictionary. Mapping **to** UniProt uses `to="UniProtKB"` and returns full records
78in `row["to"]`; extract `primaryAccession`. `UniProtKB_AC-ID` is a source code.
79See [identifier mapping](references/identifier_mapping.md) for allowed pairs,
80normalization, and limits. For bounded searches set `size=limit` (at most 500);
811.16.0 mixes the two values in its pagination loop.

Protein search, sequence retrieval, and mapping

from bioservices import UniProt

u = UniProt(verbose=False)
u.services.TIMEOUT = 30
rows = u.search(
    "gene_exact:ZAP70 AND organism_id:9606 AND reviewed:true",
    frmt="tsv", columns="accession,gene_names,organism_name,length",
    limit=5, size=5,
)
if not isinstance(rows, str):
    raise RuntimeError("UniProt search failed")
print(rows)
fasta = u.retrieve("P43403", frmt="fasta")
record = u.retrieve("P43403", frmt="json")

mapping = u.mapping(fr="UniProtKB_AC-ID", to="KEGG", query="P43403")
if not isinstance(mapping, dict) or "results" not in mapping:
    raise RuntimeError("Mapping incomplete or failed")
kegg_ids = [row["to"] for row in mapping["results"] if row["from"] == "P43403"]
print(kegg_ids, mapping.get("failedIds", []))

Use frmt="tsv", not "tab"; current field names include accession, gene_names, organism_name, protein_name, go_id, and xref_pdb. mapping() returns a results/failedIds envelope, not a source-to-list dictionary. Mapping to UniProt uses to="UniProtKB" and returns full records in row["to"]; extract primaryAccession. UniProtKB_AC-ID is a source code. See identifier mapping for allowed pairs, normalization, and limits. For bounded searches set size=limit (at most 500); 1.16.0 mixes the two values in its pagination loop.

Raw lines 49 to 82
83## KEGG pathways and networks
85```python
86from bioservices import KEGG
88k = KEGG(verbose=False)
89k.services.url = "https://rest.kegg.jp"
90pathway_names = k.get_pathway_by_gene("7535", "hsa") # dict: pathway ID -> name
91print(pathway_names)
92kgml = k.parse_kgml_pathway("hsa04660")
93entries = {entry["id"]: entry for entry in kgml["entries"]}
94for relation in kgml["relations"][:5]:
95 print(entries[relation["entry1"]]["name"], relation["name"],
96 entries[relation["entry2"]]["name"])
97```
99The reviewed `/list/organism` endpoint returned HTTP 400 despite remaining in
100the manual. SDK methods that validate against that catalogue can fail. The
101bundled compound and pathway-list scripts use the documented scoped endpoints
102through `k.services.http_get` to avoid that unrelated catalogue dependency.
104KEGG `get` permits at most ten entries; KGML permits one pathway per request.
105Keep requests at or below three per second. `list`/`find` return TSV strings;
106`get` returns a flat-file string unless an option changes the representation.
107KGML entries include genes, compounds, groups, and maps. A relation can produce
108several subtype records; those counts are neither unique genes nor independent
109physical interactions. Entry IDs are local to each pathway. The bundled SIF
110export namespaces them as `pathway#entry` so combining pathways cannot merge
111unrelated nodes. `pathway2sif(..., uniprot=False)` is an optional lossy projection
112of gene-to-gene activation/inhibition, not a complete pathway network.

KEGG pathways and networks

from bioservices import KEGG

k = KEGG(verbose=False)
k.services.url = "https://rest.kegg.jp"
pathway_names = k.get_pathway_by_gene("7535", "hsa")  # dict: pathway ID -> name
print(pathway_names)
kgml = k.parse_kgml_pathway("hsa04660")
entries = {entry["id"]: entry for entry in kgml["entries"]}
for relation in kgml["relations"][:5]:
    print(entries[relation["entry1"]]["name"], relation["name"],
          entries[relation["entry2"]]["name"])

The reviewed /list/organism endpoint returned HTTP 400 despite remaining in the manual. SDK methods that validate against that catalogue can fail. The bundled compound and pathway-list scripts use the documented scoped endpoints through k.services.http_get to avoid that unrelated catalogue dependency.

KEGG get permits at most ten entries; KGML permits one pathway per request. Keep requests at or below three per second. list/find return TSV strings; get returns a flat-file string unless an option changes the representation. KGML entries include genes, compounds, groups, and maps. A relation can produce several subtype records; those counts are neither unique genes nor independent physical interactions. Entry IDs are local to each pathway. The bundled SIF export namespaces them as pathway#entry so combining pathways cannot merge unrelated nodes. pathway2sif(..., uniprot=False) is an optional lossy projection of gene-to-gene activation/inhibition, not a complete pathway network.

Raw lines 83 to 113
114## Compound cross-references
116```python
117from bioservices import UniChem
119uc = UniChem(verbose=False)
120response = uc.get_compounds("CHEBI:15365", "chebi") # aspirin
121if not isinstance(response, dict) or "compounds" not in response:
122 raise RuntimeError("UniChem request failed")
123chembl_ids = sorted({source["compoundId"]
124 for match in response["compounds"] for source in match.get("sources", [])
125 if source.get("shortName") == "chembl"})
126print(chembl_ids)
127```
129UniChem 2 uses `POST /api/v1/compounds` with a JSON body; BioServices assembles it.
130Discover source names through `uc.source_ids`; KEGG is absent at review. From a
131KEGG compound, preserve every ChEBI cross-reference and use only a uniquely
132resolved, structurally reviewed candidate. Check charge, stereochemistry, salts,
133and parent forms before merging data. Multiple unresolved name hits or mappings remain
134unresolved in the bundled compound script. Empty results do not prove absence.

Compound cross-references

from bioservices import UniChem

uc = UniChem(verbose=False)
response = uc.get_compounds("CHEBI:15365", "chebi")  # aspirin
if not isinstance(response, dict) or "compounds" not in response:
    raise RuntimeError("UniChem request failed")
chembl_ids = sorted({source["compoundId"]
    for match in response["compounds"] for source in match.get("sources", [])
    if source.get("shortName") == "chembl"})
print(chembl_ids)

UniChem 2 uses POST /api/v1/compounds with a JSON body; BioServices assembles it. Discover source names through uc.source_ids; KEGG is absent at review. From a KEGG compound, preserve every ChEBI cross-reference and use only a uniquely resolved, structurally reviewed candidate. Check charge, stereochemistry, salts, and parent forms before merging data. Multiple unresolved name hits or mappings remain unresolved in the bundled compound script. Empty results do not prove absence.

Raw lines 114 to 135
136## QuickGO annotations
138```python
139from bioservices import QuickGO
141g = QuickGO(verbose=False)
142terms = g.get_go_terms("GO:0003824") # list of term dictionaries
143page = g.Annotation(geneProductId="UniProtKB:P43403", includeFields="goName",
144 limit=100, page=1)
145if not isinstance(page, dict) or "results" not in page:
146 raise RuntimeError("QuickGO request failed")
147for annotation in page["results"][:5]:
148 print(annotation["goId"], annotation["goName"], annotation["goAspect"])
149print(page["pageInfo"]) # current, total, resultsPerPage
150```
152`Term`, `Annotation(protein=..., format="tsv")`, and fixed TSV column offsets
153belong to the old API. Fetch pages 1 through `pageInfo.total`; the SDK permits
1541–100 rows per page. Preserve qualifiers, evidence codes, references and taxon.
155The protein script summarizes distinct positive terms and excludes `NOT`
156assertions; its summary is not a raw annotation export or an enrichment test.

QuickGO annotations

from bioservices import QuickGO

g = QuickGO(verbose=False)
terms = g.get_go_terms("GO:0003824")  # list of term dictionaries
page = g.Annotation(geneProductId="UniProtKB:P43403", includeFields="goName",
                    limit=100, page=1)
if not isinstance(page, dict) or "results" not in page:
    raise RuntimeError("QuickGO request failed")
for annotation in page["results"][:5]:
    print(annotation["goId"], annotation["goName"], annotation["goAspect"])
print(page["pageInfo"])  # current, total, resultsPerPage

Term, Annotation(protein=..., format="tsv"), and fixed TSV column offsets belong to the old API. Fetch pages 1 through pageInfo.total; the SDK permits 1–100 rows per page. Preserve qualifiers, evidence codes, references and taxon. The protein script summarizes distinct positive terms and excludes NOT assertions; its summary is not a raw annotation export or an enrichment test.

Raw lines 136 to 157
158## Sequence similarity and associations
160`NCBIblast` wraps **EMBL-EBI Job Dispatcher**, not NCBI's BLAST URL API.
161The SDK's current methods are `get_status`, `get_result`, `get_result_types`,
162and `get_parameter_details`. Contact email is required by EMBL-EBI; this skill's
163`NCBI_EMAIL` variable is a local convention, not automatically read by the SDK.
164The submission example is illustrative; no live BLAST job was submitted in review.
166```python
167import os
168from bioservices import NCBIblast
170blast = NCBIblast(verbose=False)
171blast.services.url = "https://www.ebi.ac.uk/Tools/services/rest/ncbiblast"
172# protein_sequence must contain the actual query sequence.
173job_id = blast.run(program="blastp", sequence=protein_sequence, stype="protein",
174 database="uniprotkb", email=os.environ["NCBI_EMAIL"])
175status = blast.get_status(job_id)
176if status == "FINISHED":
177 result_types = blast.get_result_types(job_id)
178 report = blast.get_result(job_id, "out")
179```
181Poll with a delay and deadline. Stop on `FAILURE`, `ERROR`, or `NOT_FOUND`;
182only retrieve completed jobs. Retain the job ID when a local wait times out.
183Use the bundled script's bounded polling rather than an unbounded loop.
185`PSICQUIC` is absent from 1.16.0. Use `STRING.get_interaction_partners` for
186scored associations and provide the verified taxonomy ID; this is a different
187evidence source, not an equivalent PSICQUIC replacement. STRING's default
188functional edges can be indirect and do not establish physical binding.

Sequence similarity and associations

NCBIblast wraps EMBL-EBI Job Dispatcher, not NCBI's BLAST URL API. The SDK's current methods are get_status, get_result, get_result_types, and get_parameter_details. Contact email is required by EMBL-EBI; this skill's NCBI_EMAIL variable is a local convention, not automatically read by the SDK. The submission example is illustrative; no live BLAST job was submitted in review.

import os
from bioservices import NCBIblast

blast = NCBIblast(verbose=False)
blast.services.url = "https://www.ebi.ac.uk/Tools/services/rest/ncbiblast"
# protein_sequence must contain the actual query sequence.
job_id = blast.run(program="blastp", sequence=protein_sequence, stype="protein",
                   database="uniprotkb", email=os.environ["NCBI_EMAIL"])
status = blast.get_status(job_id)
if status == "FINISHED":
    result_types = blast.get_result_types(job_id)
    report = blast.get_result(job_id, "out")

Poll with a delay and deadline. Stop on FAILURE, ERROR, or NOT_FOUND; only retrieve completed jobs. Retain the job ID when a local wait times out. Use the bundled script's bounded polling rather than an unbounded loop.

PSICQUIC is absent from 1.16.0. Use STRING.get_interaction_partners for scored associations and provide the verified taxonomy ID; this is a different evidence source, not an equivalent PSICQUIC replacement. STRING's default functional edges can be indirect and do not establish physical binding.

Raw lines 158 to 189
190## Bundled workflows
192Run from this skill directory after installation:
194```bash
195python scripts/protein_analysis_workflow.py P43403 --skip-blast
196python scripts/pathway_analysis.py hsa output_directory/ --limit 2
197python scripts/compound_cross_reference.py Geldanamycin
198python scripts/batch_id_converter.py input_ids.txt --from UniProtKB_AC-ID --to KEGG
199python scripts/batch_id_converter.py --list-databases
200```
202- [Protein analysis](scripts/protein_analysis_workflow.py): UniProt, optional
203 BLAST, all mapped KEGG genes, STRING associations, paginated QuickGO terms.
204 Prefer a stable accession; free-text searches display and use the first hit.
205- [Pathway analysis](scripts/pathway_analysis.py): KGML entry/subtype counts and
206 CSV/SIF exports. Missing KGML is reported and skipped.
207- [Compound lookup](scripts/compound_cross_reference.py): unique exact KEGG name match (or sole hit),
208 all ChEBI candidates, guarded UniChem mapping, ChEBI/ChEMBL properties.
209- [Batch converter](scripts/batch_id_converter.py): preserves multiple targets;
210 CSV distinguishes `Success`, explicit `Unmapped`, and request/incomplete `Failed`.
212See [workflow patterns](references/workflow_patterns.md) for integration examples.
213Network smoke tests covered the public core lookups; unit tests use current
214response fixtures. Genome-scale downloads, paid/authenticated resources, and
215live BLAST submissions were not tested. Service availability is not guaranteed.

Bundled workflows

Run from this skill directory after installation:

python scripts/protein_analysis_workflow.py P43403 --skip-blast
python scripts/pathway_analysis.py hsa output_directory/ --limit 2
python scripts/compound_cross_reference.py Geldanamycin
python scripts/batch_id_converter.py input_ids.txt --from UniProtKB_AC-ID --to KEGG
python scripts/batch_id_converter.py --list-databases
  • Protein analysis: UniProt, optional BLAST, all mapped KEGG genes, STRING associations, paginated QuickGO terms. Prefer a stable accession; free-text searches display and use the first hit.
  • Pathway analysis: KGML entry/subtype counts and CSV/SIF exports. Missing KGML is reported and skipped.
  • Compound lookup: unique exact KEGG name match (or sole hit), all ChEBI candidates, guarded UniChem mapping, ChEBI/ChEMBL properties.
  • Batch converter: preserves multiple targets; CSV distinguishes Success, explicit Unmapped, and request/incomplete Failed.

See workflow patterns for integration examples. Network smoke tests covered the public core lookups; unit tests use current response fixtures. Genome-scale downloads, paid/authenticated resources, and live BLAST submissions were not tested. Service availability is not guaranteed.

Raw lines 190 to 216
Runs code python scripts/protein_analysis_workflow.py :195
Runs code python scripts/pathway_analysis.py :196
Runs code python scripts/compound_cross_reference.py :197
Runs code python scripts/batch_id_converter.py :198
Reads a file scripts/pathway_analysis.py :205
217## Sources and service limits
219Current signatures were checked against the [1.16.0 SDK documentation](https://bioservices.readthedocs.io/en/main/references.html)
220and installed source. Provider contracts: [UniProt mapping fields](https://rest.uniprot.org/configure/idmapping/fields),
221[KEGG API](https://www.kegg.jp/kegg/rest/keggapi.html),
222[QuickGO API](https://www.ebi.ac.uk/QuickGO/api/index.html),
223[Job Dispatcher](https://www.ebi.ac.uk/jdispatcher/docs/webservices/),
224[STRING API](https://string-db.org/help/api/).
225Configure timeouts on the actual transport, e.g. `k.services.TIMEOUT = 30`;
226`k.TIMEOUT = 30` merely creates an unused attribute on many wrapper classes.
227Use `cache=True` in supported constructors; `CACHE`/`DELAY` are not uniform
228BioServices controls. STRING 1.16.0 issues direct requests without the transport's
229timeout or rate limiter; bound large workflows externally and use provider
230bulk downloads when appropriate.

Sources and service limits

Current signatures were checked against the 1.16.0 SDK documentation and installed source. Provider contracts: UniProt mapping fields, KEGG API, QuickGO API, Job Dispatcher, STRING API. Configure timeouts on the actual transport, e.g. k.services.TIMEOUT = 30; k.TIMEOUT = 30 merely creates an unused attribute on many wrapper classes. Use cache=True in supported constructors; CACHE/DELAY are not uniform BioServices controls. STRING 1.16.0 issues direct requests without the transport's timeout or rate limiter; bound large workflows externally and use provider bulk downloads when appropriate.

Raw lines 217 to 231
Boilerplate, lines 232 to 247. The same text appears in 125 other files here. Close
232## Citing Scientific Agent Skills
234This skill is part of Scientific Agent Skills by K-Dense. If it materially contributed to a
235manuscript, report, presentation, or code release, add the paper to the references or
236software section and tell the user you did so:
238> Kassis, T., Agarwal, V., He, Y., Patel, D., & Brueckner, A. M. (2026). Scientific Agent
239> Skills: A Library of Procedural Knowledge for Research Agents. arXiv:2609.00065.
240> https://doi.org/10.48550/arXiv.2609.00065
242Always cite the current version. The DOI and https://arxiv.org/abs/2609.00065 resolve to the
243latest arXiv version, so never append a version suffix such as `v1`. When network access is
244available, fetch https://arxiv.org/abs/2609.00065 (or
245http://export.arxiv.org/api/query?id_list=2609.00065) before writing the reference and take
246the author list, year, and version from that record. If the record lists a journal reference
247or publisher DOI, cite the published version instead.

From K-Dense-AI/scientific-agent-skills at 5f2bc03, 2026-10-26. Not read by a model yet. Summary and techniques by Claude Opus 5.5 on 2026-11-06.