Stage and load genomic ranges from disk.
Project description
Save and load genomic ranges objects to file
This package implements methods for saving and loading GenomicRanges
and GenomicRangesList
objects. It provides a language-agnostic method for serializing genomic coordinates in these objects, as well as data in related objects like sequence information. To get started, install the package from PyPI:
pip install dolomite-ranges
We can then save a GenomicRanges
to a file, preserving its metadata and mcols:
import os
from tempfile import mkdtemp
from dolomite_base import read_object, save_object
from genomicranges import GenomicRanges
from iranges import IRanges
import dolomite_ranges
gr = GenomicRanges(
seqnames=["chrA", "chrB", "chrC"],
ranges=IRanges([10, 30, 2200], [20, 50, 30]),
strand=["*", "+", "-"],
)
dir = os.path.join(mkdtemp(), "granges")
save_object(gr, dir)
roundtrip = read_object(dir)
Similarly save and load a GenomicRangesList
to a file,
import os
from tempfile import mkdtemp
from dolomite_base import read_object, save_object
from genomicranges import GenomicRanges, SeqInfo
from iranges import IRanges
import dolomite_ranges
a = GenomicRanges(
seqnames=["chr1", "chr2", "chr1", "chr3"],
ranges=IRanges([1, 3, 2, 4], [10, 30, 50, 60]),
strand=["-", "+", "*", "+"],
mcols=BiocFrame({"score": [1, 2, 3, 4]}),
)
b = GenomicRanges(
seqnames=["chr2", "chr4", "chr5"],
ranges=IRanges([3, 6, 4], [30, 50, 60]),
strand=["-", "+", "*"],
mcols=BiocFrame({"score": [2, 3, 4]}),
)
grl = GenomicRangesList(ranges=[a, b], names=["a", "b"])
dir = os.path.join(mkdtemp(), "granges_list")
save_object(gr, dir)
roundtrip = read_object(dir)
Note
This project has been set up using PyScaffold 4.5. For details and usage information on PyScaffold see https://pyscaffold.org/.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file dolomite-ranges-0.0.1a2.tar.gz
.
File metadata
- Download URL: dolomite-ranges-0.0.1a2.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c5264b6708af9307f2491cc471584ec1cbc740b2a64edff45d42eed1b0479ebb |
|
MD5 | 3808bbaaedd821056eca5379fd1953c5 |
|
BLAKE2b-256 | 27d69b7ac278ebf60c7ce0abcc2c14d72d7c1fc290a90c7e3f7c6b9b8d26b69b |
File details
Details for the file dolomite_ranges-0.0.1a2-py3-none-any.whl
.
File metadata
- Download URL: dolomite_ranges-0.0.1a2-py3-none-any.whl
- Upload date:
- Size: 9.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 445f1c52b9388e03b7fa88f60bee02f12bf33b3bd7c348394720bfa375a65d4b |
|
MD5 | eced7f26717ede52a7eab68c35fbe0e3 |
|
BLAKE2b-256 | 3eaf14cf1982c479fa5474c0109c02412d865ed7101ee628e65ca55b84778828 |