Description Usage Arguments Value Examples
View source: R/plot_original_vs_reconstructed.R
When a reconstructed profile has a cosine similarity of more than 0.95 with original, the reconstructed profile is considered very good.
1 2 3 4 5 6 | plot_original_vs_reconstructed(
mut_matrix,
reconstructed,
y_intercept = 0.95,
ylims = c(0.6, 1)
)
|
mut_matrix |
mutation count matrix (dimensions: x mutation types X n samples) |
reconstructed |
A reconstructed mutation count matrix |
y_intercept |
The y intercept of the plotted horizontal line. Default: 0.95. |
ylims |
The limits of the y axis. Default: c(0.6, 1) |
A ggplot figure
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## See the 'mut_matrix()' example for how we obtained the mutation matrix:
mut_mat <- readRDS(system.file("states/mut_mat_data.rds",
package = "MutationalPatterns"
))
## Extracting signatures can be computationally intensive, so
## we use pre-computed data generated with the following command:
# nmf_res <- extract_signatures(mut_mat, rank = 2)
nmf_res <- readRDS(system.file("states/nmf_res_data.rds",
package = "MutationalPatterns"
))
## Create figure
plot_original_vs_reconstructed(mut_mat, nmf_res$reconstructed)
## You can also use the results of signature refitting.
## Here we load some data as an example
fit_res <- readRDS(system.file("states/snv_refit.rds",
package = "MutationalPatterns"
))
plot_original_vs_reconstructed(mut_mat, fit_res$reconstructed)
## You can also change the height of the horizontal line
plot_original_vs_reconstructed(mut_mat, fit_res$reconstructed, y_intercept = 0.90)
## It's also possible to change the limits of the y axis
plot_original_vs_reconstructed(mut_mat, fit_res$reconstructed, ylims = c(0, 1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.