GenomicRanges
Python equivalent to Bioconductor's GenomicRanges to represent genomic locations and support genomic analysis. It uses efficient structures already available in the Python/Pandas/numpy eco-system adds an familiar interfaces.
Install
Package is deployed to PyPI
pip install genomicranges
Usage
The package provide several ways to represent genomic intervals
Pandas DataFrame
A common representation in Python is a pandas DataFrame for all tabular datasets. One can convert this into GenomicRanges.
Note: The DataFrame must contain columns seqname, start and end that represent chromosome and genomic coordinates.
from genomicranges import GenomicRanges
gr = GenomicRanges.fromPandas(<PANDAS DATA FRAME>)
From UCSC or GTF file
Methods are available to easily access UCSC genomes or load a genome annotation from GTF
from genomicranges import GenomicRanges
gr = GenomicRanges.fromGTF(<PATH TO GTF>)
# OR
gr = GenomicRanges.fromUCSC(genome="hg19")
Interval Operations
Currently supports Nearest Genomic positions operation in Bioconductor, but more coming soon.
subject = GenomicRanges.fromUCSC(genome="hg38")
query = GenomicRanges.fromPandas(
pd.DataFrame(
{
"seqnames": ["chr1", "chr2", "chr3"],
"starts": [100, 115, 119],
"ends": [103, 116, 120],
}
)
)
hits = subject.nearest(query)
print(hits)
For more use cases, checkout the documentation
Note
This project has been set up using PyScaffold 4.1.1. For details and usage information on PyScaffold see https://pyscaffold.org/.
Release files for genomicranges 0.1.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 | |
|---|---|---|---|
| GenomicRanges-0.1.1.tar.gz | 23.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| GenomicRanges-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.6 kB
Release files / GenomicRanges-0.1.1.tar.gz
| Download URL | GenomicRanges-0.1.1.tar.gz |
|---|---|
| Size | 23.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0c7d7dee1b5c56702d610f245f23c4bf79160769f00f76b794112fd1cc62d6d1
|
|
BLAKE2b-256 checksum How to use checksums |
fbc173d2c384b0610a85e7024ba57860f4053dcf882b721f75bd4bbc880d1b7a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / GenomicRanges-0.1.1-py3-none-any.whl
| Download URL | GenomicRanges-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
da75f2904909631d0751558dd0c7ffadba8be4365fdbfed3edc6dce8580ab817
|
|
BLAKE2b-256 checksum How to use checksums |
31298def5a85d78239bc4ece55984934faf89c0e0fa3afe7eddae7e83603d101
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|