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.3.3.tar.gz (968.6 kB view details)

Uploaded Source

Built Distribution

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

quantnado-0.3.3-py3-none-any.whl (981.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for quantnado-0.3.3.tar.gz
Algorithm Hash digest
SHA256 3940e1a816510f0705daa4e5888878e73e153cd62cc2190c959241b54e573dba
MD5 bd000842b0a36d898e5bd30fbd1861d6
BLAKE2b-256 6e59187e838b21026b852e818aae500eca61d6ba312c0a18f05d620bd3037ffd

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantnado-0.3.3.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.3.3-py3-none-any.whl.

File metadata

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

File hashes

Hashes for quantnado-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d82fddd208e0e9b3f6f757b4c237d39ae3b9556b853562c6caf1b89b8b3e90f7
MD5 d6f227afc0cece309ff19919265506a0
BLAKE2b-256 fee23cce7077fc9dcba78c2ce5c65b95575182241b5e56835075101fb37c8bb3

See more details on using hashes here.

Provenance

The following attestation bundles were made for quantnado-0.3.3-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