plot_abund_prev: Mean Abundance-Prevalence relation

View source: R/plot_abund_prev.R

plot_abund_prevR Documentation

Mean Abundance-Prevalence relation

Description

Plots Mean Abundance-Prevalence for taxa. Mean abundance, mean prevalence, and upper and lower confidence interval for each taxa is calculated by random subsampling.

Usage

plot_abund_prev(
  x,
  lower.conf = 0.025,
  upper.conf = 0.975,
  bs.iter = 99,
  color = "steelblue",
  dot.opacity = 0.5,
  dot.size = 2,
  label.core = FALSE,
  label.size = NULL,
  label.opacity = NULL,
  label.color = "grey70",
  mean.abund.thres = NULL,
  mean.prev.thres = NULL,
  log.scale = TRUE,
  nudge.label = NULL,
  ...
)

Arguments

x

phyloseq-class object

lower.conf

Lower confidence interval =0.025

upper.conf

Upper confidence interval =0.975

bs.iter

Number of bootstrap iterations =99

color

taxa level to color. Preferably at phylum or just a single color

dot.opacity

Numeric for ggplot alpha. Default is 0.5

dot.size

Numeric size of point

label.core

Logical default is FALSE

label.size

If label_core is TRUE specify text size. Default is NULL

label.opacity

Numeric for ggplot alpha. Defualt is NULL

label.color

Color for labels. Default="grey70"

mean.abund.thres

If label_core is TRUE specify mean abundance threshold. Default is NULL

mean.prev.thres

If label_core is TRUE specify mean prevalence threshold. Default is NULL

log.scale

Plot log10 scale. Default is TRUE abundance criteria. Default is NULL

nudge.label

Argument to pass to ggrepel::geom_text_repel Default is NULL

...

Arguments to pass to sample() function.

Details

Check if there are spurious OTUs/ASVs.

Value

A ggplot plot object.

Examples

## Not run: 
# Example data
library(microbiomeutilities)
asv_ps <- zackular2014
asv_ps <- microbiome::transform(asv_ps, "compositional")
asv_ps <- core(asv_ps, detection = 0.0001, prevalence = 0.5)
asv_ps <- format_to_besthit(asv_ps)
set.seed(2349)
p_v <- plot_abund_prev(asv_ps, size = 20, replace = TRUE) +
  geom_vline(xintercept = 0.75, lty = "dashed", alpha = 0.7) +
  geom_hline(yintercept = 0.01, lty = "dashed", alpha = 0.7) +
  scale_color_brewer(palette = "Paired")
p_v

## End(Not run)


microsud/microbiomeutilities documentation built on Nov. 29, 2022, 12:18 a.m.