Skip to main content

Momentum-Accelerated Junction-Enhanced Counting Ecosystem

Project description

MAJEC

Gemini_Generated_Image_7e14am7e14am7e14

Momentum-Accelerated Junction-Enhanced Counting — unified gene, isoform, and locus-level transposable element quantification from RNA-seq.

MAJEC jointly quantifies genes, transcript isoforms, and individual TE loci from standard BAM alignments in a single pass. By operating a probabilistically resolved Expectation-Maximization (EM) algorithm on a joint gene+TE feature space, MAJEC eliminates the systematic signal misattribution that plagues existing TE quantification tools.

The Gene-TE Overlap Problem

Approximately 45% of the human genome consists of TEs, many of which are embedded directly within gene bodies.

  • TE-only tools: Operate blind to genes. When a host gene is transcribed, its reads are falsely attributed to the overlapping TE, driving massive false-positive TE reactivation calls.

The MAJEC Solution: Genes and TEs compete for reads probabilistically. MAJEC uses empirical splice junction evidence to heavily penalize unsupported transcript isoforms, preventing them from stealing genuine TE reads, while correctly assigning spliced genic reads to their host genes.

Key Features

  • Joint gene+TE feature space: genes and TE loci compete for reads probabilistically, preventing systematic misattribution at overlapping loci
  • Junction-informed priors: splice junction evidence from the BAM drives isoform-level accuracy and helps distinguish genic from TE-derived signal
  • Locus-level TE resolution: individual TE insertions are quantified — not just subfamily aggregates
  • Confidence metrics: per-transcript distinguishability scores, assignment entropy, and discord scores for transparent quality assessment
  • Fast: momentum-accelerated EM typically converges in ~15 iterations; multiprocessing across samples

Installation

From source

mamba env create -f majec.yml
conda activate majec
pip install -e .

Dependencies

Installed automatically via the conda environment:

Quick Start

1. Precompute Annotations

Combine your gene and TE GTFs into a unified, mathematically optimized index.

majec_precompute_annotations \
    --gene_gtf gencode.v44.annotation.gtf \
    --te_gtf hg38_rmsk_TE.gtf \
    --output my_annotations

This produces my_annotations_annotations.pkl.gz (and optionally _subset_coverage_features.bed if --generate_rescue_features is used).

2. Run the Pipeline

Quantify all your samples jointly in a single command.

majec_run_pipeline \
    --annotation my_annotations_annotations.pkl.gz \
    --bams sample1.bam sample2.bam \
    --prefix my_experiment \
    --paired_end \
    --strandedness 2 \
    --use_subset_penalty \
    --use_junction_completeness \
    --library_type dT \
    --terminal_relax \
    --output_confidence \
    --use_cache

Input BAMs should be coordinate-sorted and produced by a splice-aware aligner such as STAR. For TE quantification, use --outFilterMultimapNmax 100 (or similar) during alignment to retain multimapping reads.

Outputs

MAJEC automatically aggregates locus-level estimates and provides DESeq2-ready matrices at multiple resolutions:

  • _total_EM_aggregated_counts.tsv — Gene and subfamily-level counts
  • _total_EM_counts.tsv — Isoform and locus-level counts
  • _transcript_metrics_SPARSE.tsv.gz — Confidence scores and junction evidence

How It Works

  1. Read assignment: featureCounts assigns reads to features from the joint gene+TE annotation, forming equivalence classes of reads that map to the same set of transcripts.

  2. Junction extraction: splice junctions reported by featureCounts (.jcounts) are matched to annotated transcript structures, providing isoform-discriminating evidence.

  3. Prior construction: junction evidence, completeness scores, subset relationships, and (optionally) TSL annotations are combined into per-transcript priors that seed the EM.

  4. EM with momentum: the Expectation-Maximization algorithm iteratively refines transcript abundance estimates. Momentum acceleration speeds convergence, typically reaching stable estimates within ~15 iterations.

  5. Output: final gene-level, transcript-level, and (if applicable) TE locus-level count matrices, plus optional confidence metrics.

Optional Workflow Tools

MAJEC includes additional tools for downstream analysis. See the full documentation for details.

  • majec_build_db — Consolidate results from one or more pipeline runs into a single, queryable SQLite database. Supports merging chunked runs, attaching sample metadata, and serves as the input for all downstream tools.
  • majec_prepare_deseq2 — Generate ready-to-run DESeq2 analysis packages directly from the database. Supports flexible sample group definitions, confidence-weighted variance modeling, gene/transcript/differential-splicing analysis levels, and batch correction.
  • majec_visualize — Generate interactive, multi-panel HTML reports for individual genes. Includes junction arc plots, differential splicing heatmaps, per-sample penalty diagnostics, and optional Excel export.

Key Parameters

Run majec_run_pipeline --help or majec_precompute_annotations --help for the full list of options. The most important flags are shown in the Quick Start above. A few others worth noting:

Flag Description
--use_subset_coverage_data Use read coverage to inform subset penalties (requires --generate_rescue_features during annotation precompute)
--output_tpm Output TPM values in addition to counts
--light Skip prior tracking and confidence metrics for faster, leaner runs
--use_cache Cache featureCounts results to speed up reruns with different parameters
--config Load settings from a JSON file (CLI flags override)

Documentation

  • BAM Preparation — STAR alignment parameters for TE-aware quantification
  • Algorithm Details — Two-phase EM, prior adjustment models, momentum acceleration, confidence metrics
  • Output Files — Column descriptions for all output tables and confidence reports
  • Post-Quantification Workflows — Database building, DESeq2 integration, and visualization
  • Usage Guide — Configuration templates, utility tools, resource requirements, and HPC deployment

Citation

If you use MAJEC in your research, please cite:

Lim, T.-Y. & Firestone, A.J. (2026) MAJEC: unified gene, isoform, and locus-level transposable element quantification from RNA-seq. bioRxiv.

License

Apache License 2.0. See LICENSE for details.

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

majec-0.1.1.tar.gz (147.5 kB view details)

Uploaded Source

Built Distribution

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

majec-0.1.1-py3-none-any.whl (154.0 kB view details)

Uploaded Python 3

File details

Details for the file majec-0.1.1.tar.gz.

File metadata

  • Download URL: majec-0.1.1.tar.gz
  • Upload date:
  • Size: 147.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for majec-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c423cd53cf673a212c12898cb8c88890146766114e6941e99e79659db1a23a0b
MD5 4b4362192b3e3ab2af38bea0841aacfb
BLAKE2b-256 b46584bc650338fdf1f6b56d6ba1198d39fc62930b1fcd4da40932f8adb015e0

See more details on using hashes here.

File details

Details for the file majec-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: majec-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 154.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for majec-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 87f709d84934b56d7663ddee903c51e6f773cc4422473e4bfbb5abf231114a88
MD5 fbaaae6f2cb356e16bdd3facfd2932cc
BLAKE2b-256 d58e3d2ff025ffb36260cfc1d2a4fc9cdb29e485e2f4a4fdeb8be1abccd2cb1e

See more details on using hashes here.

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