multitax_bar_pq: Plot taxonomic distribution across 3 taxonomic levels and...

View source: R/plot_functions.R

multitax_bar_pqR Documentation

Plot taxonomic distribution across 3 taxonomic levels and optionally one sample factor

Description

lifecycle-experimental

Note that lvl3 need to be nested in lvl2 which need to be nested in lvl1

Usage

multitax_bar_pq(
  physeq,
  lvl1,
  lvl2,
  lvl3,
  fact = NULL,
  nb_seq = TRUE,
  log10trans = TRUE
)

Arguments

physeq

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

lvl1

(required) Name of the first (higher) taxonomic rank of interest

lvl2

(required) Name of the second (middle) taxonomic rank of interest

lvl3

(required) Name of the first (lower) taxonomic rank of interest

fact

Name of the factor to cluster samples by modalities. Need to be in physeq@sam_data. If not set, the taxonomic distribution is plot for all samples together.

nb_seq

(logical; default TRUE) If set to FALSE, only the number of ASV is count. Concretely, physeq otu_table is transformed in a binary otu_table (each value different from zero is set to one)

log10trans

(logical, default TRUE) If TRUE, the number of sequences (or ASV if nb_seq = FALSE) is log10 transformed.

Value

A ggplot2 graphic

Author(s)

Adrien Taudière

Examples


if (requireNamespace("ggh4x")) {
  multitax_bar_pq(data_fungi_sp_known, "Phylum", "Class", "Order", "Time")
  multitax_bar_pq(data_fungi_sp_known, "Phylum", "Class", "Order")
  multitax_bar_pq(data_fungi_sp_known, "Phylum", "Class", "Order",
    nb_seq = FALSE, log10trans = FALSE
  )
}


MiscMetabar documentation built on Oct. 8, 2024, 1:07 a.m.