Skip to content
Back to skills

Bio Applied Mofa2

ASecurity

MOFA2 unsupervised multi-omics factor analysis: variance decomposition, factor interpretation, and shared/view-specific signal separation. Use when integrating multiple omics layers.

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added May 27, 2026
data-aipythongitdocumentation

Works with

  • cli

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add Pavel-Kravchenko/Bioinformatics --skill bio-applied-mofa2 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Bio Applied Mofa2?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Bio Applied Mofa2
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/pavel-kravchenko-bio-applied-mofa2/badge)](https://www.skillsdirectory.com/skills/pavel-kravchenko-bio-applied-mofa2)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: bio-applied-mofa2
description: "MOFA2 unsupervised multi-omics factor analysis: variance decomposition, factor interpretation, and shared/view-specific signal separation. Use when integrating multiple omics layers."
tool_type: python
primary_tool: Matplotlib
---

# MOFA2: Multi-Omics Factor Analysis

- [MOFA2 documentation](https://biofam.github.io/MOFA2/)
- [mofapy2 Python package](https://github.com/bioFAM/mofapy2)

## Generative Model

X_m = Z @ W_m.T + noise, for each omics view m.
- **Z** (N x K): shared latent factors across views
- **W_m** (D_m x K): view-specific feature weights

## Usage

```python
# Via mofapy2
from mofapy2.run.entry_point import entry_point
ent = entry_point()
ent.set_data_options(scale_groups=False, scale_views=True)
ent.set_data_df(data_df)  # long-format: sample, group, feature, view, value
ent.set_model_options(factors=10)
ent.set_train_options(iter=1000, convergence_mode="fast")
ent.build(); ent.run(); ent.save("mofa_model.hdf5")

# Via muon (recommended)
import muon as mu
mdata = mu.MuData({'rna': rna_adata, 'prot': prot_adata})
mu.tl.mofa(mdata, n_factors=10, outfile="model.hdf5")
```

## Model Parameters

| Parameter | Default | Notes |
|---|---|---|
| `n_factors` | 10 | Number of latent factors |
| `convergence_mode` | "fast" | fast/medium/slow |
| `spikeslab_weights` | True | Sparse weights (ARD prior) |
| `scale_views` | True | Normalize each view to unit variance |

## Variance Decomposition (R^2 per Factor per View)

| Pattern | Interpretation |
|---|---|
| High R^2 in all views | Shared biological signal |
| High R^2 in one view only | View-specific signal (e.g., epigenetic reprogramming) |

Optimal factors: start with 15-20, prune inactive (R^2 < 2%). Robustness: factors consistent across random seeds.

## Factor Interpretation Workflow

1. Correlate factor scores with metadata (sample type, clinical variables)
2. Top weighted features -> candidate genes/proteins/CpGs
3. Gene set enrichment on top RNA weights -> pathway interpretation

## MOFA2 vs PCA

| Aspect | PCA | MOFA2 |
|---|---|---|
| Input | Single matrix | Multiple matrices |
| Shared vs specific | Mixed | Explicit separation |
| Missing views | Cannot handle | Native support |
| Sparse weights | No | Yes (ARD prior) |

## Pitfalls

- **Factor 1 depth artifact**: Check whether Factor 1 correlates with library size rather than biology
- **Batch effects**: If batch confounds biology, MOFA will capture batch as a factor -- check factor-metadata correlations
- **View scaling**: Always set `scale_views=True` so high-dimensional views don't dominate

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.