phyloseq_mult_raref: Multiple rarefaction of phyloseq-object

View source: R/phyloseq_mult_raref.R

phyloseq_mult_rarefR Documentation

Multiple rarefaction of phyloseq-object

Description

This function will resample an OTU table such that all samples have the same library size. Resampling will be performed multiple times.

Usage

phyloseq_mult_raref(
  x,
  SampSize = NULL,
  MinSizeThreshold = NULL,
  iter = 1000,
  replace = F,
  multithread = F,
  seeds = NULL,
  ...
)

Arguments

x

A phyloseq-class object

SampSize

Rarefaction depth (number of reads to sample)

MinSizeThreshold

Remove samples with number of reads less than this threshold

iter

Number of rarefication iterations

replace

Logical, whether to sample with replacement (TRUE) or without replacement (FALSE, default)

multithread

Logical or integer; if TRUE, attempts to run the function on multiple cores; integer defines the number of cores to use (if it is set to TRUE, all cores will be used)

seeds

Integer vector used for the reproducible random subsampling (should be of the same length as the number of iterations)

...

Additional arguments will be passed to rarefy_even_depth

Details

If the sample size ('SampSize') is not specified, rarefaction will be made for the depth equeal to 0.9 * minimal observed sample size. By default, sampling is performed without replacement ('replace = FALSE'), which differs from the default behaviour of rarefy_even_depth.

Value

List of rarefied phyloseq-objects.

See Also

rarefy_even_depth

Examples

data("esophagus")
eso_raref <- phyloseq_mult_raref(esophagus, iter = 10)

# Discard samples with number of reads < 210 and perform resampling with replacement
eso_raref_t <- phyloseq_mult_raref(esophagus, replace = T, MinSizeThreshold = 210, SampSize = 210, iter = 10)
sample_sums(esophagus)
sample_sums(eso_raref_t[[1]])

# Do not remove OTUs from the dataset that are no longer observed in any sample (have a count of zero in every sample)
phyloseq_mult_raref(esophagus, trimOTUs = F, replace = T, MinSizeThreshold = 210, SampSize = 210, iter = 10)


vmikk/metagMisc documentation built on Feb. 14, 2024, 2:29 a.m.