feature_level_diagnostics | R Documentation |
Creates a peptide faceted ggplot2 plot of the value in
measure_col
vs order_col
(if 'NULL', x-axis is simply a sample name order).
Additionally, the resulting plot can also be colored either by batch factor,
by quality factor (e.g. imputated/non-imputed) and, if needed, faceted by
another batch factor, e.g. an instrument.
If the non-linear curve was fit, this can also be added to the plot, see
functions specific to each case below
plot_single_feature(feature_name, df_long, sample_annotation = NULL,
sample_id_col = "FullRunName", measure_col = "Intensity",
feature_id_col = "peptide_group_label", geom = c("point", "line"),
qual_col = NULL, qual_value = NULL, batch_col = "MS_batch",
color_by_batch = FALSE, color_scheme = "brewer",
order_col = "order", vline_color = "red", facet_col = NULL,
filename = NULL, width = NA, height = NA, units = c("cm", "in",
"mm"), plot_title = NULL, theme = "classic", ylimits = NULL,
base_size = 20)
plot_peptides_of_one_protein(protein_name, peptide_annotation = NULL,
protein_col = "ProteinName", df_long, sample_annotation = NULL,
sample_id_col = "FullRunName", measure_col = "Intensity",
feature_id_col = "peptide_group_label", geom = c("point", "line"),
qual_col = NULL, qual_value = NULL, batch_col = "MS_batch",
color_by_batch = FALSE, color_scheme = "brewer",
order_col = "order", vline_color = "red", facet_col = NULL,
filename = NULL, width = NA, height = NA, units = c("cm", "in",
"mm"), plot_title = sprintf("Peptides of %s protein", protein_name),
theme = "classic", base_size = 20)
plot_spike_in(spike_ins = "BOVIN", peptide_annotation = NULL,
protein_col = "ProteinName", df_long, sample_annotation = NULL,
sample_id_col = "FullRunName", measure_col = "Intensity",
feature_id_col = "peptide_group_label", geom = c("point", "line"),
qual_col = NULL, qual_value = NULL, batch_col = "MS_batch",
color_by_batch = FALSE, color_scheme = "brewer",
order_col = "order", vline_color = "red", facet_col = NULL,
filename = NULL, width = NA, height = NA, units = c("cm", "in",
"mm"), plot_title = sprintf("Spike-in %s plots", spike_ins),
theme = "classic", base_size = 20)
plot_iRT(irt_pattern = "iRT", peptide_annotation = NULL,
protein_col = "ProteinName", df_long, sample_annotation = NULL,
sample_id_col = "FullRunName", measure_col = "Intensity",
feature_id_col = "peptide_group_label", geom = c("point", "line"),
qual_col = NULL, qual_value = NULL, batch_col = "MS_batch",
color_by_batch = FALSE, color_scheme = "brewer",
order_col = "order", vline_color = "red", facet_col = NULL,
filename = NULL, width = NA, height = NA, units = c("cm", "in",
"mm"), plot_title = "iRT peptide profile", theme = "classic",
base_size = 20)
plot_with_fitting_curve(feature_name, fit_df, fit_value_col = "fit",
df_long, sample_annotation = NULL, sample_id_col = "FullRunName",
measure_col = "Intensity", feature_id_col = "peptide_group_label",
geom = c("point", "line"), qual_col = NULL, qual_value = NULL,
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 = sprintf("Fitting curve of %s \n peptide",
paste(feature_name, collapse = " ")), theme = "classic",
base_size = 20)
feature_name |
name of the selected feature (e.g. peptide) for diagnostic profiling |
df_long |
data frame where each row is a single feature in a single
sample. It minimally has a |
sample_annotation |
data frame with:
.
See |
sample_id_col |
name of the column in |
measure_col |
if |
feature_id_col |
name of the column with feature/gene/peptide/protein
ID used in the long format representation |
geom |
whether to show the feature as points and/or connect by lines
(accepted values are: 1. |
qual_col |
column to color point by certain value denoted
by |
qual_value |
value in |
batch_col |
column in |
color_by_batch |
(logical) whether to color points and connecting lines
by batch factor as defined by |
color_scheme |
a named vector of colors to map to |
order_col |
column in |
vline_color |
color of vertical lines, typically separating different MS batches in ordered runs; should be 'NULL' for experiments without intrinsic order |
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 plot feature-level trends |
protein_name |
name of the protein as defined in |
peptide_annotation |
long format data frame with peptide ID and their
corresponding protein and/or gene annotations.
See |
protein_col |
column where protein names are specified |
spike_ins |
name of feature(s), typically proteins that were spiked in for control |
irt_pattern |
substring used to identify iRT proteins in the column 'ProteinName' |
fit_df |
data frame output of |
fit_value_col |
column in |
ggplot2 type plot of measure_col
vs order_col
,
faceted by feature_name
and (optionally) by batch_col
single_feature_plot <- plot_single_feature(feature_name = c("46213_NVGVSFYADKPEVTQEQK_2","10081_NVQGIIDILK_2"),
df_long = example_proteome, example_sample_annotation,
qual_col = NULL)
#color measurements by factor, related to order (MS_batch)
plot_single_feature(feature_name = c("46213_NVGVSFYADKPEVTQEQK_2","10081_NVQGIIDILK_2"),
df_long = example_proteome, example_sample_annotation,
qual_col = NULL, color_by_batch = TRUE, batch_col = 'MS_batch')
#color measurements by factor, with order-unrelated factor
single_feature_plot <- plot_single_feature(feature_name = c("46213_NVGVSFYADKPEVTQEQK_2","10081_NVQGIIDILK_2"),
df_long = example_proteome, example_sample_annotation,
qual_col = NULL, color_by_batch = TRUE, batch_col = 'Diet', geom = 'point',
vline_color = NULL)
#saving the plot
## Not run:
single_feature_plot <- plot_single_feature(feature_name = c("46213_NVGVSFYADKPEVTQEQK_2","10081_NVQGIIDILK_2"),
df_long = example_proteome, example_sample_annotation,
qual_col = NULL, filename = 'test_peptide.png',
width = 28, height = 18, units = 'cm')
## End(Not run)
#to examine peptides of a single protein:
peptides_of_one_protein_plot <- plot_peptides_of_one_protein (
protein_name = "Haao", peptide_annotation = example_peptide_annotation,
protein_col = "Gene", df_long = example_proteome,
sample_annotation = example_sample_annotation,
order_col = 'order', sample_id_col = 'FullRunName',
batch_col = 'MS_batch')
#saving the peptides of one protein
## Not run:
peptides_of_one_protein_plot <- plot_peptides_of_one_protein (
protein_name = "Haao", peptide_annotation = example_peptide_annotation,
protein_col = "Gene", df_long = example_proteome,
sample_annotation = example_sample_annotation,
order_col = 'order', sample_id_col = 'FullRunName',
batch_col = 'MS_batch',
filename = 'test_protein.png', width = 14, height = 9, units = 'in')
## End(Not run)
#to illustrate spike-ins:
spike_in_plot <- plot_spike_in(spike_ins = "BOVINE_A1ag",
peptide_annotation = example_peptide_annotation, protein_col = 'Gene',
df_long = example_proteome, sample_annotation = example_sample_annotation,
sample_id_col = 'FullRunName',
plot_title = "Spike-in BOVINE protein peptides")
#to illustrate iRT peptides:
irt_plot <- plot_iRT(irt_pattern = "iRT",
peptide_annotation = example_peptide_annotation,
df_long = example_proteome, sample_annotation = example_sample_annotation,
protein_col = 'Gene')
#illustrate the fitting curve:
special_peptide = example_proteome$peptide_group_label == "10231_QDVDVWLWQQEGSSK_2"
loess_fit_70 <- adjust_batch_trend_df(example_proteome[special_peptide,],
example_sample_annotation, span = 0.7)
fitting_curve_plot <- plot_with_fitting_curve(feature_name = "10231_QDVDVWLWQQEGSSK_2",
df_long = example_proteome, sample_annotation = example_sample_annotation,
fit_df = loess_fit_70, plot_title = "Curve fitting with 70% span")
#with curves colored by the corresponding batch:
fitting_curve_plot <- plot_with_fitting_curve(feature_name = "10231_QDVDVWLWQQEGSSK_2",
df_long = example_proteome, sample_annotation = example_sample_annotation,
fit_df = loess_fit_70, plot_title = "Curve fitting with 70% span",
color_by_batch = TRUE, batch_col = 'MS_batch')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.