Skip to contents

Convert the output of sig_combine() into a simple sigverse signature object. This is useful when you want to run maths on a signature derived from a model Note for visualisation of signature combination models, we suggest directly using the output of sig_combine() in sigvis::sig_visualise() so that when sigvis::sig_make_interactive() is run the original signature contributions are preserved

Usage

sig_combine_collapse_to_single_signature(signature_combination)

Arguments

signature_combination

a dataframe produced by sig_combine() which represents the combination of multiple signatures with known (exact) proportions - where each individual signature is kept distinct to make it easy to plot as a stackedbar

Value

a data.frame in sigverse signature format

Examples

library(sigstash)

# Load a signature collection
signatures <- sig_load("COSMIC_v3.3.1_SBS_GRCh38")

# Create a model that represents a mix of SBS1 (40%) and SBS2 (60%)
model <- c(SBS1 = 0.4, SBS2 = 0.6)

# Add selected signatures to the combined model
combined_signatures <- sig_combine(signatures, model)

# Flatten the combined_signatures dataframe that keeps separate signatures
signature <- sig_combine_collapse_to_single_signature(combined_signatures)