Description Usage Arguments Examples
View source: R/sigfit_plotting.R
plot_reconstruction
plots reconstructions of the original mutational catalogues obtained
using the inferred signatures and/or exposures. If provided with multiple catalogues, it produces
one plot per catalogue. Fitting or extraction results can be provided either as a single stanfit
object (generated via fit_signatures
or extract_signatures
), or as
separate signatures and exposures matrices (or lists produced via retrieve_pars
).
Only the former option allows the incorporation of HPD intervals to the reconstructed catalogue.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
mcmc_samples |
List with two elements named |
pdf_path |
Character indicating the path to an optional output PDF file for the plots. The
PDF dimensions and graphical parameters are automatically set to appropriate values, but custom
dimensions can be specified via the arguments |
counts |
Numeric matrix of observed mutation counts, with one row per sample and
one column per mutation type. Only needed if |
signatures |
Either a numeric matrix of mutational signatures, with one row per signature
and one column per mutation type, or a list of matrices generated via |
exposures |
Either a numeric matrix of signature exposures, with one row per sample and one
column per signature, or a list of matrices generated via |
opportunities |
Numeric matrix of mutational opportunities, with one row per signature and
one column per mutation type. It also admits character values |
pdf_width |
Numeric indicating the width of the output PDF, in inches (default is 24).
Only used if |
pdf_height |
Numeric indicating the height of the output PDF, in inches (default is 15).
Only used if |
legend_pos |
Character indicating the position of the legend in the plots. Admits values
|
legend_cex |
Numeric indicating the relative size of the legend (default is 2). |
sig_color_palette |
Character vector of custom color names or hexadecimal codes to use for each signature in exposure and reconstruction plots. Must have at least as many elements as the number of signatures. |
boxes |
Logical indicating whether boxes should be drawn around the plots (default is
|
generic |
Logical indicating whether a "generic" spectrum should be plotted (default is
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
# Load example mutational catalogues
data("counts_21breast")
# Extract signatures using the EMu (Poisson) model
samples <- extract_signatures(counts_21breast, nsignatures = 2, model = "emu",
opportunities = "human-genome", iter = 800)
# Retrieve signatures and exposures
signatures <- retrieve_pars(samples, "signatures")
exposures <- retrieve_pars(samples, "exposures")
# Plot reconstructed catalogues using stanfit object
plot_reconstruction(mcmc_samples = samples, pdf_path = "Reconstructions_1.pdf")
# Plot reconstructed catalogues using retrieved signatures and exposures
plot_reconstruction(counts = counts_21breast, signatures = signatures, exposures = exposures,
opportunities = "human-genome", pdf_path = "Reconstructions_2.pdf")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.