% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mofa2.R
\name{mofa2}
\alias{mofa2}
\title{One-liner wrapper to create a MOFA2 object from multiple input objects and ready for training}
\usage{
mofa2(
  data,
  assays = NULL,
  groups = NULL,
  covariates = NULL,
  extract_metadata = TRUE,
  ...
)
}
\arguments{
\item{data}{input data. See \code{\link{create_mofa}} for details on input data formats.}

\item{assays}{Assays to include in MOFA model. Used for \code{\link[MultiAssayExperiment:MultiAssayExperiment]{MultiAssayExperiment}}, \code{\link[SingleCellExperiment:SingleCellExperiment]{SingleCellExperiment}} and \code{\link[SeuratObject:CreateSeuratObject]{Seurat}} objects.}

\item{groups}{One of the variable names of sample metadata from which groups should be derived. Only relevant when using the multi-group framework with one of the three formats above. Default is \code{NULL}.}

\item{covariates}{Continuous covariates to use for training with MEFISTO, see also \code{\link{set_covariates}}. Default is \code{NULL} (no covariates).}

\item{extract_metadata}{Boolean specifying whether sample metadata from the input object should be propagated to the MOFA2 object  (default is \code{TRUE}).}

\item{...}{additional arguments; either data parameters as in \code{\link{create_mofa}}, or MOFA model parameters, named as the options of \code{\link{prepare_mofa}}.}
}
\value{
Returns an untrained \code{\link{MOFA}} with specified options
filled in the corresponding slots
}
\description{
This is a one-line wrapper that combines the use of \code{\link{create_mofa}} followed by \code{\link{prepare_mofa}}.
Please read the documentation of the corresponding functions for more details.
}
\examples{
# Example with MultiAssayExperiment
library(mia)
data("HintikkaXOData", package = "mia")
mae <- HintikkaXOData
mofa_obj <- mofa2(
 mae, 
 experiments = c(1,3),
 assays = list("counts", "signals"), 
 num_factors = 5
)
# Example with long data.frame format (two views and two groups)
file <- system.file("extdata", "test_data.RData", package = "MOFA2")
load(file) 
mofa_obj <- mofa2(dt)
# Example with list of matrices
mtx <- make_example_data()$data
mofa_obj <- mofa2(mtx)
}
