prep_mdf: Prepare melted phyloseq object to map colors to

View source: R/color_mapping_functions.R

prep_mdfR Documentation

Prepare melted phyloseq object to map colors to

Description

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.

Usage

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

Details

Notes:

  • This normalizes the phyloseq object to relative abundance

  • This agglomerates to the smaller taxonomic group subgroup_level

Value

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

Examples

library(phyloseq)
library(speedyseq)
data(GlobalPatterns)

# Use defaults
mdf <- prep_mdf(GlobalPatterns)

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

KarstensLab/microshades documentation built on June 11, 2024, 11:41 a.m.