Convert SummarizedExperiment Object to a MicrobiomeStat Data Object
Source:R/mStat_convert_SummarizedExperiment_to_data_obj.R
mStat_convert_SummarizedExperiment_to_data_obj.Rd
This function converts a SummarizedExperiment object into a list (MicrobiomeStat data object) containing the assays data, rowData, and colData. The returned list represents a microbiome dataset with features (OTUs or taxa), metadata, and feature annotations.
Value
A MicrobiomeStat data object (a list) containing the following elements:
feature.tab: A matrix containing the assay data with rows as features and columns as samples.
feature.ann: A matrix containing the rowData (feature annotations). Only features present in the assay data are included.
meta.dat: A data frame containing the colData (metadata).
Details
The function first checks if each component (assays, rowData, colData) of the SummarizedExperiment object is not null. If a component is not null, it is converted to the appropriate format and added to the output list. The assays data is converted to a matrix, while the rowData and colData are converted to data frames. Note that only the rows (features) in the assay data that have a sum > 0 are retained.
Examples
if (FALSE) { # \dontrun{
# Assuming 'se' is your SummarizedExperiment object
# data_obj <- mStat_convert_SummarizedExperiment_to_data_obj(se)
# If you have airway data available as a SummarizedExperiment object
# you can convert it to a MicrobiomeStat data object using:
# library(airway)
# data(airway)
# airway_obj <- mStat_convert_SummarizedExperiment_to_data_obj(airway)
} # }