Description Usage Arguments Value Examples
View source: R/sigfit_estimation.R
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.
1 2 3 4 5 6 7 8 | fit_signatures(
counts,
signatures,
exp_prior = NULL,
model = "multinomial",
opportunities = NULL,
...
)
|
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
|
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 |
opportunities |
Numeric matrix of optional mutational opportunities, with one row per sample
and one column per mutation type. It also admits character values |
... |
Additional arguments to be passed to |
A list with two elements:
`data`
: list containing the input data supplied to the model.
`result`
: object of class stanfit, containing the output MCMC samples,
as well as information about the model and the sampling process.
The model parameters (such as signature exposures) can be extracted from this
object using retrieve_pars
.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.