accu_plot_balanced_modality: Plot accumulation curves with balanced modality and depth...

View source: R/plot_functions.R

accu_plot_balanced_modalityR Documentation

Plot accumulation curves with balanced modality and depth rarefaction

Description

lifecycle-experimental

This function (i) rarefy (equalize) the number of samples per modality of a factor and (ii) rarefy the number of sequences per sample (depth). The seed is set to 1:nperm. Thus, with exacly the same parameter, including nperm values, results must be identical.

Usage

accu_plot_balanced_modality(
  physeq,
  fact,
  nperm = 99,
  step = 2000,
  by.fact = TRUE,
  progress_bar = TRUE,
  quantile_prob = 0.975,
  rarefy_by_sample_before_merging = TRUE,
  sample.size = 1000,
  verbose = FALSE,
  ...
)

Arguments

physeq

(required): a phyloseq-class object obtained using the phyloseq package.

fact

(required) The variable to rarefy. Must be present in the sam_data slot of the physeq object.

nperm

(int) The number of permutations to perform.

step

(int) distance among points calculated to plot lines. A low value give better plot but is more time consuming.

by.fact

(logical, default TRUE) First merge the OTU table by factor to plot only one line by factor

progress_bar

(logical, default TRUE) Do we print progress during the calculation?

quantile_prob

(float, ⁠[0:1]⁠) the value to compute the quantile. Minimum quantile is compute using 1-quantile_prob.

rarefy_by_sample_before_merging

(logical, default TRUE): rarefy_by_sample_before_merging = FALSE is buggy for the moment.Please only use rarefy_by_sample_before_merging = TRUE

sample.size

(int) A single integer value equal to the number of reads being simulated, also known as the depth. See phyloseq::rarefy_even_depth().

verbose

(logical). If TRUE, print additional informations.

...

Other params for be passed on to accu_plot() function

Value

A ggplot2 plot representing the richness accumulation plot

Author(s)

Adrien Taudière

See Also

accu_plot(), rarefy_sample_count_by_modality(), phyloseq::rarefy_even_depth()

Examples


data_fungi_woNA4Time <-
  subset_samples(data_fungi, !is.na(Time))
data_fungi_woNA4Time@sam_data$Time <- paste0("time-", data_fungi_woNA4Time@sam_data$Time)
accu_plot_balanced_modality(data_fungi_woNA4Time, "Time", nperm = 3)

data_fungi_woNA4Height <-
  subset_samples(data_fungi, !is.na(Height))
accu_plot_balanced_modality(data_fungi_woNA4Height, "Height", nperm = 3)


adrientaudiere/MiscMetabar documentation built on July 6, 2024, 7:02 p.m.