Registry / devops / pybiomart

pybiomart

JSON →
library0.2.0pypypi✓ verified 86d ago

A simple pythonic interface to BioMart, providing easy querying of biological databases (e.g., Ensembl, HGNC) and retrieval of gene annotations, transcripts, etc. Current version 0.2.0 is stable but low activity; no breaking changes since release.

pip install pybiomart
INSTALL
IMPORT
SIG · PYBIOMART
P
pybiomart
devopspythonv0.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Dataset
from pybiomart import Dataset

Query Ensembl for human gene IDs and gene names.

from pybiomart import Dataset dataset = Dataset(name='hsapiens_gene_ensembl', host='http://www.ensembl.org') results = dataset.query(attributes=['ensembl_gene_id', 'external_gene_name']) print(results.head())
Debug
Known issues
gotchaDataset name and host are case-sensitive; common mistake is 'hsapiens_gene_Ensembl' (capital E) which fails silently.
fix
Use exact case as in BioMart: e.g., 'hsapiens_gene_ensembl' and host 'http://www.ensembl.org' (note: http, not https).
affects: all
gotchaThe default host uses http, which may cause SSL errors or redirects in some environments; using https may break the API.
fix
Explicitly set host='http://www.ensembl.org' to avoid connection issues.
affects: all
gotchaQuerying with many attributes or large result sets can be slow; no pagination support.
fix
Limit attributes to necessary ones and consider splitting large queries.
affects: all
Errors
Common errors & fixes
requests.exceptions.ConnectionError: HTTPSConnectionPool
Using https host instead of http; pybiomart backend may not support https.
fix
Use host='http://www.ensembl.org' (note: http, no 's').
ValueError: Dataset name not found
Incorrect dataset name or host (e.g., typo, wrong case, or host not pointing to a valid BioMart registry).
fix
Check exact dataset name from BioMart website (e.g., 'hsapiens_gene_ensembl') and host (e.g., 'http://www.ensembl.org').
AttributeError: 'Dataset' object has no attribute 'query'
Often due to import error: importing 'pybiomart' directly instead of 'Dataset' class.
fix
Use from pybiomart import Dataset
Upgrade
Version history
0.2.0latest on PyPI · released May 10, 2017
Audit
Dependencies
pandasrequiredRequired for returning query results as DataFrames
requestsrequiredHTTP library for API calls
Agent activity
2 hits · last 30 days
node
2
Resources
pybiomart — pip install pybiomart · libregistry