PyEnsembl
PyEnsembl queries Ensembl genes, transcripts, exons and sequences from local indexes. It supports numbered releases, dated new-platform annotations and custom matched GTF/FASTA files.
Installation
Use Python 3.9 or later. Install the package and one explicit annotation:
python -m pip install pyensembl
pyensembl install --release 93 --species human
This selects human GRCh38 and downloads and indexes its annotation, transcript and peptide files. Setup takes several minutes and disk space; whole-genome DNA is optional. See installation and first lookup.
Example Usage
After installing the data above:
from pyensembl import EnsemblRelease
with EnsemblRelease(93, species="human") as data:
gene = data.gene_by_id("ENSG00000141510")
print(gene.name, gene.contig, gene.start, gene.end, gene.strand)
TP53 17 7661779 7687550 -
Coordinates are one-based and inclusive; TP53 is on the minus strand. Pin the release you analyze: coordinates, IDs and sequences can change between releases, and a gene name can match several loci. The documentation continues with transcript and protein sequences.
Documentation
The documentation home page includes installation and getting-started examples. Use these guides for other tasks:
| Task | Guide |
|---|---|
| Find genes by name, position or biotype | Genes and transcripts |
| Exons, coding sequences, UTRs and codon positions | Exons and coding sequences |
| Search additional gene names | Alias lookup |
| Read genomic DNA | Reference DNA |
| Choose an assembly, species and coverage | Assembly selection |
| Install from Python, check or delete data | Install and manage data |
| Use your own annotations | Custom genomes |
| Use dated Ensembl downloads | Dated annotations |
| Find a class or query method | API reference |
For contributions, see development setup,
documentation style and
releasing. Every PR includes a version bump, lint and
tests; maintainers merge through a PR and publish with ./deploy.sh from clean main.
Metadata
Release files for pyensembl 2.23.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyensembl-2.23.1.tar.gz | 175.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyensembl-2.23.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 270.2 kB
Release files / pyensembl-2.23.1.tar.gz
| Download URL | pyensembl-2.23.1.tar.gz |
|---|---|
| Size | 175.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
48946b1cd466c9501cab4d6f5b8d04d20726ebe04fc6e6ebd16ee6e6ce972a71
|
|
BLAKE2b-256 checksum How to use checksums |
26fc1728628114cf97b7710d59ad38d796d482d16ba1305075691e1495310ecb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.6
|
Release files / pyensembl-2.23.1-py3-none-any.whl
| Download URL | pyensembl-2.23.1-py3-none-any.whl |
|---|---|
| Size | 94.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
22f1e5b2ce8aa6a9ac67ea4412e6da4ae7093c0e6f1dea2cd79300ccd705fa4e
|
|
BLAKE2b-256 checksum How to use checksums |
69b8363a590ffe9bfd10151c4249fb4d29c55f5f8a6fe5f6eddae70b7929fc24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.6
|