adonis_pq: Permanova on a phyloseq object

View source: R/beta_div_test.R

adonis_pqR Documentation

Permanova on a phyloseq object

Description

lifecycle-experimental

A wrapper for the vegan::adonis2() function in the case of physeq object.

Usage

adonis_pq(
  physeq,
  formula,
  dist_method = "bray",
  merge_sample_by = NULL,
  na_remove = FALSE,
  correction_for_sample_size = FALSE,
  rarefy_nb_seqs = FALSE,
  verbose = TRUE,
  ...
)

Arguments

physeq

(required): a phyloseq-class object obtained using the phyloseq package.

formula

(required) the right part of a formula for vegan::adonis2(). Variables must be present in the physeq@sam_data slot.

dist_method

(default "bray") the distance used. See phyloseq::distance() for all available distances or run phyloseq::distanceMethodList(). For aitchison and robust.aitchison distance, vegan::vegdist() function is directly used.

merge_sample_by

a vector to determine which samples to merge using the merge_samples2() function. Need to be in physeq@sam_data

na_remove

(logical, default FALSE) If set to TRUE, remove samples with NA in the variables set in formula.

correction_for_sample_size

(logical, default FALSE) If set to TRUE, the sample size (number of sequences by samples) is added to formula in the form y~Library_Size + Biological_Effect following recommendation of Weiss et al. 2017. correction_for_sample_size overcome rarefy_nb_seqs if both are TRUE.

rarefy_nb_seqs

(logical, default FALSE) Rarefy each sample (before merging if merge_sample_by is set) using phyloseq::rarefy_even_depth(). if correction_for_sample_size is TRUE, rarefy_nb_seqs will have no effect.

verbose

(logical, default TRUE) If TRUE, prompt some messages.

...

Other arguments passed on to vegan::adonis2() function.

Details

This function is mainly a wrapper of the work of others. Please make a reference to vegan::adonis2() if you use this function.

Value

The function returns an anova.cca result object with a new column for partial R^2. See help of vegan::adonis2() for more information.

Author(s)

Adrien Taudière

Examples

data(enterotype)

adonis_pq(enterotype, "SeqTech*Enterotype", na_remove = TRUE)
adonis_pq(enterotype, "SeqTech", dist_method = "jaccard")
adonis_pq(enterotype, "SeqTech", dist_method = "robust.aitchison")


MiscMetabar documentation built on Oct. 8, 2024, 1:07 a.m.