discover_signatures: Discover mutational signatures

View source: R/discovery_prediction.R

discover_signaturesR Documentation

Discover mutational signatures

Description

Mutational signatures and exposures will be discovered using methods such as Latent Dirichlet Allocation (lda) or Non-Negative Matrix Factorization (nmf). These algorithms will deconvolute a matrix of counts for mutation types in each sample to two matrices: 1) a "signature" matrix containing the probability of each mutation type in each sample and 2) an "exposure" matrix containing the estimated counts for each signature in each sample. Before mutational discovery can be performed, samples first need to be stored in a musica object using the create_musica_from_variants or create_musica_from_counts function and mutation count tables need to be created using functions such as build_standard_table if create_musica_from_counts was not used.

Usage

discover_signatures(
  musica,
  modality,
  num_signatures,
  algorithm = "lda",
  result_name = "result",
  model_id = NULL,
  seed = 1,
  nstart = 10,
  par_cores = 1,
  make_copy = FALSE,
  table_name = NULL
)

Arguments

musica

A musica object.

modality

Modality to use for signature discovery. Needs to be the same name supplied to the table building functions such as build_standard_table.

num_signatures

Number of signatures to discover.

algorithm

Method to use for mutational signature discovery. One of "lda" or "nmf". Default "lda".

result_name

Name for result_list entry to save the results to. Default "result".

model_id

Identifier for the result. If NULL, will be automatically set to the algorithm and number of signatures. Default NULL.

seed

Seed to be used for the random number generators in the signature discovery algorithms. Default 1.

nstart

Number of independent random starts used in the mutational signature algorithms. Default 10.

par_cores

Number of parallel cores to use. Only used if method = "nmf". Default 1.

make_copy

If FALSE, the inputted musica object is updated and nothing is returned. If TRUE, a new musica object is created and returned. Default FALSE.

table_name

Use modality instead

Value

Returns nothing or a new musica object, depending on the make_copy parameter.

Examples

data(musica)
g <- select_genome("19")
build_standard_table(musica, g, "SBS96", overwrite = TRUE)
discover_signatures(
  musica = musica, modality = "SBS96",
  num_signatures = 3, algorithm = "lda", seed = 12345, nstart = 1
)

campbio/musicatk documentation built on Dec. 25, 2024, 9:34 p.m.