BIOSERVICES: access to biological web services programmatically
- Python_version_available:
BioServices is tested for Python 3.9, 3.10, 3.11, 3.12
- Contributions:
Please join https://github.com/cokelaer/bioservices
- Issues:
- How to cite:
Cokelaer et al. BioServices: a common Python package to access biological Web Services programmatically Bioinformatics (2013) 29 (24): 3241-3242
- Documentation:
Bioservices is a Python package that provides access to many Bioinformatics Web Services (e.g., UniProt) and a framework to easily implement Web Services wrappers (based on WSDL/SOAP or REST protocols).
The primary goal of BioServices is to use Python as a glue language to provide a programmatic access to several Bioinformatics Web Services. By doing so, elaboration of new applications that combine several of the wrapped Web Services is fostered.
One of the main philosophies of BioServices is to make use of the existing biological databases (not to re-invent new databases) and to alleviate the need for expertise in Web Services for developers and users.
BioServices provides access to about 40 Web Services.
Installation
Install the latest stable release from PyPI:
pip install bioservices
or from conda-forge:
conda install conda-forge::bioservices
Contributors
Maintaining BioServices would not have been possible without users and contributors. Each contribution has been an encouragement to pursue this project. Thanks to all:
Quick example
Here is a small example using the UniProt Web Service to search for the zap70 specy in human organism:
>>> from bioservices import UniProt
>>> u = UniProt(verbose=False)
>>> data = u.search("zap70+and+taxonomy_id:9606", frmt="tsv", limit=3,
... columns="id,length,accession, gene_names")
>>> print(data)
Entry name Length Entry Gene names
ZAP70_HUMAN 619 P43403 ZAP70 SRK
B4E0E2_HUMAN 185 B4E0E2
RHOH_HUMAN 191 Q15669 RHOH ARHH TTF
Note
major changes of UniProt API changed all columns names in June 2022. The code above is valid for bioservices versions >1.10. Earlier version used:
>>> data = u.search("zap70+and+taxonomy:9606", frmt="tab", limit=3,
... columns="entry name,length,id, genes")
Note that columns names have changed, the frmt was changed from tab to tsv and taxonomy is now taxonomy_id. Names correspondences can be found in:
u._legacy_names
More examples and tutorials are available in the On-line documentation
Command-Line Interface
BioServices also ships a bioservices command-line tool for quick lookups
without writing any Python code:
$ bioservices --help
Four top-level commands are available:
gene — query gene data (info, name, ontology, expression, pathway, ortholog, id mapping)
protein — query protein data (search, sequence, structure, annotation, interaction, id mapping)
taxonomy — retrieve taxonomic information for a taxon ID
download-accession — download FASTA (and optionally GFF3/GenBank) for a sequence accession
Examples:
$ bioservices gene info --gene-id 1017
$ bioservices gene name --symbol BRAF
$ bioservices protein search --query ZAP70 --organism human
$ bioservices protein structure --uniprot-id P43403
$ bioservices taxonomy --id 9606
$ bioservices download-accession --accession FN433596.1
Full CLI reference: CLI documentation
Notebooks
The following Jupyter notebooks provide worked examples for many of the services. They can be viewed directly on nbviewer or downloaded and run locally.
Notebook |
Description |
|---|---|
Introduction and overview of BioServices |
|
Searching and retrieving data from UniProt |
|
Accessing BioModels database |
|
Drug and compound data from ChEMBL |
|
NCBI Entrez utilities cookbook (ESearch, EFetch, EPost, ELink) |
|
EUtils quick example (ESummary and ESearch) |
|
KEGG pathways and databases |
|
Multiple sequence alignment with MUSCLE |
|
Running BLAST searches via NCBI |
|
WikiPathways data access |
|
Mapping gene identifiers across databases |
|
Querying BioMart data warehouses |
|
Ensembl genome browser REST API |
|
Protein families and domains from InterPro |
|
European Nucleotide Archive |
|
Integrated multi-service drug discovery workflow |
Current services
Here is the list of services available and their testing status.
Note
Contributions to implement new wrappers are more than welcome. See BioServices github page to join the development, and the Developer guide on how to implement new wrappers.
Bioservices command
In version 1.8.2, we included a bioservices command. For now it has only one subcommand to download a NCBI accession number and possibly it genbank or GFF file (if available):
bioservices download-accession --accession K01711.1 --with-gbk
Changelog
Version |
Description |
|---|---|
1.16.0 |
|
1.15.0 |
|
1.14.0 |
|
1.13.0 |
|
1.12.2 |
|
1.11.0 |
|
1.10.3 |
|
1.10.1 |
|
1.10.0 |
|
1.9.0 |
|
1.8.3 |
|
1.8.0 |
|
1.7.12 |
|
1.7.5 |
|
1.7.4 |
|
1.7.0 |
|
1.6.0 |
|
1.5.2 |
|
1.5.0 |
|
1.4.8 |
|
1.4.6 |
|
1.4.4 |
|
1.4.1 |
|
1.4.0 |
|
1.3.5 |
|
1.3.4 |
|
1.3.3 |
|
1.3.1 |
|
1.3.0 |
|
1.2.3 |
|
1.2.0 |
|
1.1.2 |
|
1.1.1 |
|
1.1.0 |
|
1.0.4 |
|
1.0.0 |
|
0.9.0 |
|
Warning
Some of the services may be down. BioServices developers are not responsible for the maintenance or failure of underlying services. Generally speaking (and by experience) the services are up most of the time but failure may occur because the site is under maintenance or too many requests have been sent. Another common reason is the fact that the API of the web services has changed: If so, BioServices need to be updated. You may contribute or report such API changes on our Issue page
Installation
BioServices is available on PyPi, the Python package repository. The following command should install BioServices and its dependencies automatically provided you have pip on your system:
pip install bioservices
If not, please see the external pip installation page or pip installation entry. You may also find information in the troubleshootings page section about known issues.
Regarding the dependencies, BioServices depends on the following packages: BeautifulSoup4 (for parsing XML), requests (for REST services) and easydev. All those packages should be installed automatically when using pip installer. BioServices also makes use of pandas and matplotlib to offer some extra functionalities.
User guide
- 1. Quick Start
- 2. Tutorials
- 3. Command-Line Interface
- 4. Combining BioServices with external tools
- 5. Developer Guide
- 6. Gallery
- 7. NoteBooks
- 8. Services
- 8.1. ArrayExpress
- 8.2. Biocontainers
- 8.3. BiGG
- 8.4. BioDBnet
- 8.5. BioMart
- 8.6. BioModels
- 8.7. ChEBI
- 8.8. ChEMBL
- 8.9. COG
- 8.10. ENA
- 8.11. Ensembl
- 8.12. EVA
- 8.13. EUtils
- 8.14. GEO (NCBI Gene Expression Omnibus)
- 8.15. GeneProf
- 8.16. QuickGO
- 8.17. Kegg
- 8.18. HGNC
- 8.19. Intact (complex)
- 8.20. InterPro
- 8.21. MUSCLE
- 8.22. MyGeneInfo
- 8.23. NCBIblast
- 8.24. NCBIBlastAPI
- 8.25. OmniPath Commons
- 8.26. Panther
- 8.27. Pathway Commons
- 8.28. PDB/PDBe modules
- 8.29. PRIDE module
- 8.30. Pfam
- 8.31. PubChem
- 8.32. Rhea
- 8.33. Reactome
- 8.34. Readseq
- 8.35. STRING
- 8.36. UniChem
- 8.37. UniProt
- 8.38. DBFetch
- 8.39. Wikipathway
- 9. Applications and extra tools
- 10. References to BioServices on the Web
- 11. Scientific Literature
- 12. Help & Credits