test_taxa: Test a taxonomical group of features

Description Usage Arguments Value

View source: R/test_taxa.R

Description

This function takes a phyloseq object with otu_table, sam_data and tax_table slots and compute the relative abundances for the features in a specified taxonomical rank. If a repeated measures/time variable and a treatment/condition variables are specified it performs test for the specified taxa. The graphical representation can be of two types: by the repeated measures/time variable or by the treatment/condition variable. Non parametric Mann-Whitney or Wilcox test are performed to study differences in the relative abundances.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
test_taxa(
  ps,
  rank = "Phylum",
  time_variable = "TimePoint",
  treatment_variable = "Treatment",
  sample_variable = "Sample",
  taxa_to_test = c("Actinobacteria", "Verrucomicrobia"),
  test_by = "time",
  strat_by = NULL,
  comparisons_list = NULL,
  show_test = TRUE,
  adj = FALSE,
  y_position = NULL
)

Arguments

ps

A phyloseq object.

rank

The taxonomical rank, found in the tax_table columns, for taxa agglomeration.

time_variable

Name of the column, in sample_data slot of the phyloseq object, where repeated measures/time variable is stored.

treatment_variable

Name of the column, in sample_data slot of the phyloseq object, where treatment/condition variable is stored.

sample_variable

Name of the column, in sample_data slot of the phyloseq object, where sample names variable is stored.

taxa_to_test

A vector of character containings taxonomical group names of interest. If NULL, all the taxonomical features of the agglomerated rank are tested.

test_by

"time" character string if the difference between repeated measures/time variable is to be tested or "treatment" character string if the difference between cndition/treatment variable is to be tested.

strat_by

Name of the column, in sample_data slot of the phyloseq object, for the stratification variable. Default set to NULL.

comparisons_list

A list of length-2 vectors. The entries in the vector are either the names of 2 values on the x-axis or the 2 integers that correspond to the index of the groups of interest, to be compared. If empty and test_by = "time" each level of repeated measures/time variable is compared with his baseline (the first level). If empty and test_by = "treatment" each level of condition/treatment variable is compared with his baseline (the first level).

show_test

If TRUE, significant p-values or adjusted p-values are shown.

adj

If TRUE (default = FALSE) and "show_test = TRUE", significant adjusted (FDR) p-values are shown.

y_position

If specified (default = NULL) set the y-axis position of the tests.

Value

a list with two slots: plot which contains a ggplot object with taxa_to_test faceted rows and repeated measures/time or condition/treatment levels as faceted columns. And data slot, which contains the summary mean and sd for relative abundances.


mcalgaro93/taxacology documentation built on April 5, 2021, 12:52 p.m.