Skip to content
WangLabCSUPublic

About

(in develop) Mutational Signature Suite in R

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

msuiter

R-CMD-check Docs

Mutational Signature SUITE in R.

msuiter is a complete toolkit for extracting, fitting, and interpreting mutational signatures, built as the successor of sigminer. It carries one analysis from raw variant calls to interpreted biology through a single workflow grammar:

ms_variants() |> ms_tally() |> ms_extract() |> ms_fit() |> ms_compare()

What sets it apart:

  • A principled extraction pipeline — an ensemble-plus-consensus design with an adjudicated default rule for the number of signatures, plus cross-validation and stability evidence (ms_select_k()) so the choice of K is argued, not guessed.
  • Calibrated statistics, not point estimates — the MSU-Fit family measures the empirical coverage of exposure intervals and presence calls, giving each verdict an explicit, quantified trust level.
  • Reproducibility by construction — frozen random streams, bit-level thread invariance, structured errors (msuiter_error_* condition classes) at every boundary, and a provenance-governed bundled COSMIC reference database.
  • A fast, auditable compute core — numerical kernels run in Rust behind a stateless FFI under a forbid-unsafe engine contract and a frozen dependency budget, while the R side keeps the S7 object model, the pluggable engine registry, and the tidy ms_*() interface.

Scope

msuiter currently ships extraction and fitting for the small-variant modalities:

  • SBS catalogs at 96 / 192 / 384 / 1536 channel resolutions
  • DBS (78 channels) and ID (83 channels, SPMG-parity semantics)
  • MNV / complex-substitution routing with an explicit skip ledger

CNV and SV segment/breakpoint inputs can be constructed and stored, and the RNA-SBS workflow plus CN/SV fitting are planned for later releases — the capability matrix is the authoritative coverage checklist.

Feature highlights

  • Extraction — ms_extract(): ensemble + consensus pipeline with an adjudicated default K rule; pluggable engines (NMF / ARD / sparse) selected through the engine registry; SUITOR-style CV and stability evidence via ms_select_k().
  • Fitting — ms_fit() with NNLS, bidirectional-likelihood, and LRT methods; ms_test_presence() for cohort-level presence testing; ms_fit_bootstrap() for confidence intervals and support stability.
  • Calibrated statistics — the MSU-Fit family (ms_calibration_grid(), ms_calibration_verdict(), ms_calibration_sanity()): coverage-calibrated intervals and verdicts for presence calls and exposure uncertainty.
  • Comparison — ms_compare(): multi-metric similarity with analytic and empirical null distributions, three match protocols, and exposure-level testing.
  • Quality control — ms_qc_report() with burden and pseudosignature faces, hypermutant stratification, and downsampling tools.
  • Applications — ms_hrd_report() (HRDetect-coefficient WGS reporting) and ms_treatment_report().
  • Interoperability — COSMIC and SigProfiler text formats in and out (ms_import() / ms_export()), exome↔genome opportunistic conversion (ms_convert()), and a provenance-governed bundled COSMIC v3.6 reference database (ms_refdb_bundled()).
  • Reproducibility — an in-house PCG64 RNG with frozen stream layout, bit-level thread invariance tests, and structured errors (msuiter_error_* condition classes) at every boundary.

Installation

The package builds from source: R CMD INSTALL compiles the vendored Rust core offline (toolchain floor: rustc >= 1.71, see SystemRequirements).

Prerequisites:

  • R >= 4.3 (see DESCRIPTION).
  • A Rust toolchain (rustc >= 1.71) — install via rustup if cargo --version fails. The vendored core is compiled during installation; no network access is required beyond the toolchain itself.
  • A C compiler matching your R installation (standard on Linux and macOS with Xcode Command Line Tools; on Windows, Rtools).

Install the development build from GitHub:

remotes::install_github("WangLabCSU/msuiter")

Prebuilt source and binary packages are attached to the v0.1.0 release and can be installed locally with install.packages(<file>, repos = NULL, type = "source") (.tar.gz / .tgz) or type = "binary" (.zip on Windows). There is no CRAN release yet.

Quick start

A complete round trip in about a dozen lines: simulate a small cohort from three bundled COSMIC signatures, extract signatures de novo, compare them against the ground truth, and refit with the known reference.

library(msuiter)

# 1. simulate a small synthetic cohort seeded with three bundled COSMIC signatures
ref <- ms_refdb_bundled()$SBS_GRCh38
S   <- ref@matrices[[1]][, 1:3]            # the first three COSMIC signatures
E   <- matrix(c(0.5, 0.3, 0.2), 3, 24,
              dimnames = list(colnames(S), paste0("S", 1:24)))
sim <- ms_simulate(S, exposures = E, burden = 2000, seed = 1)

# 2. extraction: de novo signatures from the simulated catalog
#    (tiny synthetic data: the K adjudication warns that its stability evidence
#     is thin -- real analyses read the ms_select_k() evidence panel)
ext <- suppressWarnings(ms_extract(sim, k = 3))

# 3. comparison: are the extracted signatures the ones we planted?
#    null_n / null_n_draws set the size of the analytic-vs-empirical null
#    simulations (defaults are fine for real data; small here for speed)
cmp <- ms_compare(ext@signatures, S,
                  exposures_est = ext@exposures, exposures_ref = E,
                  null_n = 200, null_n_draws = 500, seed = 1L)
cmp

# 4. fitting: how much of each known signature is present per sample?
fit <- ms_fit(sim, S, method = "nnls")
fit

See Get started for a beginner-friendly five-minute walkthrough that builds the same round trip step by step, and the tiered task guides for each stage of the grammar.

Documentation

The full site (tutorials, guides, technical documentation, and the project's governance corpus) is published at https://wanglabcsu.github.io/msuiter/:

Tier Contents
Get started install, the beginner walkthrough, output anatomy
Core workflows import & formats, catalogs, extraction, fitting
Statistics & comparison similarity comparison, calibration statistics
Applications & QC scenario atlas, QC faces, visualization gallery
Extending register a third-party fitting engine
Reference every exported function, grouped by topic
Governance corpus architecture, roadmap, performance anchoring, ADRs, research dossiers, devlog

Key repository documents (rendered on the site): the architecture design, the roadmap with its organizational gates, the capability matrix, and the performance anchoring page with its frozen floors and witnesses.

Status

msuiter is under active development toward a v1.0 CRAN release. The extraction, fitting, comparison, calibration, QC, HRD, and interoperability surfaces are delivered and continuously regression-tested; the paper manuscript and the benchmark campaign are in progress. See the roadmap for milestone status and the NEWS for changes.

Citation

If you use msuiter in academic work, please cite the R package:

citation("msuiter")

Contributing

Contributions are welcome. Read CONTRIBUTING.md for the development workflow, the local acceptance battery, and the engine onboarding checklist. Please note the project's Code of Conduct.

License

Apache-2.0. The bundled COSMIC v3.6 reference data is mirrored from the Alexandrov-lab BSD-2 distribution (SigProfilerAssignment) with full provenance governance — see the reference-database faces on the MSU map page.

Author

Shixiang Wang — Wang Lab, CSU. Author of sigminer.

About

(in develop) Mutational Signature Suite in R

Resources

Code of conduct

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages