Skip to main content

Rigel

Bayesian RNA-seq quantification of annotated transcripts, nascent RNA and genomic DNA in one model

CI PyPI Bioconda Python License


Overview

Rigel Overview

Rigel quantifies RNA-seq alignments while explicitly modeling three sources of signal in the same library:

  • RNA from the annotated transcripts (every reference transcript, single-exon included)
  • Nascent RNA: RNA that has not spliced, over the span of a multi-exon gene
  • Genomic DNA contamination (gDNA)

A single-pass native BAM scan feeds a calibration stage that separates RNA from gDNA genome-wide, and a locus-level EM then assigns the RNA to transcripts. Nascent RNA is represented as one synthetic span per merged span — transcripts whose start and end sites each lie within --end-tolerance on one strand — shared by every transcript in it, so isoforms that start and end at about the same coordinates do not multiply nascent states.

Key features

  • Joint quantification of annotated transcripts, nascent RNA and gDNA in one locus-level model
  • Single-pass C++ BAM scanner using htslib, with memory-bounded buffering and spill-to-disk support
  • Automatic strand-model training from annotated spliced fragments; protocol auto-detection (R1-sense / R1-antisense)
  • gDNA/RNA calibration that solves each genomic region's unspliced mass into sense RNA, antisense RNA and gDNA, with a gDNA-density prior fitted from the library itself
  • Calibrated per-locus gDNA priors feeding the EM
  • MAP-EM and Variational Bayes EM (VBEM, default) solver modes with SQUAREM acceleration
  • Post-EM assignment: sample (default: whole counts, each fragment to one transcript or gDNA) or fractional (posterior weights)
  • Parallel BAM scanning and parallel locus EM controlled through one --threads setting
  • Feather and TSV outputs plus optional annotated BAM output with per-fragment assignment tags

Installation

Bioconda

conda install -c conda-forge -c bioconda rigel

PyPI

pip install rigel-rnaseq

# with the optional HTML QC report ('rigel report'):
pip install 'rigel-rnaseq[report]'

The PyPI package name is rigel-rnaseq because rigel is already taken on PyPI. The import name and CLI stay rigel.

The [report] extra pulls in vl-convert-python (on conda: conda install -c conda-forge vl-convert-python); without it rigel report still builds a report, with every chart omitted.

From source

git clone https://github.com/mkiyer/rigel.git
cd rigel

mamba env create -f mamba_env.yaml
conda activate rigel

pip install --no-build-isolation -e .

Requirements

  • Python 3.12+
  • Wheels are published for Linux (x86_64 and aarch64, manylinux_2_28) and macOS 15+ on Apple silicon; anywhere else pip builds from source, which needs a C++17-capable compiler, CMake ≥ 3.15, pkg-config and htslib (mamba_env.yaml installs all of them)
  • Runtime dependencies (from pyproject.toml): pysam>=0.22, numpy>=1.26, pandas>=2.1, pyarrow>=14.0, pyyaml>=6.0, scipy>=1.12

On macOS, install Xcode Command Line Tools first:

xcode-select --install

Quick start

1. Build an index

samtools faidx genome.fa          # the FASTA needs a .fai index
rigel index \
    --fasta genome.fa \
    --gtf annotation.gtf \
    --no-mappability \
    -o index/

rigel index requires either --alignable-zarr PATH (the store the companion alignable tool builds for the same genome and aligner, whose unobservable regions Rigel reads; recommended for real genomes) or --no-mappability to opt out explicitly, when the reference's N runs are its unobservable regions.

2. Quantify a BAM

rigel quant \
    --bam sample.bam \
    --index index/ \
    -o results/ \
    --tsv

