Plots a boxplot of the expression of one or more proteins. Samples can be grouped depending on a metadata column. Optionally, the p-values of all the pairwise (2-by-2) comparisons between groups can be added on top of the plot.
expression.boxplot(
DEprot.object,
protein.id,
which.data = "imputed",
sample.subset = NULL,
shape.column = NULL,
group.by.metadata.column = "column.id",
group.levels = NULL,
scale.expression = FALSE,
x.label.angle = 30,
ncol = NULL,
free.y = TRUE,
pairwise.comparisons = FALSE,
pairwise.test.type = "wilcox.test",
pairwise.include.ns = TRUE,
pairwise.p.label = "p.signif",
pairwise.p.decimals = 2
)An object of class DEprot or DEprot.analyses.
String (or vector of strings) indicating the protein(s) for which plot the expression. The identifiers must correspond to the full row.names of the counts table (equivalent to the prot.id column of the fold change table of DEprot.analyses object). When several proteins are provided the plot is faceted, one panel per protein.
String indicating which type of counts should be used. One among: 'raw', 'normalized', 'norm', 'imputed', 'randomized', 'random', 'imp'. Default: "imputed".
Character vector indicating a subset of samples to display. The identifiers must correspond to a IDs in the column.id column of the object's metadata. Default: NULL (all samples are shown).
String indicating a column from the metadata table. This column will be used as factor for the shape of the points on the boxplot. Default: NULL: no different shapes.
String indicating a column from the metadata table. This column will be used to define sample groups, and for each group it will be computed a mean of the counts. Default: "column.id" (no groups).
Ordered string vector indicating the order to use for the groups. Default: NULL, counts table order will be applied
Logic value indicating whether Z-scores should be computed. With several proteins the Z-score is computed protein by protein, so that the panels stay comparable. Default: FALSE (no scaling).
Numeric value indicating the rotation angle to use for the x-axis labels. Default: 30.
Numeric value indicating the number of columns of the facet grid, used only when several proteins are plotted. Default: NULL (automatic).
Logic value indicating whether each panel should have its own y-axis, used only when several proteins are plotted. Proteins of different abundance are otherwise flattened onto a common scale. Default: TRUE.
Logical value indicating whether the p-values of all the pairwise (2-by-2) comparisons between the groups should be added on top of the boxplot using ggpubr. When TRUE, a comparison is computed for each possible pair of groups defined by group.by.metadata.column, independently within each protein. Default: FALSE.
String indicating the statistical test to use for the pairwise comparisons. Any of the ggpubr-supported tests is accepted and the value is case/format-insensitive: capitalization, dots, spaces and hyphens are ignored (e.g. "wilcox.test", "Wilcoxon", "WILCOX", "mann-whitney" are all equivalent). Supported families: "t.test" (Student's/Welch t-test), "wilcox.test" (Wilcoxon/Mann-Whitney), "anova" and "kruskal.test". Since the comparisons are performed 2-by-2, the two latter are applied through their exact two-sample equivalents ("anova" -> pooled t-test, "kruskal.test" -> Wilcoxon rank-sum). When the pairwise brackets are displayed, the global p-value shown at the top of the plot is computed with the same test and the same arguments: with two groups the two labels report therefore the same value, while with more groups the multi-sample version of the family is used ("anova" or "kruskal.test"). Rank-based tests always rely on the normal approximation (exact = FALSE), which keeps the p-values stable in presence of ties. Default: "wilcox.test".
Logical value indicating whether the non-significant comparisons (p > 0.05) should be displayed. If FALSE, only the significant comparisons are shown. Default: TRUE.
String indicating how the pairwise p-values should be displayed (case/format-insensitive). Use "p.signif" (aliases: "stars", "significance", "symbol") to show the significance symbols (ns, *, **, ***, ****) drawn directly by ggpubr::stat_compare_means, or "p.value" (aliases: "number", "numeric", "exact") to show the numeric p-value. Default: "p.signif".
Numeric value indicating the number of decimals used to approximate the numeric p-values (used only when pairwise.p.label shows the numeric value). Values below 0.1 are rendered in scientific notation with a superscript exponent, e.g. 3.20×10-2. The actual (real) p-value is always displayed, so the uninformative p < 2.2e-16 is never shown. Default: 2.
A boxplot of class ggplot2, faceted by protein when several proteins are provided.
# Expression for all samples of protein 'protein.44'
expression.boxplot(DEprot.object = DEprot::test.toolbox$dpo.imp,
protein.id = "protein.44",
shape.column = "replicate")
# Expression of protein 'protein.44' grouped by condition (combined.id)
expression.boxplot(DEprot.object = DEprot::test.toolbox$dpo.imp,
protein.id = "protein.44",
group.by.metadata.column = "combined.id")
# Expression of several proteins: one panel per protein
expression.boxplot(DEprot.object = DEprot::test.toolbox$dpo.imp,
protein.id = c("protein.44", "protein.45", "protein.46"),
group.by.metadata.column = "combined.id",
ncol = 3)
# Expression of protein 'protein.44' grouped by condition (combined.id) and Z-scored
expression.boxplot(DEprot.object = DEprot::test.toolbox$dpo.imp,
protein.id = "protein.44",
group.by.metadata.column = "combined.id",
scale.expression = TRUE)
# Pairwise comparisons between conditions (significance symbols, Wilcoxon test)
expression.boxplot(DEprot.object = DEprot::test.toolbox$dpo.imp,
protein.id = "protein.44",
group.by.metadata.column = "combined.id",
pairwise.comparisons = TRUE)
#> `stat_compare_means()` with `comparisons` displays *unadjusted* p-values (no correction for multiple comparisons).
#> ℹ For p-values adjusted for multiple comparisons, use `geom_pwc()`, or `stat_pvalue_manual()` together with `compare_means(..., p.adjust.method = )`.
#> This message is displayed once per session.
# Pairwise comparisons showing the exact numeric p-value
expression.boxplot(DEprot.object = DEprot::test.toolbox$dpo.imp,
protein.id = "protein.44",
group.by.metadata.column = "combined.id",
pairwise.comparisons = TRUE,
pairwise.test.type = "t.test",
pairwise.p.label = "stars",
pairwise.p.decimals = 3,
pairwise.include.ns = FALSE)