Skip to contents

This function converts a MultiAssayExperiment object into a list (data object) containing the assays data, and colData. The returned list represents a dataset with features (OTUs or taxa), metadata, and feature annotations.

Usage

mStat_convert_MultiAssayExperiment_to_data_obj(mae.obj, experiment_name = NULL)

Arguments

mae.obj

A MultiAssayExperiment object to be converted.

experiment_name

A string to specify which experiment in the MultiAssayExperiment object to be converted. Default is the first experiment.

Value

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

  • feature.tab: A matrix containing the assay data with rows as features and columns as samples.

  • meta.dat: A data frame containing the colData (metadata).

Details

The function first checks if each component (assays, colData) of the MultiAssayExperiment 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 colData is converted to a data frame. Note that only the rows (features) in the assay data that have a sum > 0 are retained.

Author

Caffery Yang

Examples

if (FALSE) { # \dontrun{
  # Assuming 'mae' is your MultiAssayExperiment object
  # data_obj <- mStat_convert_MultiAssayExperiment_to_data_obj(mae, "16S")

  # If you have an experiment data available as a MultiAssayExperiment object
  # you can convert it to a data object using:
  # library(MultiAssayExperiment)
  # data(mae)
  # data_obj <- mStat_convert_MultiAssayExperiment_to_data_obj(mae, "16S")
} # }