Input BAM requirements:

  • Paired-end (the scan stops at the first unpaired record)
  • Name-sorted or collated
  • A read pair's multiplicity is its usable alignments; NH is read only to find a truncated output
  • For a stranded library, a splice-junction strand tag: XS (HISAT2, or STAR with --outSAMstrandField intronMotif) or ts (minimap2). Without one no junction trains the strand model and the library is quantified as unstranded; --sj-strand-tag auto reads whichever tag each spliced record carries
  • With STAR, align with --sjdbScore 0 --outFilterMultimapScoreRange 2, so an unspliced reading competes with an annotated splice (the manual's input requirements say why)

3. Inspect outputs

Outputs are Feather files; --tsv above also writes .tsv mirrors (or convert afterward with rigel export results/ --format tsv).

head results/quant.tsv
head results/gene_quant.tsv
head results/nascent_quant.tsv
head results/loci.tsv
cat results/summary.json

4. Build a QC report (optional)

rigel report results/ -o results/report.html

Produces a single self-contained HTML QC file from the files rigel quant already wrote, so reports can be built later and in bulk. Its charts need the [report] extra (see Installation).

The five subcommands are index, quant, sim (a small synthetic scenario from a YAML file), export (Feather to TSV or Parquet) and report. rigel --version prints the version; rigel -v <subcommand> (--verbose) enables DEBUG-level logging. See docs/MANUAL.md for every flag.


Output files

File Description
quant.feather / quant.tsv Transcript-level abundance table (one row per annotated transcript; nascent RNA is in nascent_quant) with count, count_unambig, count_em, count_spliced, tpm, tpm_total_rna, effective lengths, and per-transcript QC columns
gene_quant.feather / gene_quant.tsv Gene-level aggregates derived from transcript estimates
nascent_quant.feather / nascent_quant.tsv Nascent RNA: one row per synthetic span Rigel adds to model the unspliced RNA of multi-exon transcripts (read overlapping spans per gene)
loci.feather / loci.tsv Per-locus EM summary
summary.json Library protocol, strand specificity, per-category fragment-length summary statistics, the calibration scalars, alignment counts, and global quantification totals
fragment_lengths.feather Raw per-bin fragment-length histograms, tidy (category, length, count)
calibration_track.feather / .bedgraph Per-region gDNA solution; the bedGraph is a genome-browser track (IGV / UCSC)
config.yaml Resolved run configuration (parameters, I/O paths). Rerun with rigel quant --config config.yaml
report.html Optional self-contained QC report, built by rigel report (see step 4)
locus_stats.feather Optional per-locus statistics, emitted only with --emit-locus-stats
--annotated-bam PATH Optional annotated BAM with per-fragment assignment tags (a second BAM pass); the same records as the input, collated

tpm is normalized over annotated transcripts only; tpm_total_rna normalizes over all RNA (annotated and nascent) and is comparable to nascent_quant's tpm_total_rna.


How it works

Rigel runs one native BAM pass feeding three stages: scan, calibrate, and quantify.

FASTA + GTF ──▶ rigel index ──▶ regions / boundaries partition + transcript tables
BAM ──▶ 1. scan       C++ single pass: resolve fragments, train the strand and fragment-length
                      models, buffer the ambiguous fragments, tally per-region/boundary mass
    ──▶ 2. calibrate  split each region's unspliced mass into sense RNA / antisense RNA / gDNA
                      (strand tilt + neighbour messages + a gDNA-density prior fitted from the
                      library) ──▶ two Dirichlet scalars per locus
    ──▶ 3. quantify   per-locus EM (VBEM or MAP-EM, SQUAREM, OpenMP across loci) with one
                      component per transcript row plus one gDNA component ──▶ counts, TPM

A spliced fragment is certified RNA, so calibration's problem is the unspliced mass. Its answer enters the EM as a prior that a decisive locus likelihood can override. The design and its rulings are in docs/DESIGN.md; the derivations are in docs/EQUATIONS.md.


Documentation

Document Description
docs/MANUAL.md The user manual: CLI reference, defaults, configuration rules, output schema
docs/DESIGN.md What is built, and the rulings behind it
docs/EQUATIONS.md The derivations the implementation depends on
docs/SUCCESS.md How performance is measured: the accumulator, then calibration against an oracle
docs/TESTING.md The benchmark panels, how to build them, and what the test suite can judge
docs/ROADMAP.md The ranked view of what is next for the 0.8.0 release
Issues Open problems, and what was refused (closed as not planned); the 0.8.0 milestone is what the release must fix or state
docs/TRAPS.md Mistakes already made, as named rules
docs/PUBLISHING.md Release workflow for PyPI and Bioconda

Citing Rigel

If you use Rigel in research, cite the repository for now:

Iyer MK. Rigel: Bayesian RNA-seq quantification with joint mRNA, nascent RNA, and genomic DNA modeling. 2026. https://github.com/mkiyer/rigel


License

Rigel is distributed under the GNU General Public License v3.0.


Development

conda activate rigel
pip install --no-build-isolation -e ".[dev]"   # rebuild after any src/rigel/native/ change
python -m pytest tests/ -q
ruff check src/ tests/ scripts/ && ruff format src/ tests/

Metadata

Release files for rigel-rnaseq 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rigel-rnaseq 0.8.0
File Size Uploaded Provenance Actions
rigel_rnaseq-0.8.0.tar.gz 1.8 MB With provenance Details for rigel_rnaseq-0.8.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for rigel-rnaseq 0.8.0
File Interpreter ABI Platform Actions
rigel_rnaseq-0.8.0-cp312-abi3-manylinux_2_28_x86_64.whl CPython 3.12 abi3 Linux glibc 2.28+ x86-64 Details for rigel_rnaseq-0.8.0-cp312-abi3-manylinux_2_28_x86_64.whl
rigel_rnaseq-0.8.0-cp312-abi3-manylinux_2_28_aarch64.whl CPython 3.12 abi3 Linux glibc 2.28+ ARM64 Details for rigel_rnaseq-0.8.0-cp312-abi3-manylinux_2_28_aarch64.whl
rigel_rnaseq-0.8.0-cp312-abi3-macosx_15_0_arm64.whl CPython 3.12 abi3 macOS 15.0+ ARM64 Details for rigel_rnaseq-0.8.0-cp312-abi3-macosx_15_0_arm64.whl

Total release size: 10.1 MB

Release files / rigel_rnaseq-0.8.0.tar.gz

Download URL rigel_rnaseq-0.8.0.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
f08e9a1eb081e1a5cca586d732497f11cc2d261614af6aef91d8f8a0a8be822e
BLAKE2b-256 checksum
How to use checksums
21f030f48c7ced9aafb1616c9fef6dbbcba89d31478a4cf48277df5e8e03ecec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / rigel_rnaseq-0.8.0-cp312-abi3-manylinux_2_28_x86_64.whl

Download URL rigel_rnaseq-0.8.0-cp312-abi3-manylinux_2_28_x86_64.whl
Size 3.4 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
845104cf4b95f14157cb5c5038ddda99f73fbba7c41e3a32b57dc4901c6a1236
BLAKE2b-256 checksum
How to use checksums
b6ef4d837a16aa0569cfe19bf6258b0978e1ef01ce3b26f287ada5e527333eff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / rigel_rnaseq-0.8.0-cp312-abi3-manylinux_2_28_aarch64.whl

Download URL rigel_rnaseq-0.8.0-cp312-abi3-manylinux_2_28_aarch64.whl
Size 3.2 MB
Tags CPython 3.12 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
e1b764cc8133be9fc23f16c20bbe77819408969c1cd136be101ba046273090f0
BLAKE2b-256 checksum
How to use checksums
d23656d3d37ee097450dea0c1afdb5ad4a8f72c336b072fd2a1ed0fe10cd85b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / rigel_rnaseq-0.8.0-cp312-abi3-macosx_15_0_arm64.whl

Download URL rigel_rnaseq-0.8.0-cp312-abi3-macosx_15_0_arm64.whl
Size 1.6 MB
Tags CPython 3.12 abi3 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
900613336fe310a68ec4a15c55a626f0cd1ece52d46444655c5fbab16bc172a0
BLAKE2b-256 checksum
How to use checksums
39c4b0d52ca48a5630b57df93cd27841d23d7373064b4f6f9b734334a35da45c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for rigel-rnaseq 0.8.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 4 files in this release have been uploaded with provenance metadata.

Select from 4 files

Attestation for rigel_rnaseq-0.8.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page