physeq {chem16S}R Documentation

Process 'phyloseq-class' objects to calculate chemical metrics

Description

Calculate chemical metrics of community reference proteomes from taxonomic abundances in phyloseq-class objects and make plots of individual metrics or two metrics against each other.

Usage

  ps_taxacounts(physeq, split = TRUE)
  ps_metrics(physeq, split = TRUE, refdb = "GTDB_214", quiet = FALSE, ...)
  plot_ps_metrics(physeq, metrics = c("Zc", "nO2", "nH2O"), x = "samples",
    color = NULL, shape = NULL, title = NULL,
    scales = "free_y", nrow = 1, sortby = NULL, ...)
  plot_ps_metrics2(physeq, metrics = c("Zc", "nH2O"), color = NULL,
    shape = NULL, title = NULL, refdb = "GTDB_214", quiet = FALSE)

Arguments

physeq

'phyloseq-class', a phyloseq object containing an 'otu_table' and 'tax_table'

split

logical, calculate metrics for each sample (TRUE) or the entire set (FALSE)

refdb

character, name of reference database (passed to get_metrics)

quiet

logical, suppress printed messages? (passed to map_taxa)

...

additional arguments passed to ps_metrics and thence to get_metrics

metrics

character, chemical metrics to calculate

x

map this variable to the horizontal axis

color

map this variable to colors

shape

map this variable to shapes

title

main title for the plot

scales

⁠free_y⁠’ or ‘⁠fixed⁠’ for different vertical scales or same scale in each panel

nrow

number of rows of panels (passed to facet_wrap)

sortby

subset of metrics argument, sort x-index by the mean values of these metrics

Details

ps_taxacounts returns a data frame with lowest-level classifications (from genus to phylum) and abundances for each OTU in the physeq object.

ps_metrics calculates chemical metrics of community reference proteomes from the lowest-level classifications after taxonomic mapping with map_taxa.

plot_ps_metrics plots individual chemical metrics or multiple chemical metrics, each in their own panel. This function is modified from plot_richness; see that help page for further details about graphics-related arguments.

plot_ps_metrics2 plot two chemical metrics against each other.

The metrics argument is passed to get_metrics and selects the metrics to calculate. split, refdb, and quiet can also be used as additional arguments in plot_ps_metrics and plot_ps_metrics2.

Value

For ps_taxacounts, a data frame with samples in rows, and columns taxid (sample name taken from the OTU table obtained from otu_table(physeq)), lineage (all taxonomic names from the taxonomy table obtained from tax_table(physeq), separated by semicolons), name (lowest-level taxonomic name), rank (rank of lowest-level taxon), followed by the abundances from the OTU table.

For ps_metrics, a data frame with samples in rows, and columns corresponding to each of the metrics.

For plot_ps_metrics and plot_ps_metrics2, ggplot objects.

Author(s)

The author of this Rd file and the ps_taxacounts and ps_metrics functions is Jeffrey Dick. plot_ps_metrics is based on the plot_richness function by Paul J. McMurdie and was modified from that function by Jeffrey Dick.

Examples

# Example 1: Humboldt Sulfuretum (Fonseca et al., 2022)
file <- system.file("extdata/DADA2-GTDB_214/FEN+22/ps_FEN+22.rds", package = "chem16S")
physeq <- readRDS(file)
# Get lowest-level (to genus) classification for each OTU
taxacounts <- ps_taxacounts(physeq)
# Show numbers of assignments at each taxonomic level
table(taxacounts$rank)
# Map taxonomic names
map <- map_taxa(taxacounts, refdb = "GTDB_214")
# Taxonomy and reference proteomes are both from GTDB,
# so there are no unmapped classifications
sum(attr(map, "unmapped_percent")) # == 0
# Calculate chemical metrics
ps_metrics(physeq, refdb = "GTDB_214")

# Example 2: GlobalPatterns dataset from phyloseq
data(GlobalPatterns, package = "phyloseq")
# Plot metrics grouped by sample type and sorted by mean Zc;
# refdb = "RefSeq" uses manual mappings from the RDP to NCBI taxonomy
p <- plot_ps_metrics(GlobalPatterns, x = "SampleType",
                     sortby = "Zc", refdb = "RefSeq_206")
# Change orientation of x-axis labels
p + ggplot2::theme(axis.text.x = ggplot2::element_text(
  angle = 45, vjust = 1, hjust = 1))

[Package chem16S version 1.1.0 Index]