MyNixOS website logo
Description

Plotting Mutational Signatures and Mutational Spectra.

Plotting functions for mutational signatures and mutational spectra, including single base substitutions (SBS), doublet base substitutions (DBS), and small insertions and deletions (indels). Generates plots similar to those used previously in Alexandrov et al. (2020)<doi:10.1038/s41586-020-1943-3> and Rozen et al. (2026)<doi:10.5281/zenodo.18451842>.

R-CMD-check pkgdown

mSigPlot

Publication-quality plots for mutational signatures and mutational spectra. Supports SBS, DBS, and indel catalogs across 10 classification systems with bar charts, strand-bias plots, and heatmaps.

Installation

# Install from GitHub
install.packages("remotes")  # if needed
remotes::install_github("steverozen/mSigPlot")

Quick start

Every plot function accepts a numeric vector, single-column data.frame, matrix, tibble, or data.table. The easiest entry point is plot_guess(), which auto-detects the catalog type by row count:

library(mSigPlot)

# Auto-detect and plot
plot_guess(my_catalog)

# Or call a specific function
plot_SBS96(sbs96_catalog, plot_title = "Sample 1")

# Export multiple samples to a multi-page PDF (5 per page)
plot_guess_pdf(multi_sample_catalog, "output.pdf")

Supported catalog types

ChannelsFunctionMutation typePlot style
96plot_SBS96()SBS (single-base substitutions) in trinucleotide contextBar chart
192plot_SBS192()SBS in trinucleotide context with transcription strandPaired bar chart
12plot_SBS12()SBS strand bias (from 192-row input)Paired bar chart
1536plot_SBS1536()SBS in pentanucleotide context2x3 heatmap grid
78plot_DBS78()DBS (doublet base substitution)Bar chart
136plot_DBS136()DBS dinucleotide classes10-panel heatmap
144plot_DBS144()DBS with transcription strandPaired bar chart
83plot_ID83()Indel (COSMIC 83 indel-type classification)Bar chart
89plot_ID89()Indel (89 indel-type classification)Bar chart
166plot_ID166()Indel 83-type classification, genic/intergenicPaired bar chart
476plot_ID476()Indel 476-type classificationBar chart + peak labels
288plot_SBS288()SBS in trinucleotide context, by template (transcribed), non-template, and intergenic regions3-panel stacked bar chart

Every plot function except plot_SBS288 has a corresponding _pdf() variant (e.g., plot_SBS96_pdf()) that writes multi-sample PDFs with 5 plots per page.

Gallery

SBS96

96-channel single base substitution profile with 6 color-coded mutation classes (C>A, C>G, C>T, T>A, T>C, T>G).

SBS96 mutational spectrum bar plot

SBS192

Transcription strand-aware SBS profile. Bars are paired: transcribed (blue) and untranscribed (red) for each trinucleotide context. Intergenic regions not plotted.

SBS192 strand-aware mutational spectrum bar plot

SBS12

Collapsed strand-bias view of an SBS192 catalog: 6 mutation classes x 2 strands (transcribed vs. untranscribed). Takes a 192-row catalog as input.

SBS12 strand-bias bar plot

SBS1536

Pentanucleotide-context SBS shown as six 16x16 heatmaps.

SBS1536 pentanucleotide-context heatmap

SBS288

288-channel SBS profile split by transcription strand: template (transcribed), non-template (untranscribed), and not-transcribed (intergenic). Displayed as three stacked SBS96 panels with a shared y-axis.

SBS288 strand-aware mutational spectrum bar plot

DBS78

78-channel DBS (doublet base substitution) profile across 10 dinucleotide reference classes.

DBS78 doublet base substitution bar plot

DBS136

DBS shown as 10 small 4x4 heatmaps, one per dinucleotide class, with a maxima-per-class summary.

DBS136 doublet base substitution heatmap

DBS144

Transcription strand-aware DBS profile. Bars are paired: transcribed and untranscribed for each dinucleotide context.

DBS144 strand-aware doublet base substitution bar plot

ID83

COSMIC 83-type indel classification covering 1bp deletions/insertions, repeat-mediated indels, and microhomology-mediated deletions.

ID83 indel classification bar plot

ID89

89-type indel classification system.

ID89 indel classification bar plot

ID166

83-type indel classification split by genic vs. intergenic regions. Bars are paired (genic, intergenic) within each indel class. The example below uses a synthetic catalog derived from COSMIC ID1 (no ID166 data ships with the package).

ID166 genic/intergenic indel bar plot

ID476

476-type indel classification system Top peaks are automatically labeled using ggrepel.

ID476 indel classification bar plot

Common parameters

All plot functions share these parameters:

ParameterDescription
catalogNumeric vector, data.frame, matrix, tibble, or data.table
plot_titleTitle above the plot (defaults to column name)
base_sizeBase font size in points (default 11)
show_countsTRUE/FALSE/NULL (auto-detect) for per-class count labels
show_axis_text_xShow or hide x-axis tick labels
show_axis_text_yShow or hide y-axis tick labels
show_axis_title_xShow or hide the x-axis title
show_axis_title_yShow or hide the y-axis title
*_cexMultipliers for individual text elements relative to base_size

Most bar chart functions also accept ylim (y-axis limits), grid (grid lines), and upper (colored class labels above bars). See ?plot_SBS96 for the full parameter list.

Your input must have the expected row order

If your catalog has row names matching the canonical mutation type labels, mSigPlot validates and reorders them automatically. If row names are absent (unnamed vector or sequential integer names or data from a data.table or tibble), the data is assumed to be in canonical order. If your rows are in an unexpected order you will got nonsensical plots. Use catalog_row_order() to see the expected order for any catalog type:

head(catalog_row_order()$SBS96)
#> [1] "ACAA" "ACCA" "ACGA" "ACTA" "CCAA" "CCCA"

Documentation

After installation, access the full documentation for any function:

?plot_SBS96
?plot_guess
?catalog_row_order

License

GPL (>= 3)

Metadata

Version

2.0.38

License

Unknown

Platforms (80)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arc-linux
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • sh4-linux
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-uefi
  • x86_64-windows