Riemannian metric learning for alignment of spatial multiomics.
The 1 match
- [1] § 3 Results › 3.1 Spatiotemporal transcriptomics of mouse-embryo ↔ demos/mouse_align.ipynb, lines 13–76 · score 0.57 · E10.5, mouse embryo, e9, Spatiotemporal, geodesic, GW
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Jupyter notebook · 207 lines · 6.4 KB · no license · 1 match
- # %%
- import os
- os.environ["CUBLAS_WORKSPACE_CONFIG"] = ":4096:8"
- os.environ["MKL_CBWR"] = "COMPATIBLE"
- os.environ["ATEN_CPU_CAPABILITY"] = "avx2"
- os.environ["OMP_NUM_THREADS"] = os.environ["MKL_NUM_THREADS"] = os.environ["OPENBLAS_NUM_THREADS"] = "8"
- os.environ["NPY_DISABLE_CPU_FEATURES"] = "AVX512F AVX512CD AVX512_KNL AVX512_KNM AVX512_SKX AVX512_CLX AVX512_CNL AVX512_ICL AVX512_SPR"
- os.environ["OPENBLAS_CORETYPE"] = "Haswell"
- import sys
- sys.path.append("..")
- # %% [markdown]
- # # Example Alignment on Spatiotemporal Mouse Embryo
- #
- # We provide an example alignment on two spatiotemporal mouse embryo slices -- `E9.5` and `E10.5` -- from Chen et al '22 (link: https://pubmed.ncbi.nlm.nih.gov/35512705/).
- #
- # In particular, we show the alignment of `MGW` on the public `E9.5_E1S1.MOSTA.h5ad` and `E10.5_E1S1.MOSTA.h5ad` files. A key point is that no fused FGW feature information is used, so this alignment is treated as if the data were "multimodal."
- # %%
- # ============================================================
- # M-GW: Pairwise Alignment of Spatiotemporal Mouse Embryo Slices
- # ============================================================
- import scanpy as sc
- import anndata as ad
- import numpy as np, torch, scipy.sparse as sp
- from mgw import util, models, plotting, geometry
- from mgw import pullback_metric_field, knn_graph
- from mgw.gw import solve_gw_ott
- import importlib
- import matplotlib.pyplot as plt
- import os
- # ----------------------------
- # Runtime & device setup
- # ----------------------------
- device = 'cuda' if torch.cuda.is_available() else 'cpu'
- torch.set_default_dtype(torch.float64)
- print("Device:", device)
- # ----------------------------
- # Input files & parameters
- # ----------------------------
- filehandles_embryo_adata = [
- '/scratch/gpfs/BRAPHAEL/ph3641/mouse_embryo/E9.5_E1S1.MOSTA.h5ad',
- '/scratch/gpfs/BRAPHAEL/ph3641/mouse_embryo/E10.5_E1S1.MOSTA.h5ad'
- ]
- timepoints = ['E9.5', 'E10.5']
- # Embedding / network parameters
- PCA_comp = 30
- knn_k = 12
- geodesic_eps = 0.01
- gw_params = dict(verbose=True, inner_maxit=3000, outer_maxit=3000,
- inner_tol=1e-7, outer_tol=1e-7, epsilon=1e-4)
- save_dir = "/scratch/gpfs/BRAPHAEL/ph3641/mgw/ME_Alignments"
- os.makedirs(save_dir, exist_ok=True)
- # ============================================================
- # 1. Load datasets and prepare
- # ============================================================
- print('Loading AnnData slices...')
- adatas = []
- for i, fh in enumerate(filehandles_embryo_adata):
- adata = sc.read_h5ad(fh)
- adata.X = adata.layers['count']
- adata.obs['timepoint'] = [timepoints[i]] * adata.shape[0]
- adatas.append(adata)
- # Intersect genes across all slices
- common_genes = sorted(set.intersection(*[set(a.var_names) for a in adatas]))
- adatas = [a[:, common_genes] for a in adatas]
- print(f"Common genes: {len(common_genes)}")
- # %%
- from mgw import metrics
- from mgw import mgw as mgw
- from scipy.spatial.distance import cdist
- ad1, ad2 = adatas[0], adatas[1]
- tp1, tp2 = timepoints[0], timepoints[1]
- print(f"\n--- Aligning {tp1} → {tp2} ---")
- # Normalization, log1p, PCA
- joint = ad.concat([ad1, ad2], join='inner')
- sc.pp.normalize_total(joint)
- sc.pp.log1p(joint)
- sc.pp.pca(joint, n_comps=PCA_comp)
- # Split back into slices
- A = joint[joint.obs['timepoint'] == tp1].copy()
- B = joint[joint.obs['timepoint'] == tp2].copy()
- # ========================================================
- # (a) Feature preprocessing (PCA + CCA "feeler")
- # ========================================================
- pre = mgw.mgw_preprocess(
- A, B,
- PCA_comp=30,
- CCA_comp=3,
- use_cca_feeler=True,
- use_pca_X=True,
- use_pca_Z=True,
- log1p_X=True,
- log1p_Z=True,
- verbose=True,
- feature_only=False,
- spatial_only=True,
- rep_norm="zscore",
- )
- # %%
- PCA_component = 30
- CCA_component = 3
- PHI_ARC = (128,256,256,128)
- KNN_K= 12
- DEFAULT_GW_PARAMS = dict(verbose=True, inner_maxit=3000, outer_maxit=3000, inner_tol=1e-7, outer_tol=1e-7, epsilon=1e-4)
- DEFAULT_LR = 1e-3
- DEFAULT_EPS = 1e-2
- DEFAULT_ITER = 20_000
- SEED = 1
- # %%
- EXP_PATH = None #specify the path to save your trained phi psi model (None: retrain without caching)
- EXP_TAG = f'ME_CCA_seed{SEED}' #specify the name of your experiment
- # %%
- out = mgw.mgw_align_core(
- pre,
- widths=PHI_ARC,
- lr=DEFAULT_LR,
- niter=DEFAULT_ITER,
- knn_k=KNN_K,
- geodesic_eps=DEFAULT_EPS,
- save_dir=EXP_PATH,
- tag=EXP_TAG,
- verbose=True,
- plot_net=True,
- gw_params = DEFAULT_GW_PARAMS,
- seed=SEED,
- deterministic=True,
- n_restarts=1,
- )
- # %% [markdown]
- # # We can plot the associated alignment after rigid-transformation into a common frame with Procrustes.
- # %%
- xs = out["xs"]
- xs2 = out["xs2"]
- P = out["P"]
- xs_aligned, xt_aligned, R, tvec = plotting.procrustes_from_coupling(xs, xs2, P)
- plotting.plot_alignment_lines_dense(xs, xs2, P, alpha=0.01)
- # %% [markdown]
- # # We can check the orientation of the alignment.
- # %%
- Y = (P @ xs2) / P.sum(1, keepdims=True)
- U, _, Vt = np.linalg.svd((xs - xs.mean(0)).T @ (Y - Y.mean(0)))
- print(f"orientation det = {np.linalg.det(U @ Vt):+.0f}")
- PAPER_P = '/scratch/gpfs/BRAPHAEL/ph3641/mgw/ME_Alignments/P_E9.5_E10.5.npz'
- if os.path.isfile(PAPER_P):
- P_ref = sp.load_npz(PAPER_P)
- Y_ref = np.asarray(P_ref @ xs2) / np.asarray(P_ref.sum(1))
- print(f"distance to paper MGW map = {np.sqrt(((Y - Y_ref) ** 2).sum(1).mean()):.3f}")
- # %% [markdown]
- # # We can also view the alignment as two tilted layers joined by the coupling's peak links.
- # %%
- from mgw import align_vis
- top, bottom, _ = align_vis.coarsen_to_shared_annotations(A.obs["annotation"].astype(str).to_numpy(),
- B.obs["annotation"].astype(str).to_numpy(), max_classes=7)
- _ = align_vis.plot_tilted_alignment(
- A.obsm["spatial"], B.obsm["spatial"], top, bottom, P,
- dataset_title=f"Mouse embryo {tp1} → {tp2} · MGW", top_name=tp1, bottom_name=tp2,
- label_description="original tissue annotations", k_per_point=3)
- # %% [markdown]
- # # One can also project the annotations through the alignment to find the `mgw` predicted clusters.
- # %%
- A_labels = plotting._labels_or_cluster(A, key="annotation")
- B_labels = plotting._labels_or_cluster(B, key="annotation")
- A_pred, A_conf, _ = plotting.project_labels_via_P(P.T, B_labels, direction="A_to_B")
- plotting.plot_projected_labels(B.obsm['spatial'], A.obsm['spatial'],
- B_labels, A_pred, conf_thresh=0.5, s=10)
mouse_align.ipynb at commit 944e84a, no license · at the source
Overview
Abstract
Motivation: Recent spatial technologies measure the transcriptome, epigenome, proteome, metabolome, and other modalities from thousands of cells across a tissue. Most assays typically profile only one modality from a tissue slice, raising the question of how to align spatial data from heterogeneous feature spaces. While multiple approaches have been developed for multi-modal integration of single-cell datasets, few existing techniques perform spatial alignment across arbitrary modalities incorporating both spatial and feature information.
Results: We introduce Manifold Gromov-Wasserstein (MGW), a metric-learning framework that exploits the product structure of spatial multiomics to infer modality-specific Riemannian pull-back metrics with neural fields. MGW aligns Riemannian distances induced by these metrics via Gromov-Wasserstein optimal transport, yielding a hyperparameter-free cost across arbitrary modalities sharing a spatial base. The formulation enjoys theoretical invariances—including orthogonal transformations of the spatial and feature domains as well as global feature scalings. We demonstrate the advantages of MGW on multiple alignment tasks, including Stereo-Seq spatiotemporal transcriptomics of mouse embryo, Xenium and Visium spatial transcriptomics of colorectal cancer, and spatial metabolomics-transcripto
Availability and implementation: Software is available at https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Repositories
Its files are read in the Code ↔ Paper reader above, with 1 match between paragraphs and lines of code.
raphael-group/MGW
944e84a286bc434e513cc940524576c0de071cb6, 24 September 2026Availability: 1 check, the latest on 27 September 2026: the link answers
- 27 September 2026: the link answers
6 files
- demos/
.ipynb_checkpoints/ , Jupyter, 222 linesdemo_mgw_y7-checkpoint.i pynb - demos/
.ipynb_checkpoints/ , Jupyter, 177 linesriemannian_mouse_geodesi cs-checkpoint.ipynb - demos/
demo_mgw_r114.ipynb , Jupyter, 249 lines - demos/
demo_mgw_y7.ipynb , Jupyter, 222 lines - demos/
mouse_align.ipynb , Jupyter, 207 lines, 1 match - repository limit reached (2,000 files or 30 MB): the rest is at the source (56 files)
- README.md, Text, 152 lines
Zenodo 20074368
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
- 27 September 2026: the link answers (HTTP 200)
Availability and implementation
Software is available at https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 5 scripts, each with its path and the digest of its content;
- 1 match between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
Datasets cited
- data.mendeley.com/
datasets/ , at Mendeley Data; found in “Data availability”w7nw4km7xd - zenodo:14986870, at Zenodo; found in “Data availability”
Data availability
The spatial multiomics datasets analyzed in this study are publicly available from their original publications and associated data repositories:
- The spatiotemporal mouse transcriptomics Stereo-Seq data (Chen 2022) is available via the MOSTA database.
- The Visium and Xenium colorectal cancer (CRC) dataset (Oliveira 2024) is available from the 10x Genomics spatial genomics data repository.
- The MALDI-MSI metabolomics and Visium transcriptomics dataset of human striatum (Vicari 2023) is available at Mendeley Data under accession: https://
- The AFADESI-MSI metabolomics and Visium transcriptomics dataset of human clear cell renal carcinoma (ccRCC) (Tian 2025) is available at Zenodo under accession (https://
The open-source Python implementation of MGW, along with tutorials and scripts to reproduce the experiments described in this manuscript, is freely available on GitHub at https://
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 3 authors, 9 MeSH terms, 2 funders, 35 references.
Cite
This paper
Halmos, P., Xia, Y., & Raphael, B. J. (2026). Riemannian metric learning for alignment of spatial multiomics. Bioinformatics (Oxford, England), 42(Suppl 1), btag220. https://
BibTeX
@article{halmos2026riema
author = {Halmos, Peter and Xia, Yufan and Raphael, Benjamin J},
title = {{Riemannian metric learning for alignment of spatial multiomics}},
journal = {Bioinformatics (Oxford, England)},
year = {2026},
month = jul,
volume = {42},
number = {Suppl 1},
pages = {btag220},
publisher = {Oxford University Press},
issn = {1367-4803},
doi = {10.1093/
url = {https://
pmid = {42412825},
pmcid = {PMC13340267}
}
RIS
TY - JOUR
AU - Halmos, Peter
AU - Xia, Yufan
AU - Raphael, Benjamin J
TI - Riemannian metric learning for alignment of spatial multiomics
T2 - Bioinformatics (Oxford, England)
J2 - Bioinformatics
PY - 2026
DA - 2026/
VL - 42
IS - Suppl 1
SP - btag220
SN - 1367-4803
PB - Oxford University Press
DO - 10.1093/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1093/
"type": "article-journal",
"title": "Riemannian metric learning for alignment of spatial multiomics",
"container-title": "Bioinformatics (Oxford, England)",
"author": [
{
"family": "Halmos",
"given": "Peter"
},
{
"family": "Xia",
"given": "Yufan"
},
{
"family": "Raphael",
"given": "Benjamin J"
}
],
"container-title-short":
"volume": "42",
"issue": "Suppl 1",
"page": "btag220",
"DOI": "10.1093/
"PMID": "42412825",
"PMCID": "PMC13340267",
"ISSN": "1367-4803",
"publisher": "Oxford University Press",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
7,
1
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1093/bioinformatics/btag540 [code]
- Deciphering spatial heterogeneity by multimodal spatial transcriptomics modelling with SpatialModal.Journal: Bioinformatics (Oxford, England)In common: Squidpy, anndata, Scanpy, 5 other tools, methods / tools, genetics / omics, mouse, 8 references
- [2] doi:10.1093/bib/bbag331 [code]
- SPOmiAlign: a modality-agnostic computational framework for multimodal spatial omics alignment enabled by a feature matching foundation model.Journal: Briefings in bioinformaticsIn common: anndata, Scanpy, PyTorch, 3 other tools, Zenodo 14986870, methods / tools, genetics / omics, mouse, 5 references
- [3] doi:10.1038/s41592-026-03194-8 [code]
- Beyond benchmarking: an expert-guided consensus approach to spatially aware clustering.Journal: Nature methodsIn common: Squidpy, anndata, Scanpy, 5 other tools, methods / tools, genetics / omics, 6 references
- [4] doi:10.1002/advs.77003 [code]
- SemanticST: A Scalable Multi-Contextual Graph Learning Framework for Uncovering Spatial Niches and Robust Multi-Sample Integration in Spatial Transcriptomics.Journal: Advanced science (Weinheim, Baden-Wurttemberg, Germany)In common: anndata, Scanpy, PyTorch, 4 other tools, methods / tools, genetics / omics, 7 references
- [5] doi:10.21203/rs.3.rs-9676637/v1 [code]
- A Comprehensive Benchmarking of Spatial Deconvolution and Domain Detection Methods across Diverse Tissues and Spatial Transcriptomic TechnologiesJournal: Research Square (preprint)In common: Squidpy, anndata, Scanpy, 5 other tools, methods / tools, genetics / omics, 4 references
- [6] doi:10.1038/s42003-026-10462-y [code]
- SpaDC enables sequence-based integrative analysis and regulatory inference of spatial chromatin accessibility data.Journal: Communications biologyIn common: Squidpy, anndata, Scanpy, 5 other tools, genetics / omics, mouse, 4 references
- [7] doi:10.1093/bib/bbag298 [code]
- Empowering multifaceted analysis of spatial transcriptomics data with RGAST.Journal: Briefings in bioinformaticsIn common: anndata, Scanpy, PyTorch, 4 other tools, methods / tools, genetics / omics, mouse, 5 references
- [8] doi:10.1038/s42003-026-10259-z [code]
- Spatial transcriptomic profiling of developing mouse hearts reveals a spatially patterned signaling environment.Journal: Communications biologyIn common: Squidpy, anndata, Scanpy, 5 other tools, genetics / omics, mouse, 3 references
- [9] doi:10.1093/bioinformatics/btag430 [code]
- SPIDER: spatially integrated denoising via embedding regularization with single cell supervision.Journal: Bioinformatics (Oxford, England)In common: anndata, Scanpy, PyTorch, 4 other tools, genetics / omics, 5 references
- [10] doi:10.1016/j.isci.2026.117206 [code]
- ReliST: A model-agnostic risk layer for spatial transcriptomics deconvolution.Journal: iScienceIn common: anndata, Scanpy, PyTorch, 4 other tools, genetics / omics, mouse, 4 references
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 2 repositories of the authors' code, each at its verified commit and with its license, 5 scripts, and 1 match between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:e7941fbe457f5f98…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
