fit_signatures: Fit mutational signatures

Description Usage Arguments Value Examples

View source: R/sigfit_estimation.R

Description

fit_signatures performs MCMC sampling to fit a set of mutational signatures to a collection of mutational catalogues and estimate the exposure of each catalogue to each signature. Four models of signatures are available: multinomial, Poisson, normal and negative binomial. The normal model can be used when counts contains continuous (non-integer) values, while the negative binomial model is a more noise-robust version of the Poisson model.

Usage

1
2
3
4
5
6
7
8
fit_signatures(
  counts,
  signatures,
  exp_prior = NULL,
  model = "multinomial",
  opportunities = NULL,
  ...
)

Arguments

counts

Numeric matrix of observed mutation counts, with one row per sample and one column per mutation type.

signatures

Mutational signatures to be fitted; either a numeric matrix with one row per signature and one column per mutation type, or a list of matrices generated via retrieve_pars.

exp_prior

Numeric matrix with one row per sample and one column per signature, to be used as the Dirichlet priors for the signature exposures. Default priors are uniform.

model

Name of the model to sample from. Admits character values "multinomial" (default), "poisson", "negbin", "normal", "nmf" (an alias for "multinomial"), and "emu" (an alias for "poisson").

opportunities

Numeric matrix of optional mutational opportunities, with one row per sample and one column per mutation type. It also admits character values "human-genome" or "human-exome", in which case the mutational opportunities of the reference human genome/exome will be used for every sample.

...

Additional arguments to be passed to rstan::sampling.

Value

A list with two elements:

The model parameters (such as signature exposures) can be extracted from this object using retrieve_pars.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
# Load example mutational catalogues and COSMIC signatures
data("counts_21breast")
data("cosmic_signatures_v2")

# Fit signatures 1 to 4, using a custom prior that favors signature 1 over the rest
# (4 chains, 300 warmup iterations + 300 sampling iterations - use more in practice)
samples_1 <- fit_signatures(counts_21breast, cosmic_signatures_v2[1:4, ],
                            exp_prior = c(10, 1, 1, 1), iter = 600)

# Fit all the signatures, running a single chain for many iterations
# (3000 warmup iterations + 10000 sampling iterations)
samples_2 <- fit_signatures(counts_21breast, cosmic_signatures_v2, chains = 1,
                            iter = 13000, warmup = 3000)

## End(Not run)

kgori/sigfit documentation built on Feb. 3, 2022, 12:04 p.m.