This function agglomerates a phyloseq object at a specified level and transforms counts to relative abundance. This function also melts the phyloseq object into a melted data frame which is used to apply microshades colors and organization to.

prep_mdf(
  ps,
  subgroup_level = "Genus",
  as_relative_abundance = TRUE,
  remove_na = FALSE
)

Arguments

ps

phyloseq-class object

subgroup_level

string of smaller taxonomic group

as_relative_abundance

transform counts to relative abundance

remove_na

remove NA values during taxa agglomeration

Value

data.frame, a melted phyloseq object from psmelt()

Details

Notes:

  • This normalizes the phyloseq object to relative abundance

  • This agglomerates to the smaller taxonomic group subgroup_level

Examples

library(phyloseq)
library(speedyseq)
#> 
#> Attaching package: ‘speedyseq’
#> The following objects are masked from ‘package:phyloseq’:
#> 
#>     filter_taxa, plot_bar, plot_heatmap, plot_tree, psmelt, tax_glom,
#>     tip_glom, transform_sample_counts
data(GlobalPatterns)

# Use defaults
mdf <- prep_mdf(GlobalPatterns)

# Subgroup as "Family"
mdf_fam <- prep_mdf(GlobalPatterns, subgroup_level = "Family")