Skip to main content

Dataset generation and peak calling for multi-modal Next-Generation Sequencing data

Project description

QuantNado

QuantNado provides efficient Zarr-backed storage and analysis of genomic signal from BAM and bigWig files, with support for signal reduction, feature counting, dimensionality reduction, and quantile-based peak calling.

CI PyPI Docs License: MIT Python


Installation

pip install quantnado

Requires Python 3.12 or 3.13.


Quick Start

Create a dataset from BAM files

from quantnado import QuantNado

qn = QuantNado.from_bam_files(
    bam_files=["sample1.bam", "sample2.bam", "sample3.bam"],
    store_path="dataset.zarr",
    metadata="samples.csv",  # optional
)

Load and analyse an existing dataset

from quantnado import QuantNado

qn = QuantNado.open("dataset.zarr")

# Aggregate signal over genomic ranges
promoter_signal = qn.reduce("promoters.bed", reduction="mean")
print(promoter_signal["mean"].shape)  # (n_promoters, n_samples)

# PCA on reduced signal
pca_obj, transformed = qn.pca(promoter_signal["mean"], n_components=10)
print(transformed.shape)  # (n_samples, 10)

# Generate a count matrix for DESeq2
counts, features = qn.feature_counts("genes.gtf", feature_type="gene")
counts.to_csv("counts.csv")

# Extract signal over a specific region
region = qn.extract_region("chr1:1000-5000")
print(region.shape)  # (n_samples, 4000)

Command-line Interface

QuantNado installs a quantnado command with two subcommands.

create-dataset — build a Zarr dataset from BAM files

quantnado create-dataset sample1.bam sample2.bam sample3.bam \
  --output dataset.zarr \
  --chromsizes hg38.chrom.sizes \
  --metadata samples.csv \
  --max-workers 8

call-peaks — call quantile-based peaks from bigWig files

quantnado call-peaks \
  --bigwig-dir path/to/bigwigs/ \
  --output-dir peaks/ \
  --chromsizes hg38.chrom.sizes \
  --quantile 0.98

Run quantnado --help or quantnado <subcommand> --help for full option listings.


API Reference

Full documentation is available at milne-group.github.io/QuantNado.

QuantNado

Method / Property Description
QuantNado.from_bam_files(bam_files, store_path, ...) Create a new dataset from BAM files
QuantNado.open(store_path, read_only=True) Open an existing dataset
.reduce(ranges, reduction="mean") Aggregate signal over genomic ranges (BED)
.feature_counts(gtf_file, feature_type="gene") Generate a DESeq2-compatible count matrix
.pca(data, n_components=10) Run PCA on a signal matrix
.extract_region(region) Extract raw signal for a genomic region
.to_xarray(chromosomes) Load dataset as lazy xarray DataArrays
.samples List of sample names
.metadata Sample metadata (DataFrame)
.chromosomes Available chromosome names
.chromsizes Chromosome sizes (dict)
.store_path Path to the underlying Zarr store

Requirements

Dependency Purpose
zarr, icechunk Zarr v3 storage backend
xarray, dask Lazy array operations
pandas, numpy Data structures
pysam, bamnado BAM file I/O
pyBigWig bigWig I/O
pyranges Genomic range operations
scikit-learn (via dask-ml) PCA
typer, loguru CLI and logging
ipykernel, jupyterlab, matplotlib Example notebook (pip install "quantnado[example]")

License

MIT — see LICENSE.

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

quantnado-0.4.0.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

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

quantnado-0.4.0-py3-none-any.whl (1.6 MB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for quantnado-0.4.0.tar.gz
Algorithm Hash digest
SHA256 4b5699c08906f92ba43b102c26b6336e094ddecea4dbbf011db4e1764397e56f
MD5 229a3cdb848361633703c2a8d3706f32
BLAKE2b-256 39101313dacd411abbabb4159b1eaa5dfc1de38993eb576869f964f3adc95508

See more details on using hashes here.

Provenance

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

Publisher: pypi.yml on Milne-Group/QuantNado

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

File details

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

File metadata

  • Download URL: quantnado-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for quantnado-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 860cce53754a4e07d1fee7aac6d94cfa6ddc16b2933a6f583bd805f0755a57b6
MD5 ecc9e17996cf58b61f74b870cfa3c262
BLAKE2b-256 ddc2f60d3aa788fbbfbf161839645f7f4fd361e3099284037a9326236b17b610

See more details on using hashes here.

Provenance

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

Publisher: pypi.yml on Milne-Group/QuantNado

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