make_phy_df: Generate a Data Frame for Taxon Bar Charts

View source: R/make_phy_df.R

make_phy_dfR Documentation

Generate a Data Frame for Taxon Bar Charts

Description

make_phy_df generates a data frame that is useful for generating taxon bar charts.

Usage

make_phy_df(
  physeq,
  rank = "Genus",
  cutoff = 0.001,
  indic = FALSE,
  prop = TRUE,
  count = FALSE
)

Arguments

physeq

A phyloseq object.

rank

The rank at which to glom taxa. Must be one of 'OTU', 'Genus', 'Family', 'Order', 'Class', 'Phylum'. Default is 'Genus'.

cutoff

The abundance cutoff below which taxa are grouped into 'Other'. If you don't want anything grouped into 'Other', set this to 0. Default is 0.001.

indic

a flag to indicate if the taxon names have level indicators. If FALSE, they are added.

prop

Specifies whether taxa need to be propogated down the taxonomy table (default is TRUE) or if this has already been done.

count

If FALSE (default) the function will expect a relative abundance table and create an 'Other' category for taxa below the cutoff (and will raise an error if the table is not relative abundance). If TRUE, the function will not check for relative abundance and will not create an 'Other' category.

Details

This function takes a phyloseq object and generates a data frame that is useful for plotting taxon abundance information. By default it propagates taxon assignment information down the tree into unassigned leves, and aggregates all taxa below 0.1 percent into a single 'Other' category. This function expects the phyloseq object to be relative abundance, and weird things will happen if it is not.

Value

A data frame similar in structure to that generated by phyloseq::psmelt(), but with an 'Other' category added and taxon levels ordered for use in plotting.


JCSzamosi/aftersl1p documentation built on July 3, 2025, 8:37 p.m.