% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/create_mofa.R
\name{create_mofa_from_SingleCellExperiment}
\alias{create_mofa_from_SingleCellExperiment}
\title{create a MOFA object from a SingleCellExperiment object}
\usage{
create_mofa_from_SingleCellExperiment(
  sce,
  alt_experiments = c("main"),
  assays = c("logcounts"),
  groups = NULL,
  extract_metadata = FALSE
)
}
\arguments{
\item{sce}{SingleCellExperiment object}

\item{alt_experiments}{list, that indicates alternative experiments of the SCE object to load as views.
Default is \code{c("main")} (no altExp's loaded).}

\item{assays}{list, assay(s) of the SCE object to use, each entry specifies assay of the respective entry in \code{alt_experiments}.
Default is \code{c('logcounts')}.}

\item{groups}{a string specifying column name of the colData to use it as a group variable. 
Alternatively, a character vector with group assignment for every sample.
Default is \code{NULL} (no group structure).}

\item{extract_metadata}{logical indicating whether to incorporate the metadata from the SingleCellExperiment object into the MOFA object}
}
\value{
Returns an untrained \code{\link{MOFA}} object
}
\description{
Method to create a \code{\link{MOFA}} object from a SingleCellExperiment object. Multiple views can be loaded using the "alternative Experiments" slots.
}
\examples{
\dontshow{if (requireNamespace("SingleCellExperiment", quietly = TRUE)) withAutoprint(\{ # examplesIf}
# Minimal Example
library(SingleCellExperiment)
# Create SingleCellExperiment with sample data
data1 = matrix(rnorm(50 * 20), 
             nrow = 50, ncol = 20,
             dimnames = list(paste0("gene1_", 1:50),
             paste0("sample_", 1:20)))

data2 = matrix(rnorm(50 * 20), 
             nrow = 50, ncol = 20,
             dimnames = list(paste0("gene2_", 1:50),
             paste0("sample_", 1:20)))
alt_data = SummarizedExperiment(list(counts=data2))

sce <- SingleCellExperiment(
  assays = list(counts = data1),
  altExps = list(alt_data=alt_data)
)
# Create MOFA object
MOFAobject <- create_mofa_from_SingleCellExperiment(
  sce, assays = c("counts","counts"), alt_experiments = c("Main","alt_data")
)
\dontshow{\}) # examplesIf}
}
