View source: R/draw_chromatogram.R
draw_chromatogram | R Documentation |
Creates a graphical representation of one or multiple peak lists in the form of a pseudo- chromatogram. Peaks are represented by Gaussian distributions centred at the peak retention time. The peak height is arbitrary and does not reflect any measured peak intensity.
draw_chromatogram(
data = NULL,
rt_col_name = NULL,
conc_col_name = NULL,
width = 0.1,
step = NULL,
sep = "\t",
breaks = NULL,
rt_limits = NULL,
samples = NULL,
show_num = FALSE,
show_rt = FALSE,
plot = TRUE,
shape = c("gaussian", "stick"),
legend.position = "bottom"
)
data |
The input data can be either a GCalignR input file or an GCalign object. See |
rt_col_name |
A character giving the name of the column containing the retention times. The decimal separator needs to be a point. |
conc_col_name |
Character, denoting a variable used to scale the peak height (e.g., peak area or peak height.) |
width |
Numeric value giving the standard deviation of Gaussian peaks. Decrease this value to separate overlapping peaks within samples. Default is 0.01. |
step |
character allowing to visualise different steps of the alignment when a GCalign object is used. By default the aligned data is shown. |
sep |
The field separator character. The default is tab separated ( |
breaks |
A numeric vector giving the breakpoints between ticks on the x axis. |
rt_limits |
A numeric vector of length two giving min and max values or retention times to plot. |
samples |
A character vector of sample names to draw chromatograms of a subset. |
show_num |
Boolean indicating whether sample numbers are drawn on top of each peak. |
show_rt |
Boolean indicating whether peak retention times are drawn on top of each peak. |
plot |
Boolean indicating if the plot is printed. |
shape |
A character determining the shape of peaks. Peaks are approximated as "gaussian" by default. Alternatively, peaks can be visualised as "sticks". |
legend.position |
See |
Peaks from the are depicted as Gaussian distributions. If the data is an "GCalign" object that was processed with align_chromatograms
, chromatograms can be drawn for the dataset prior to alignment ("input"), after correcting linear drift ("shifted") or after the complete alignment was conducted ("aligned"). In the latter case, retention times refer to the mean retention time of a homologous peaks scored among samples and do not reflect any between-sample variation anymore. Depending on the range of retention times and the distance among substances the peak width can be adjusted to enable a better visual separation of peaks by changing the value of parameter width
. Note, homologous peaks (= exactly matching retention time) will overlap completely and only the last sample plotted will be visible. Hence, the number of samples can be printed on top of each peak. The function returns a list containing the ggplot object along with the internally used data frame to allow for maximum control in adapting the plot (see examples section in this document).
A list containing the data frame created for plotting and the ggplot object. See ggplot
.
Meinolf Ottensmann (meinolf.ottensmann@web.de) & Martin Stoffel (martin.adam.stoffel@gmail.com)
## load data
path <- (system.file("extdata", "simulated_peak_data.txt", package = "GCalignR"))
## run with defaults
x <- draw_chromatogram(data = path, rt_col_name = "rt")
## Customise and split samples in panels
x <- draw_chromatogram(data = path, rt_col_name = "rt", samples = c("A2","A4"),
plot = FALSE, show_num = FALSE)
x[["ggplot"]] + ggplot2::facet_wrap(~ sample, nrow = 2)
## plot without numbers
x <- draw_chromatogram(data = path, show_num = FALSE, rt_col_name = "rt")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.