View source: R/olink_boxplot.R
| olink_boxplot | R Documentation |
Generates faceted boxplots of NPX vs. grouping variable(s) for a given list of proteins (OlinkIDs) using ggplot2::ggplot and ggplot2::geom_boxplot.
olink_boxplot(
df,
variable,
olinkid_list,
verbose = FALSE,
number_of_proteins_per_plot = 6,
posthoc_results = NULL,
ttest_results = NULL,
check_log = NULL,
...
)
df |
NPX data frame in long format with at least protein name (Assay), OlinkID (unique), UniProt and at least one grouping variable. |
variable |
A character vector or character value indicating which column to use as the x-axis and fill grouping variable. The first or single value is used as x-axis, the second as fill. Further values in a vector are not plotted. |
olinkid_list |
Character vector indicating which proteins (OlinkIDs) to plot. |
verbose |
Boolean. If the plots are shown as well as returned in the list (default is false). |
number_of_proteins_per_plot |
Number of boxplots to include in the facet plot (default 6). |
posthoc_results |
Data frame from ANOVA posthoc analysis using olink_anova_posthoc() function. |
ttest_results |
Data frame from ttest analysis using olink_ttest() function. |
check_log |
A named list returned by |
... |
coloroption passed to specify color order. |
A list of objects of class “ggplot” (the actual ggplot object is entry 1 in the list). Box and whisker plot of NPX (y-axis) by variable (x-axis) for each Assay.
if (rlang::is_installed(pkg = c("broom", "car"))) {
npx_df <- npx_data1 |>
dplyr::filter(
!grepl(pattern = "control|ctrl",
x = .data[["SampleID"]],
ignore.case = TRUE)
)
anova_results <- OlinkAnalyze::olink_anova(
df = npx_df,
variable = "Site"
)
significant_assays <- anova_results |>
dplyr::filter(
.data[["Threshold"]] == "Significant"
) |>
dplyr::pull(
.data[["OlinkID"]]
)
OlinkAnalyze::olink_boxplot(
df = npx_df,
variable = "Site",
olinkid_list = significant_assays,
verbose = TRUE,
number_of_proteins_per_plot = 3L
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.