Convert a MRExperiment Object to a MicrobiomeStat Data Object
Source:R/mStat_convert_MRExperiment_to_data_obj.R
mStat_convert_MRExperiment_to_data_obj.Rd
This function is a part of the MicrobiomeStat package. It converts a MRExperiment object into a list (MicrobiomeStat data object) containing the expression data, samples data, and feature annotations. The returned list represents a microbiome dataset with features (OTUs or taxa), sample metadata, and feature annotations.
Value
A MicrobiomeStat data object (a list) containing the following elements:
feature.tab: A matrix containing the expression data with rows as features and columns as samples.
meta.dat: A data frame containing the samples data.
feature.ann: A matrix containing feature annotations.
Details
The function first checks if each component (expression data, samples, feature annotations) of the MRExperiment object is not null. If a component is not null, it is converted to the appropriate format and added to the output list. The expression data and feature annotations are converted to a matrix, while the samples data is converted to a data frame. Note that only the rows (features) in the expression data that have a sum > 0 are retained.
References
Paulson JN, Stine OC, Bravo HC, Pop M. Differential abundance analysis for microbial marker-gene surveys. Nature Methods. 2013;10(12):1200-1202.
Examples
if (FALSE) { # \dontrun{
# Load necessary packages
# library(MetagenomeSeq)
# Load dataset
# data("MRexperiment")
# mr <- MRexperiment(counts = counts(MRexperiment), pData = pData(MRexperiment)
# , fData = fData(MRexperiment))
# Convert to MicrobiomeStat data object
# data.obj <- mStat_convert_MRExperiment_to_data_obj(mr)
} # }