pldist_all: pldist_all

Description Usage Arguments Value

View source: R/pldist_all.R

Description

Function that calculates multiple paired and longitudinal ecological distance/dissimilarity matrices. Includes qualitative and quantitative versions of Bray-Curtis, Jaccard, Kulczynski, Gower, and unweighted and generalized UniFrac distances/dissimilarities. UniFrac-based metrics are based in part on GUniFrac (Jun Chen & Hongzhe Li (2012)). Both quantitative and qualitative versions of each requested metric are returned.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
pldist_all(
  otus,
  metadata,
  paired = FALSE,
  clr = FALSE,
  pseudoct = NULL,
  method = c("b", "g", "j", "k", "u"),
  tree = NULL,
  gam = c(0, 0.5, 1),
  norm = FALSE
)

Arguments

otus

OTU count or frequency table, containing one row per sample and one column per OTU.

metadata

Data frame with three columns: subject identifiers (n unique values, column name "subjID"), sample identifiers (must match row names of otu.tab, column name "sampID"), and time point or group identifier (if using longitudinal distances, this must be numeric or convertable to numeric).

paired

Logical indicating whether to use the paired version of the metric (TRUE) or the longitudinal version (FALSE). Paired analyis is only possible when there are exactly 2 unique time points/identifiers for each subject or pair.

clr

Logical indicating whether to use CLR-transformed abundances (TRUE) or original proportions (FALSE) in quantitative distances/dissimilarities. Default FALSE.

pseudoct

Pseudocount value to be added to each cell of the matrix prior to CLR transformation. Default is NULL; if NULL, 0.5 will be added if data are counts, min(1e-06, 0.5*min(nonzero p)) will be added if data are proportions, and nothing will be added if no cells have zero values.

method

Desired distance metric(s). Include a vector with any combination of braycurtis, jaccard, kulczynski, gower, and unifrac, or any unambiguous abbreviation thereof.

tree

Rooted phylogenetic tree of R class "phylo". Default NULL; only needed for UniFrac family distances.

gam

Parameter controlling weight on abundant lineages for UniFrac family distances. The same weight is used within a subject as between subjects. Default (0, 0.5, 1); only needed for UniFrac family distances.

norm

Indicator of whether to normalize the difference to average taxon abundance or not (default FALSE)

Value

Returns a list containing all n x n distance (or dissimilarity) matrices requested, with both quantitative and qualitative versions of the metric, named as "D_metric_quant" or "D_metric_qual".


aplantin/pldist documentation built on Feb. 26, 2021, 2:19 p.m.