Python interface to access and manipulate genome annotations in TxDB SQLite format.
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file txdb-0.0.4.tar.gz.
File metadata
- Download URL: txdb-0.0.4.tar.gz
- Upload date:
- Size: 29.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a3c587065cfcdea3cd80742b91cc64641aa7611331e20fcc92e7d060fffb7c1
|
|
| MD5 |
d368e0d3e2b26474d1de68c1dce23547
|
|
| BLAKE2b-256 |
63cb0df59a9bad94998ad3e134a81e03fc40b80519be3bf259871f579e61d759
|
Provenance
The following attestation bundles were made for txdb-0.0.4.tar.gz:
Publisher:
publish-pypi.yml on BiocPy/txdb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
txdb-0.0.4.tar.gz -
Subject digest:
9a3c587065cfcdea3cd80742b91cc64641aa7611331e20fcc92e7d060fffb7c1 - Sigstore transparency entry: 798873621
- Sigstore integration time:
-
Permalink:
BiocPy/txdb@061fd0fcd1e5ab1cf8f45ccf9988340ddd104c8d -
Branch / Tag:
refs/tags/0.0.4 - Owner: https://github.com/BiocPy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@061fd0fcd1e5ab1cf8f45ccf9988340ddd104c8d -
Trigger Event:
push
-
Statement type:
File details
Details for the file txdb-0.0.4-py3-none-any.whl.
File metadata
- Download URL: txdb-0.0.4-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8cd8508c869b7e812e86c21cb0910a67d913a633e4aabb92e29ff72a4e38e76
|
|
| MD5 |
325a7d938828bc003a7ed48e6b90d144
|
|
| BLAKE2b-256 |
508ab772502a98a76aeccaf0f9e9b2d26f30653f85e58d1f2cc9e3e7d3c1fa67
|
Provenance
The following attestation bundles were made for txdb-0.0.4-py3-none-any.whl:
Publisher:
publish-pypi.yml on BiocPy/txdb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
txdb-0.0.4-py3-none-any.whl -
Subject digest:
e8cd8508c869b7e812e86c21cb0910a67d913a633e4aabb92e29ff72a4e38e76 - Sigstore transparency entry: 798873623
- Sigstore integration time:
-
Permalink:
BiocPy/txdb@061fd0fcd1e5ab1cf8f45ccf9988340ddd104c8d -
Branch / Tag:
refs/tags/0.0.4 - Owner: https://github.com/BiocPy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@061fd0fcd1e5ab1cf8f45ccf9988340ddd104c8d -
Trigger Event:
push
-
Statement type: