tidy_pcoa: PCoA on a 'long' (tidy) tibble, and a long tibble is returned

View source: R/multivar.R

tidy_pcoaR Documentation

PCoA on a 'long' (tidy) tibble, and a long tibble is returned

Description

Perform PCoA in a "tidy" way. If multiple diversity metrics are provided (eg., "bray" and "jaccard"), all PCoA results will be combined into one data.frame.

Usage

tidy_pcoa(
  df,
  taxon_col,
  sample_col,
  abundance_col,
  dists = c("bray", "jaccard", "wunifrac", "unifrac"),
  tree = NULL,
  threads = 1,
  threads_unifrac = 1,
  k = 2,
  dist_mtx_file = NULL,
  pcoa_file = NULL
)

Arguments

df

data.frame or tibble

taxon_col

the column specifying taxa or OTUs (no quotes needed)

sample_col

the column specifying sample names (no quotes needed)

abundance_col

the column specifying the taxon abundances in each sample (no quotes needed)

dists

vector of beta-diversity distances ('wunifrac' = weighted UniFrac, 'unifrac' = unweighted Unifrac; see vegan::vegsist for others)

tree

phylogeny for UniFrac calculations. It can have more tips that what is in the data.frame

threads

number of parallel calculations of each distance metric (1 thread per distance)

threads_unifrac

number of threads to use for wunifrac & unifrac calculations

k

passed to cmdscale

dist_mtx_file

file name for saving the distance matrices (qs serialization; use ".qs" for the file extension)

pcoa_file

file name for saving the raw pcoa results

Details

Weighted/Unweighted UniFrac is calculated via the rbiom R package. All other beta-diversity metrics are calculated via the vegan R package.

Value

a tibble of PCoA info for all selected "dists"


leylabmpi/LeyLabRMisc documentation built on Nov. 3, 2022, 3:45 p.m.