Quick-reference sheet for OmicVerse tutorials spanning MOFA, GLUE pairing, SIMBA integration, TOSICA transfer, and StaVIA cartography.
This skill covers OmicVerse's multi-omics integration tools for combining scRNA-seq, scATAC-seq, and other modalities. Each method addresses a different scenario—choose based on your data structure and analysis goal.
Pick the right tool before writing any code:
| Scenario | Method | Key Class |
|----------|--------|-----------|
| Paired RNA + ATAC from same cells | MOFA directly | ov.single.pyMOFA |
| Unpaired RNA + ATAC (different experiments) | GLUE pairing → MOFA | ov.single.GLUE_pair → pyMOFA |
| Multi-batch single-modality integration | SIMBA | ov.single.pySIMBA |
| Transfer labels from annotated reference | TOSICA | ov.single.pyTOSICA |
| Trajectory on preprocessed multi-omic data | StaVIA | VIA.core.VIA |
Use MOFA when you have paired measurements (RNA + ATAC from the same cells). MOFA learns shared and modality-specific factors that explain variance across omics layers.
pyMOFA with matching omics and omics_name listsmofa_preprocess() to select HVGs, then mofa_run(outfile=...) to trainpyMOFAART(model_path=...) for correlation, weights, and variance plotsmofapy2; CPU-onlyUse GLUE when RNA and ATAC come from different experiments (unpaired). GLUE aligns cells across modalities by learning a shared embedding, then MOFA identifies joint factors.
.h5ad files with embeddings in .obsm)GLUE_pair and call correlation() to match unpaired cellsmofapy2, scglue, scvi-tools; GPU optional for MDE embeddingUse SIMBA for multi-batch single-modality data (e.g., multiple pancreas studies). SIMBA builds a graph from binned features and learns batch-corrected embeddings via PyTorch-BigGraph.
batch column in .obspySIMBA(adata, workdir) and run the preprocessing pipelinegen_graph() then train(num_workers=...) to learn embeddingsbatch_correction() to get harmonised AnnData with X_simbasimba, simba_pbg; GPU optional, needs adequate CPU threadsUse TOSICA to transfer cell-type labels from a well-annotated reference to a query dataset. TOSICA uses a pathway-masked transformer that also provides attention-based interpretability.
ov.utils.download_tosica_gmt()pyTOSICA with reference AnnData, GMT path, label key, and project pathtrain(epochs=...), save, then predict on query datadepth=1 recommended (depth=2 doubles memory)Use StaVIA/VIA for trajectory inference on preprocessed data with velocity information. VIA computes pseudotime, cluster graphs, and stream plots.
v0.run_VIA() and extract pseudotime from single_cell_pt_markovscvelo, pyVIA; CPU-boundomics must be a list of separate AnnData objects# CORRECT — each modality is a separate AnnData
mofa = ov.single.pyMOFA(omics=[rna_adata, atac_adata], omics_name=['RNA', 'ATAC'])
# WRONG — do NOT pass a single concatenated AnnData
# mofa = ov.single.pyMOFA(omics=combined_adata, omics_name=['RNA', 'ATAC']) # TypeError!
The omics list and omics_name list must have the same length. Each AnnData should contain cells from the same experiment (paired measurements).
preprocess() must run before gen_graph()# CORRECT — preprocess first, then build graph
simba = ov.single.pySIMBA(adata, workdir)
simba.preprocess(batch_key='batch', min_n_cells=3, method='lib_size', n_top_genes=3000, n_bins=5)
simba.gen_graph()
simba.train(num_workers=6)
# WRONG — skipping preprocess causes gen_graph to fail
# simba.gen_graph() # KeyError: missing binned features
gmt_path must be an actual file path# CORRECT — download GMT files first, then pass the file path
ov.utils.download_tosica_gmt()
tosica = ov.single.pyTOSICA(adata=ref, gmt_path='genesets/GO_bp.gmt', ...)
# WRONG — passing a database name string instead of file path
# tosica = ov.single.pyTOSICA(adata=ref, gmt_path='GO_Biological_Process', ...) # FileNotFoundError!
outfile directory must existimport os
os.makedirs('models', exist_ok=True) # Create output directory first
mofa.mofa_run(outfile='models/rna_atac.hdf5')
Always validate inputs before running integration methods:
# Before MOFA: verify inputs are compatible
assert isinstance(omics, list), "omics must be a list of AnnData objects"
assert len(omics) == len(omics_name), f"omics ({len(omics)}) and omics_name ({len(omics_name)}) must match in length"
for i, a in enumerate(omics):
assert a.n_obs > 0, f"AnnData '{omics_name[i]}' has 0 cells"
assert a.n_vars > 0, f"AnnData '{omics_name[i]}' has 0 genes/features"
# Before SIMBA: verify batch column exists
assert 'batch' in adata.obs.columns, "adata.obs must contain a 'batch' column for SIMBA"
assert adata.obs['batch'].nunique() > 1, "Need >1 batch for batch integration"
# Before TOSICA: verify GMT file exists and reference has labels
import os
assert os.path.isfile(gmt_path), f"GMT file not found: {gmt_path}. Run ov.utils.download_tosica_gmt() first."
assert label_name in ref_adata.obs.columns, f"Label column '{label_name}' not found in reference AnnData"
# Before StaVIA: verify PCA and neighbors are computed
assert 'X_pca' in adata.obsm, "PCA required. Run ov.pp.pca(adata) first."
assert 'neighbors' in adata.uns, "Neighbor graph required. Run ov.pp.neighbors(adata) first."
PermissionError or OSError writing MOFA HDF5: The output directory for mofa_run(outfile=...) must exist and be writable. Create it with os.makedirs() before training.correlation() returns empty DataFrame: The RNA and ATAC embeddings have no overlapping features. Verify both AnnData objects have been through GLUE preprocessing and contain embeddings in .obsm.gen_graph() runs out of memory: Reduce n_top_genes (try 2000) or increase n_bins to compress the feature space. SIMBA graph construction scales with gene count.FileNotFoundError after download_tosica_gmt(): The download writes to genesets/ in the current working directory. Verify the file exists at the expected path, or pass an absolute path.root_user mismatch: The root must be a value that exists in the true_label array. Check adata.obs['clusters'].unique() to find valid root names.ImportError: No module named 'mofapy2': Install with pip install mofapy2. Similarly, SIMBA needs pip install simba simba_pbg.sc.pp.filter_genes(adata, min_cells=10) before MOFA.t_mofa.ipynbt_mofa_glue.ipynbt_simba.ipynbt_tosica.ipynbt_stavia.ipynbreference.mdnpx skills add Starlitnightly/single-cell-multi-omics-integration下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Category:science-education