#' Coerce from \code{\link[metagenomeSeq]{MRexperiment}} to \code{\link[MicrobiomeExperiment]{MicrobiomeExperiment}}
#'
#' @param obj object of type \code{\link[metagenomeSeq]{MRexperiment}}
#'
#' @return An object of class \code{\link[MicrobiomeExperiment]{MicrobiomeExperiment}}
#' @export
#' @examples
#' if(requireNameSpace("metagenomeSeq")) {
#' data("mouseData")
#' as(mouseData, "MicrobiomeExperiment")
#' }
makeMicrobiomeExperimentFromMRexperiment <- function(obj) {
counts <- MRcounts(obj)
sample_data <- pData(obj)
feature_data <- fData(obj)
MicrobiomeExperiment(assays=list(counts=counts), colData=sample_data,
rowData=MicrobiomeFeatures(taxa=feature_data))
}
setAs(from="MRexperiment", to="MicrobiomeExperiment", function(from) {
makeMicrobiomeExperimentFromMRexperiment(from)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.