Description Usage Arguments Examples
View source: R/sigfit_plotting.R
plot_spectrum
generates plots of one or more mutational spectra, which can be either
mutational catalogues or mutational signatures. If provided with multiple spectra, it produces
one plot per spectrum. If the spectra contain values greater than 1, the values will be
interpreted as mutation counts (as in a catalogue); otherwise, they will be interpreted as
mutation probabilities (as in a signature).
1 2 3 4 5 6 7 8 9 10 11 |
spectra |
This can be a numeric vector with one element per mutation type, a numeric matrix
with one row per signature/catalogue and one column per mutation type, or a list of signature
matrices as produced by |
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 |
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 8).
Only used if |
name |
Character indicating a name to include in the plot title; useful when plotting a single spectrum. |
max_y |
Numeric indicating an optional upper limit for the vertical axis. |
colors |
Character vector of custom color names or hexadecimal codes to use for the spectrum bars. Must contain either a single value, or as many values as the number of mutation types in the spectrum. This argument is ignored when plotting transcriptional strand-wise spectra. |
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 | ## Not run:
# Load example mutational catalogues
data("counts_21breast")
# Plot catalogues
plot_spectrum(counts_21breast, pdf_path = "Catalogues.pdf")
# Extract signatures using the Poisson model
samples <- extract_signatures(counts_21breast, nsignatures = 2, model = "poisson",
opportunities = "human-genome", iter = 800)
# Retrieve extracted signatures
sigs <- retrieve_pars(samples, "signatures")
# Plot signatures
plot_spectrum(sigs, pdf_path = "Signatures.pdf")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.