phyloseq_effort_div_rangeplot: Vizualize OTU diversity and richness for a particular...

View source: R/phyloseq_effort.R

phyloseq_effort_div_rangeplotR Documentation

Vizualize OTU diversity and richness for a particular sequencing depth or sample coverage ranges

Description

This function helps to estimate OTU diversity and sample coverage for a particular sequencing depth or to estimate the required sequencing depth and OTU diversity for a particular sample coverage

Usage

phyloseq_effort_div_rangeplot(
  physeq,
  range,
  range_type = "coverage",
  variable = NULL,
  yvar = "seqdepth",
  interval = "quartiles",
  show_plot = TRUE,
  justDF = FALSE,
  progress = "text",
  ...
)

Arguments

physeq

A phyloseq-class object

range

Numeric vector of coverage levels or sequence depths to test, e.g., seq(from = 100, to = 1000, by = 100)

range_type

"coverage" or "seqdepth"

variable

Groupping variable name (contained in sample_data); default, NULL

yvar

Which dependent variable to show ("coverage", "seqdepth", "Q1", "Q2", "Q3"). For range_type = "seqdepth": "coverage", "Q0", "Q1", "Q2". For range_type = "coverage": "seqdepth", "Q0", "Q1", "Q2"

interval

Which interval to show on the group-averaged data ("CI", "quartiles", or NULL)

show_plot

Logical; if TRUE, show the resulting plot

justDF

Logical; if TRUE, just return the resulting table

progress

Show progress bar ("text" or "none")

...

Additional arguments may be passed to phyloseq_effort_div

Details

Diversity estimation based on the analytical approach for coverage-based rarefaction proposed by Chao and Jost (2012).

Value

ggplot object (if show_plot = TRUE) or a data.frame (if justDF = TRUE)

Examples

data("esophagus")
# Show sequencing depth required to reach a particular sample coverage
phyloseq_effort_div_rangeplot(esophagus, range = seq(from = 0.8, to = 0.97, by = 0.02),
    range_type = "coverage", yvar = "seqdepth", interval = "quartiles")

# Show OTU richness (Q = 0) achieved by different sequencing efforts
phyloseq_effort_div_rangeplot(esophagus, range = seq(from = 100, to = 500, by = 20),
    range_type = "seqdepth", yvar = "Q0", interval = "quartiles")


data("GlobalPatterns")
# Subset data
GP <- subset_samples(GlobalPatterns, SampleType %in% c("Soil", "Feces", "Skin"))
GP <- phyloseq_filter_top_taxa(GP, perc = 20)

# Show sequencing depth required to reach a particular sample coverage level for different sample groups
phyloseq_effort_div_rangeplot(GP, range = seq(from = 0.8, to = 0.97, by = 0.02),
  variable = "SampleType", range_type = "coverage", yvar = "seqdepth", interval = "quartiles")

# Show OTU richness (Q = 0) achieved by different sequencing efforts for different sample groups
phyloseq_effort_div_rangeplot(GP, range = seq(from = 100, to = 500, by = 20),
   variable = "SampleType", range_type = "seqdepth", yvar = "Q0")


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