fit_to_signatures: Find optimal nonnegative linear combination of mutation...

View source: R/fit_to_signatures.R

fit_to_signaturesR Documentation

Find optimal nonnegative linear combination of mutation signatures to reconstruct the mutation matrix.

Description

Find the linear combination of mutation signatures that most closely reconstructs the mutation matrix by solving the nonnegative least-squares constraints problem.

Usage

fit_to_signatures(mut_matrix, signatures)

Arguments

mut_matrix

mutation count matrix (dimensions: x mutation types X n samples)

signatures

Signature matrix (dimensions: x mutation types X n signatures)

Value

Named list with signature contributions and reconstructed mutation matrix

See Also

mut_matrix,fit_to_signatures_strict,fit_to_signatures_bootstrapped

Examples


## See the 'mut_matrix()' example for how we obtained the mutation matrix:
mut_mat <- readRDS(system.file("states/mut_mat_data.rds",
  package = "MutationalPatterns"
))

## Get signatures
signatures <- get_known_signatures()

## Perform the fitting
fit_res <- fit_to_signatures(mut_mat, signatures)

## This will also work for indels and dbs.
## An example is given for indels

## Get The indel counts
## See 'count_indel_contexts()' for more info on how to do this.
indel_counts <- readRDS(system.file("states/blood_indel_counts.rds",
  package = "MutationalPatterns"
))

## Get signatures
signatures <- get_known_signatures("indel")

fit_to_signatures(indel_counts, signatures)

CuppenResearch/MutationalPatterns documentation built on Nov. 23, 2022, 4:13 a.m.