Skip to main content

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

Project description

QuantNado

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

CI PyPI Docs License: MIT Python

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.


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

Optional extras for deep learning-based peak calling:

pip install "quantnado[ml]"

Installs torch, modisco-lite, and crested.


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.2.tar.gz (437.0 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.2-py3-none-any.whl (384.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: quantnado-0.3.2.tar.gz
  • Upload date:
  • Size: 437.0 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.2.tar.gz
Algorithm Hash digest
SHA256 69ea121fd3604e58a7e97767ec7689e1a46c710982ca8c803c120f69b25f7a07
MD5 ee5ee2ea06d20cfafdc4c9e90bbbde8b
BLAKE2b-256 30991b96d600c7376763bf6a652acfc4e869fec9f3b57a9f6581faa923d05f2e

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: quantnado-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 384.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ee19d9db23e29b7ab0779ddd31a78d132e8996015ef3a4850fe8335b4905a43a
MD5 658d61a0108ce35b366b01b16e61a26d
BLAKE2b-256 cbd1e52c6d6c0fb509f546820e66455a3c8cd39c3a74658032a554bc2506d602

See more details on using hashes here.

Provenance

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