The run_PERMANOVA function is used to identify the association between the community and environmental variables.

run_PERMANOVA(
   object,
   level = c(NULL, "Kingdom", "Phylum", "Class",
           "Order", "Family", "Genus",
           "Species", "Strain", "unique"),
   variables = "all",
   method = c("unifrac", "wunifrac", "GUniFrac", "bray", "dpcoa", "jsd"),
   mode = c("one", "all"),
   seedNum = 123,
   alpha = 0.5,
   p_adjust = c("none", "fdr", "bonferroni", "holm",
       "hochberg", "hommel", "BH", "BY"))

Arguments

object

(Required). a phyloseq::phyloseq or SummarizedExperiment::SummarizedExperiment object.

level

(Optional). character. Summarization level (from rank_names(pseq), default: NULL).

variables

(Optional). vector. variables for test (default: all).

method

(Optional). character. Provide one of the currently supported options. See distanceMethodList for a detailed list of the supported options and links to accompanying documentation. Options include:

  • "bray": bray crutis distance.

  • "unifrac": unweighted UniFrac distance.

  • "wunifrac": weighted-UniFrac distance.

  • "GUniFrac": The variance-adjusted weighted UniFrac distances (default: alpha=0.5).

  • "dpcoa": sample-wise distance used in Double Principle Coordinate Analysis.

  • "jsd": Jensen-Shannon Divergence. Alternatively, you can provide a character string that defines a custom distance method, if it has the form described in designdist (default: "bray").

mode

(Optional). character. Since there are missing values in some columns, providing two test model:

  • "one": test on one variable per time.

  • "all": test on all variables once. (default: "one").

seedNum

(Optional). numeric. specify seeds for reproduction (default: 123).

alpha

(Optional). numeric. the parameter for "GUniFrac" controlling weight on abundant lineages (default: 0.5).

p_adjust

(Optional). character. method to adjust p-values by. Options include "holm", "hochberg", "hommel", "bonferroni", "BH", "BY", "fdr", "none". See stats::p.adjust() for more details (default: "BH").

Value

A data.frame of PERMANOVA result.

Details

The run_PERMANOVA function is used to identify the association between the community and environmental variables, applying the distance in profile and calculating the F statistic between community and variable by permutation test to determine the significance. It can be applied to both phyloseq::phyloseq and SummarizedExperiment::SummarizedExperiment object.

References

Anderson, Marti J. "Permutational multivariate analysis of variance."Department of Statistics, University of Auckland, Auckland 26 (2005): 32-46.

Author

Created by Hua Zou (5/14/2022 Shenzhen China)

Examples


if (FALSE) {
# phyloseq object
data("Zeybel_2022_gut")
run_PERMANOVA(Zeybel_2022_gut,
          variables = c("LiverFatClass", "Liver_fat", "Gender"),
          mode = "one",
          method = "bray")

# SummarizedExperiment object
data("Zeybel_2022_protein")
se_impute <- impute_abundance(
  object = Zeybel_2022_protein,
  group = "LiverFatClass",
  ZerosAsNA = TRUE,
  RemoveNA = TRUE,
  cutoff = 20,
  method = "knn")
run_PERMANOVA(se_impute,
          variables = c("LiverFatClass", "Liver_fat"),
          mode = "all",
          method = "bray")
}