doWilcoxTest: Do a Blocked Wilcox Test Taxa on Groups

View source: R/doWilcoxTest.R

doWilcoxTestR Documentation

Do a Blocked Wilcox Test Taxa on Groups

Description

Do a Blocked Wilcox Test Taxa on Groups

Do Wilcox Test Taxa and Paire-wise on Groups

Usage

doBlockedWilcoxTest(
  x,
  features = NULL,
  sample_group = NULL,
  block_fct = NULL,
  adj_method = "BH",
  ...
)

doWilcoxTest(x, sample_group = NULL, paired = FALSE, adj_method = "BH", ...)

Arguments

x

A phyloseq object

features

Features to test

sample_group

Variable in sample_data to test for differences in taxa abundances

block_fct

Column variable to stratify/block in testing.

adj_method

One of "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none". Default="BH". For more information see adjust_pvalue.

...

Additional parameters that are passed on to wilcox_test

paired

Logical TRUE or FALSE passed to wilcox_test

Details

Performs one and two sample blocked Wilcoxon tests wrapper using wilcox_test. Useful for comparing large number of taxa between groups while stratifying by confounder like sex, age, etc.

Performs one and two sample Wilcoxon tests wrapper using wilcox_test, adjust_pvalue and add_significance for an input phyloseq object. Useful for comparing large number of taxa between groups.

Value

A tibble.

A tibble.

Author(s)

Sudarshan A. Shetty

See Also

wilcox_test

wilcox_test

Examples

library(biomeStats)
library(biomeUtils)
library(phyloseq)
library(microbiome)
library(dplyr)
data("FuentesIliGutData")
feat.to.test <- core_members(getProportions(FuentesIliGutData), 0.01, 25/100)
ps <- getProportions(FuentesIliGutData) |>
  filterSampleData(ILI !="L2") |>
  filterTaxaByNames(ids = feat.to.test, keep = TRUE)

wilcox_results <- doBlockedWilcoxTest(x = ps,
                                      features = feat.to.test,
                                      sample_group = "ILI",
                                      block_fct = "sex",
                                      adj_method = "BH")
print(wilcox_results)

library(biomeStats)
library(phyloseq)
library(microbiome)
library(dplyr)
data("FuentesIliGutData")
ps <- subset_samples(FuentesIliGutData, ILI %in% c("C", "L1"))
ps.rel <- microbiome::transform(ps, "compositional")
ps.rel <- core(ps.rel, detection=0.001, prevalence=50/100)

wilcox_results <- doWilcoxTest(ps.rel,
                               sample_group = "ILI",
                               paired = FALSE,
                               adj_method = "BH",
                               alternative = "greater") %>%
                  dplyr::filter(p.adj <= 0.05)
print(wilcox_results)


RIVM-IIV-Microbiome/biomeStats documentation built on Sept. 14, 2022, 5:15 p.m.