Generates boxplots of the most abundant taxa.

amp_boxplot(
  data,
  group_by = NULL,
  sort_by = median,
  plot_type = "boxplot",
  point_size = 1,
  tax_aggregate = "Genus",
  tax_add = NULL,
  tax_show = 20,
  tax_empty = "best",
  tax_class = NULL,
  order_group = NULL,
  order_y = NULL,
  plot_flip = FALSE,
  plot_log = FALSE,
  adjust_zero = NULL,
  normalise = TRUE
)

Arguments

data

(required) Data list as loaded with amp_load.

group_by

Group the samples by a variable in the metadata.

sort_by

Generic function name to use for sorting most abundant taxa, fx mean, median, or sum. (default: median)

plot_type

Plot type. "boxplot" or "point". (default: "boxplot")

point_size

The size of points. (default: 1)

tax_aggregate

The taxonomic level to aggregate the OTUs. (default: "Genus")

tax_add

Additional taxonomic level(s) to display, e.g. "Phylum". (default: "none")

tax_show

The number of taxa to show, or a vector of taxa names. (default: 20)

tax_empty

How to show OTUs without taxonomic information. One of the following:

  • "remove": Remove OTUs without taxonomic information.

  • "best": (default) Use the best classification possible.

  • "OTU": Display the OTU name.

tax_class

Converts a specific phylum to class level instead, e.g. "p__Proteobacteria".

order_group

A vector to order the groups by.

order_y

A vector to order the y-axis by.

plot_flip

(logical) Flip the axes of the plot axis. (default: FALSE)

plot_log

(logical) Log10-scale the plot. (default: FALSE)

adjust_zero

Keep abundances of 0 in the calculation of medians by adding this value. (default: NULL)

normalise

(logical) Transform the OTU read counts to be in percent per sample. (default: TRUE)

Value

A ggplot2 object. If detailed_output = TRUE a list with a ggplot2 object and additional data.

See also

Author

Kasper Skytte Andersen ksa@bio.aau.dk

Mads Albertsen MadsAlbertsen85@gmail.com

Examples

# Load example data
data("AalborgWWTPs")

# 10 boxplots grouped by WWTP with phylum name added
amp_boxplot(AalborgWWTPs,
  group_by = "Plant",
  tax_show = 10,
  tax_add = "Phylum"
)