View source: R/helpers_plots.R
plot_variants | R Documentation |
This function plots variants in relation to the amplicon. Shows sequences of top mutants without aggregating on deletions, insertions and mismatches.
plot_variants(
alignments,
config,
id,
cut_buffer = 5,
top = 10,
annot = if (amplican:::get_seq(config, id, "Donor") == "") "cov" else NA,
summary_plot = amplican:::get_seq(config, id, "Donor") == "",
frameshift = amplican:::get_seq(config, id, "Donor") == ""
)
alignments |
(data.frame) Loaded alignment information from alignments_events.csv file. |
config |
(data.frame) Loaded table from config_summary.csv file. |
id |
(string or vector of strings) Name of the ID column from config file or name of multiple IDs if it is possible to group them. First amplicon will be used as the basis for plot. If Donor is available we will try to add the first donor and mark it on the plot. |
cut_buffer |
(numeric) Default is 5, you should specify the same as used in the analysis. |
top |
(numeric) Specify number of most frequent reads to plot. By
default it is 10. Check |
annot |
("codon" or "cov" or NA) What to display for annotation top plot. When NA will not display anything, also not display total summary. Codon plot is all reading frames for a given window, and the default "cov" is coverage of all indels and mismatches over a given window. |
summary_plot |
(boolean) Whether small summary plot in the upper right corner should be displayed. Top bar summarizes total reads with frameshift (F), reads with Edits without Frameshift (Edits) and reads without Edits (Match). |
frameshift |
(boolean) Whether to include Frameshift column in the table. annot on | off |
Top plot shows all six possible frames for given amplicon. Amino acids are
colored as follows:
Small nonpolar | G, A, S, T | Orange |
Hydrophobic | C, V, I, L, P, F, Y, M, W | Green |
Polar | N, Q, H | Magenta |
Negatively charged | D, E | Red |
Positively charged | K, R | Blue |
Other | eg. *, U, + | Grey |
Variant plot shows amplicon reference, UPPER letters which were the basis for window selection are highlighted with dashed white box (guideRNA). Black triangles are reflecting insertion points. Dashed letters indicate deletions. Table associated with variant plot represents:
Freq - Frequency of given read in experiment. Variants are ordered by frequency value.
Count - Represents raw count of this variant reads in experiment.
F - Sum of deletion and insertion widths of events overlapping presented window. Green background indicates frameshift.
(variant plot) gtable object of variants plot
This function is inspired by plotAlignments
.
Other specialized plots:
metaplot_deletions()
,
metaplot_insertions()
,
metaplot_mismatches()
,
plot_cuts()
,
plot_deletions()
,
plot_heterogeneity()
,
plot_insertions()
,
plot_mismatches()
#example config
config <- read.csv(system.file("extdata", "results", "config_summary.csv",
package = "amplican"))
#example alignments results
alignments_file <- system.file("extdata", "results", "alignments",
"events_filtered_shifted_normalized.csv",
package = "amplican")
alignments <- read.csv(alignments_file)
alignments <- alignments[alignments$consensus & alignments$overlaps, ]
p <- plot_variants(alignments[alignments$consensus & alignments$overlaps, ],
config, c('ID_1','ID_3'))
# with Donor we dont plot summary and the annot, summary plot and frameshift
p <- plot_variants(alignments[alignments$consensus & alignments$overlaps, ],
config, c('ID_5'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.