TxDb
This package provides a Python interface to access and manipulate genome annotations, implemented in the Bioconductor GenomicFeatures package. It allows users to interact with TxDb SQLite databases to extract genomic features such as transcripts, exons, CDS, and promoters as GenomicRanges objects. It also includes a registry system to easily download and cache standard TxDb annotation files.
Install
To get started, install the package from PyPI
pip install txdb
Usage
Using TxDbRegistry
The TxDbRegistry provides easy access to hosted TxDb databases in AnnotationHub.
from txdb import TxDbRegistry
# Initialize registry
registry = TxDbRegistry()
# List available databases
print(registry.list_txdb())
# Load a specific database (downloads and caches it automatically)
# Example: hg38 knownGene
txdb = registry.load_db("TxDb.Hsapiens.UCSC.hg38.knownGene")
# Access features
transcripts = txdb.transcripts()
print(transcripts)
## OUTPUT
GenomicRanges with 412044 ranges and 3 metadata columns
seqnames ranges strand _tx_id tx_name tx_type
<str> <IRanges> <ndarray[int8]> <list> <list> <list>
[0] chr1 11121 - 14413 + | 1 ENST00000832824.1 None
[1] chr1 11125 - 14405 + | 2 ENST00000832825.1 None
[2] chr1 11410 - 14413 + | 3 ENST00000832826.1 None
... ... ... | ... ... ...
[412041] chrX_MU273397v1_alt 314193 - 316302 - | 412042 ENST00000710030.1 None
[412042] chrX_MU273397v1_alt 314813 - 315236 - | 412043 ENST00000710216.1 None
[412043] chrX_MU273397v1_alt 324527 - 324923 - | 412044 ENST00000710031.1 None
------
seqinfo(711 sequences): chr1 chr2 chr3 ... chrX_MU273395v1_alt chrX_MU273396v1_alt chrX_MU273397v1_alt
Using a Local TxDb File
If you have a local SQLite file (e.g., generated from R), you can load it directly.
from txdb import TxDb
txdb = TxDb("path/to/custom_txdb.sqlite")
# Extract exons
exons = txdb.exons()
# Extract promoters (2kb upstream)
promoters = txdb.promoters(upstream=2000, downstream=200)
# Filter for a specific chromosome
chr1_tx = txdb.transcripts(filter={"tx_chrom": "chr1"})
Check out the documentation for all supported extractors from TxDB files.
Note
This project has been set up using BiocSetup and PyScaffold.
Release files for txdb 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| txdb-0.1.0.tar.gz | 21.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| txdb-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.0 kB
Release files / txdb-0.1.0.tar.gz
| Download URL | txdb-0.1.0.tar.gz |
|---|---|
| Size | 21.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2581d7668a314bef2bfd29544f01808710231a9e0baf59662b6ff6a8ee2b6b3a
|
|
BLAKE2b-256 checksum How to use checksums |
a413efe95c88f0302a95ff29995a922b3c32346a09e5e5e3610ae2832ba77c5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.
Transparency logRelease files / txdb-0.1.0-py3-none-any.whl
| Download URL | txdb-0.1.0-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c49aeece9ccac272ee179e9d12a1464599ddc7de683fe907a9a47fb49b4b20a4
|
|
BLAKE2b-256 checksum How to use checksums |
0e65af682279580c509d69bcecada34ad675e254fd0757e0ef285046cb7c3efd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.
Transparency log