Skip to contents

This function is a part of the MicrobiomeStat package. It takes a phyloseq object, extracts relevant information and repackages it in the MicrobiomeStat's data object format. This enables easy use of phyloseq data with MicrobiomeStat's analysis functions.

Usage

mStat_convert_phyloseq_to_data_obj(phylo.obj)

Arguments

phylo.obj

A phyloseq object to be converted. This should contain an OTU (operational taxonomic unit) table, sample data, taxonomy table, and a phylogenetic tree.

Value

A MicrobiomeStat data object (a list) containing the following elements:

  • feature.tab: A matrix of the feature table (OTU table). Rows with a sum of zero are removed, so only the features present in the samples are included.

  • meta.dat: A data frame of the sample data. This contains the metadata for each of the samples.

  • feature.ann: A matrix of the feature annotation table (taxonomy table). Only the rows that exist in the feature table are included.

  • tree: A phylogenetic tree. The tree is rooted by midpointing if it is not already rooted. Tips not present in the OTU table are dropped.

Details

This function checks each component (OTU table, sample data, taxonomy table, and phylogenetic tree) of the phyloseq object for null values. If a component is not null, it is converted to the appropriate format and added to the MicrobiomeStat data object. The OTU and taxonomy tables are converted to matrices, while the sample data is converted to a data frame. The phylogenetic tree is checked if it is rooted, and if not, it is rooted by midpointing. Tips not present in the OTU table are dropped from the tree. This ensures the output data object is consistent and ready for further microbiome statistical analysis.

References

McMurdie PJ, Holmes S. phyloseq: An R Package for Reproducible Interactive Analysis and Graphics of Microbiome Census Data. PLoS ONE. 2013;8(4):e61217.

Author

Jun Chen

Examples

if (FALSE) {
  #library(microbiome)
  #data(peerj32)
  #peerj32.phy <- peerj32$phyloseq
  #data.obj <- mStat_convert_phyloseq_to_data_obj(peerj32.phy)
}