Skip to main content

Stage and load genomic ranges from disk.

Project description

Project generated with PyScaffold PyPI-Server Unit tests

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dolomite_ranges-0.4.0.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dolomite_ranges-0.4.0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file dolomite_ranges-0.4.0.tar.gz.

File metadata

  • Download URL: dolomite_ranges-0.4.0.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for dolomite_ranges-0.4.0.tar.gz
Algorithm Hash digest
SHA256 9570d989aa311aba505fc23b25a3bf672c90d0c9484f72d0cfa68f277e8356cf
MD5 624d21d549cd3e28d97e1ce0e08e7183
BLAKE2b-256 9c3deac502662e8a83f711a028d5a39a7eb8a6cda9eb0784f9480fcff4ac348c

See more details on using hashes here.

Provenance

The following attestation bundles were made for dolomite_ranges-0.4.0.tar.gz:

Publisher: publish-pypi.yml on ArtifactDB/dolomite-ranges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file dolomite_ranges-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dolomite_ranges-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 70158f1ae43ef99b38e08e2f850c4c655a5d39195dfecf9bf9b7aa8ebf406e4b
MD5 92f640f7c16a0d80d0e090dab3ff7c7f
BLAKE2b-256 4c76e20d437e46859e77023a1983b76c4aafb2815272b7fc1f32eccc43418690

See more details on using hashes here.

Provenance

The following attestation bundles were made for dolomite_ranges-0.4.0-py3-none-any.whl:

Publisher: publish-pypi.yml on ArtifactDB/dolomite-ranges

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page