| olink_wilcox | R Documentation |
Performs a Welch 2-sample Mann-Whitney U Test at confidence level 0.95 for every protein (by OlinkID) for a given grouping variable using stats::wilcox.test and corrects for multiple testing by the Benjamini-Hochberg method (“fdr”) using stats::p.adjust. Adjusted p-values are logically evaluated towards adjusted p-value<0.05. The resulting Mann-Whitney U Test table is arranged by ascending p-values.
olink_wilcox(df, variable, pair_id, check_log = NULL, ...)
df |
NPX or Quantified_value data frame in long format with at least protein name (Assay), OlinkID, UniProt and a factor with 2 levels. |
variable |
Character value indicating which column should be used as the grouping variable. Needs to have exactly 2 levels. |
pair_id |
Character value indicating which column indicates the paired sample identifier. |
check_log |
A named list returned by |
... |
Options to be passed to wilcox.test. See |
A data frame containing the Mann-Whitney U Test results for every protein. Columns include:
Assay: "character" Protein symbol
OlinkID: "character" Olink specific ID
UniProt: "character" UniProt ID
Panel: "character" Name of Olink Panel
estimate: "numeric" median of NPX differences between groups
statistic: "named numeric" the value of the test statistic with a name describing it
p.value: "numeric" p-value for the test
conf.low: "numeric" confidence interval for the median of differences (lower end)
conf.high: "numeric" confidence interval for the median of differences (upper end)
method: "character" which wilcoxon method was used
alternative: "character" describes the alternative hypothesis
Adjusted_pval: "numeric" adjusted p-value for the test (Benjamini&Hochberg)
Threshold: "character" if adjusted p-value is significant or not (< 0.05)
if (rlang::is_installed(pkg = c("broom"))) {
npx_df <- npx_data1 |>
dplyr::filter(
!grepl(
pattern = "control",
x = .data[["SampleID"]],
ignore.case = TRUE
)
)
check_log <- OlinkAnalyze::check_npx(df = npx_df)
# Mann-Whitney U Test
wilcox_results <- OlinkAnalyze::olink_wilcox(
df = npx_df,
variable = "Treatment",
alternative = "two.sided",
check_log = check_log
)
# Paired Mann-Whitney U Test
wilcox_paired_results <- npx_df |>
dplyr::filter(
.data[["Time"]] %in% c("Baseline", "Week.6")
) |>
OlinkAnalyze::olink_wilcox(
variable = "Time",
pair_id = "Subject",
check_log = check_log
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.