plot_sample_mean_or_boxplot | R Documentation |
Plot per-sample mean or boxplots (showing median and quantiles). In ordered samples, e.g. consecutive MS runs, order-associated effects are visualised.
plot_sample_mean(data_matrix, sample_annotation = NULL,
sample_id_col = "FullRunName", batch_col = "MS_batch",
color_by_batch = FALSE, color_scheme = "brewer",
order_col = "order", vline_color = "grey", facet_col = NULL,
filename = NULL, width = NA, height = NA, units = c("cm", "in",
"mm"), plot_title = NULL, theme = "classic", base_size = 20,
ylimits = NULL)
plot_boxplot(df_long, sample_annotation = NULL,
sample_id_col = "FullRunName", measure_col = "Intensity",
batch_col = "MS_batch", color_by_batch = TRUE,
color_scheme = "brewer", order_col = "order", facet_col = NULL,
filename = NULL, width = NA, height = NA, units = c("cm", "in",
"mm"), plot_title = NULL, theme = "classic", base_size = 20,
ylimits = NULL, outliers = TRUE)
data_matrix |
features (in rows) vs samples (in columns) matrix, with
feature IDs in rownames and file/sample names as colnames.
See "example_proteome_matrix" for more details (to call the description,
use |
sample_annotation |
data frame with:
.
See |
sample_id_col |
name of the column in |
batch_col |
column in |
color_by_batch |
(logical) whether to color points and connecting lines
by batch factor as defined by |
color_scheme |
named vector, names corresponding to unique batch values of
|
order_col |
column in |
vline_color |
color of vertical lines, typically denoting
different MS batches in ordered runs; should be |
facet_col |
column in |
filename |
path where the results are saved. If null the object is returned to the active window; otherwise, the object is save into the file. Currently only pdf and png format is supported |
width |
option determining the output image width |
height |
option determining the output image width |
units |
units: 'cm', 'in' or 'mm' |
plot_title |
title of the plot (e.g., processing step + representation level (fragments, transitions, proteins) + purpose (meanplot/corrplot etc)) |
theme |
ggplot theme, by default |
ylimits |
range of y-axis to compare two plots side by side, if required. |
df_long |
data frame where each row is a single feature in a single
sample. It minimally has a |
measure_col |
if |
outliers |
keep (default) or remove the boxplot outliers |
functions for quick visual assessment of trends associated, overall
or specific covariate-associated (see batch_col
and facet_col
)
ggplot2 class object. Thus, all aesthetics can be overridden
ggplot
, date_to_sample_order
mean_plot <- plot_sample_mean(example_proteome_matrix, example_sample_annotation,
order_col = 'order', batch_col = "MS_batch")
color_list <- sample_annotation_to_colors (example_sample_annotation,
factor_columns = c('MS_batch'),
numeric_columns = c('DateTime', 'order'))
plot_sample_mean(example_proteome_matrix, example_sample_annotation,
order_col = 'order', batch_col = "MS_batch", color_by_batch = TRUE,
color_scheme = color_list[["MS_batch"]])
## Not run:
mean_plot <- plot_sample_mean(example_proteome_matrix,
example_sample_annotation,
order_col = 'order', batch_col = "MS_batch",
filename = 'test_meanplot.png',
width = 28, height = 18, units = 'cm')
## End(Not run)
boxplot <- plot_boxplot(log_transform_df(example_proteome),
sample_annotation = example_sample_annotation,
batch_col = "MS_batch")
color_list <- sample_annotation_to_colors (example_sample_annotation,
factor_columns = c('MS_batch'),
numeric_columns = c('DateTime', 'order'))
plot_boxplot(log_transform_df(example_proteome),
sample_annotation = example_sample_annotation,
batch_col = "MS_batch", color_scheme = color_list[["MS_batch"]])
## Not run:
boxplot <- plot_boxplot(log_transform_df(example_proteome),
sample_annotation = example_sample_annotation,
batch_col = "MS_batch", filename = 'test_boxplot.png',
width = 14, height = 9, units = 'in')
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.