MOFA2 is unsupervised: it generalizes PCA to multiple omics, decomposing variation into latent factors with per-view loadings and a variance-explained table (R^2 per factor per view). That decomposition is the deliverable. Because the factors are found without the phenotype, a factor need not align with the groups of interest - which makes "a factor that separates my cases and controls" meaningful evidence, but only if the factor is annotated, checked against technical covariates, and shown to be robust rather than mined from many candidates.
The skill owns the MOFA model itself - configuration, training, the variance decomposition, factor labeling, and signed-weight enrichment. Per-omic normalization and HVG selection happen upstream in data-harmonization; supervised integration (where the outcome drives the projection) is the sibling mixomics-analysis; the single-cell MOFA+ path lives in single-cell/multimodal-integration.
BiocManager::install('MOFA2')
pip install mofapy2 # the Python training backend MOFA2 calls via basilisk/reticulate
Conceptual prerequisites and notes:
- Each view must be features-by-samples (the transpose of the usual layout), per-omic normalized and variance-stabilized, and HVG-filtered so feature counts are within an order of magnitude across views.
- Prefer transforming counts to a Gaussian likelihood over using the Poisson likelihood; raw counts in a Gaussian view make factor 1 the library-size factor.
- MOFA tolerates missing samples in a view, so a mosaic cohort can be passed directly rather than intersected to complete cases.
- The trained model serializes to an .hdf5 file whose schema is MOFA2-version-coupled; R and Python (muon/mofax) read the same file but have different option defaults.
Tell your AI agent what you want to do: - "Integrate my RNA-seq, proteomics, and methylation to find shared factors" - "Which factors explain the most variance, and in which views?" - "Tell me which of my MOFA factors are batch factors, not biology" - "Run enrichment on the weights of factor 2, separately for each sign" - "Is factor 3 robust, or does it disappear when I change the seed?"
"I have RNA-seq, proteomics, and methylation on the same 60 patients, with methylation missing for 12 of them. Find the joint latent factors with MOFA2, tell me how much variance each factor explains per view, and which factors are shared versus view-specific."
"Correlate my MOFA factors with both my clinical condition and my technical covariates (batch, sequencing depth), and tell me which factors I should exclude from biological interpretation because they track a technical variable."
"Extract the top positive and top negative features for factor 1 in the RNA view, and run enrichment separately for each sign so I do not conflate the two poles of the axis."
"Retrain my MOFA model with a different seed and fewer factors, and tell me whether the factor that separated my groups recurs - I do not want to build a story on a fragile factor."
scale_views=TRUE only when filtering cannot, and remember it changes the R^2 reading to within-view relative variance.