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
)
phyloseq-class object
string of smaller taxonomic group
transform counts to relative abundance
remove NA values during taxa agglomeration
data.frame, a melted phyloseq object from psmelt()
Notes:
This normalizes the phyloseq object to relative abundance
This agglomerates to the smaller taxonomic group subgroup_level
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")