Convert a Phyloseq Object to a MicrobiomeStat's Data Object
Source:R/mStat_convert_phyloseq_to_data_obj.R
mStat_convert_phyloseq_to_data_obj.Rd
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.
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.