The function is to calculate the distance among samples

run_distance(
   object,
   level = c(NULL, "Kingdom", "Phylum", "Class",
           "Order", "Family", "Genus",
           "Species", "Strain", "unique"),
   method = c("unifrac", "wunifrac", "GUniFrac", "bray", "dpcoa", "jsd"),
   alpha = 0.5)

Arguments

object

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

level

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

method

(Required). 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.

alpha

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

Value

distance object, which could be applied for ordination analysis.

Author

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

Examples


if (FALSE) {
# phyloseq object
data("Zeybel_2022_gut")
run_distance(Zeybel_2022_gut,
   level = "Phylum",
   method = "bray")

# SummarizedExperiment object
data("Zeybel_2022_protein")
run_distance(Zeybel_2022_protein,
   method = "bray")
}