CASTLE: Cell-type aware SpaTial domain detection via contrastive learning embedding
- 1Department of Statistics and Probability, Michigan State University, East Lansing, Michigan, United States of America
Abstract
With advances in spatially resolved transcriptomics across platforms and resolutions, it is now possible to measure gene-expression profiles while preserving the tissue microenvironment. Spatial clustering is central to these analyses, and recent graph neural network (GNN)-based approaches have greatly improved their accuracy. Nevertheless, precisely delineating spatial domain boundaries remains a significant challenge. Here we present a novel method CASTLE (Cell-type Aware SpaTial domain detection via contrastive Learning Embedding), by leveraging cell type information for improved spatial domain detection. CASTLE first integrates spatial proximity to construct a spatial graph, refined from cell-type similarity or expression similarity when cell type information is unavailable. Then, a self-supervised, local-context contrastive objective aligns embeddings with their immediate microenvironments. Evaluated across multiple tissues and technology resolutions, CASTLE generally achieves competitive or superior performance across datasets and metrics, with particularly strong accuracy and stability on several benchmarks, and detects spatial domains more accurately and consistently. In downstream analyses, it resolves fine-grained tissue structures and differentiates functional subtypes, supporting more nuanced biological interpretation. Author summary: Spatial transcriptomics allows researchers to measure gene activity while preserving where cells are located in a tissue. A major challenge is to divide tissue into meaningful spatial regions, because these regions often reflect differences in cell types, tissue structure, or disease state. We developed CASTLE, a computational method that improves this process by using information about both spatial location and local cell-type composition. CASTLE builds a biologically informed graph of neighboring spots or cells and learns representations that capture each location’s surrounding tissue environment. Across multiple spatial transcriptomics technologies and tissue types, CASTLE identified spatial domains more accurately and with clearer boundaries than existing methods. In human breast cancer tissue, CASTLE also revealed smaller functional subregions within broader annotated areas, including tumor and stromal compartments with distinct biological programs. These results show that incorporating cell-type information can improve tissue mapping and help researchers better understand tissue organization in health and disease.
Related
- TRACER: twin-contrastive learning for fine-grained and rare spatial domain identification in spatial transcriptomics
- MGCF-Net: a multi-view granular-ball contrastive fusion network for spatial transcriptomics clustering.
- Improving Molecular-Morphology Contrastive Pretraining using Deep-Learning-based Morphology Profiles
- Katalyst: knowledge-guided semantic alignment via contrastive learning for enzyme turnover prediction
- EvoGraph: synergizing evolutionary semantics and tail-aware graph contrastive learning for protein-protein interaction prediction.
BibTeX
@article{wei2026castle,
title = {{CASTLE: Cell-type aware SpaTial domain detection via contrastive learning embedding}},
author = {Lai Wei and Aoqi Xie and Yuehua Cui},
journal = {PLOS Genetics},
year = {2026},
month = nov,
doi = {10.1371/journal.pgen.1012365},
url = {https://journals.plos.org/plosgenetics/article?id=10.1371/journal.pgen.1012365},
note = {CC BY 4.0},
}
RIS
TY - JOUR
TI - CASTLE: Cell-type aware SpaTial domain detection via contrastive learning embedding
AU - Lai Wei
AU - Aoqi Xie
AU - Yuehua Cui
PY - 2026
DA - 2026/11/17
JO - PLOS Genetics
DO - 10.1371/journal.pgen.1012365
UR - https://journals.plos.org/plosgenetics/article?id=10.1371/journal.pgen.1012365
AB - With advances in spatially resolved transcriptomics across platforms and resolutions, it is now possible to measure gene-expression profiles while preserving the tissue microenvironment. Spatial clustering is central to these analyses, and recent graph neural network (GNN)-based approaches have greatly improved their accuracy. Nevertheless, precisely delineating spatial domain boundaries remains a significant challenge. Here we present a novel method CASTLE (Cell-type Aware SpaTial domain detection via contrastive Learning Embedding), by leveraging cell type information for improved spatial domain detection. CASTLE first integrates spatial proximity to construct a spatial graph, refined from cell-type similarity or expression similarity when cell type information is unavailable. Then, a self-supervised, local-context contrastive objective aligns embeddings with their immediate microenvironments. Evaluated across multiple tissues and technology resolutions, CASTLE generally achieves competitive or superior performance across datasets and metrics, with particularly strong accuracy and stability on several benchmarks, and detects spatial domains more accurately and consistently. In downstream analyses, it resolves fine-grained tissue structures and differentiates functional subtypes, supporting more nuanced biological interpretation. Author summary: Spatial transcriptomics allows researchers to measure gene activity while preserving where cells are located in a tissue. A major challenge is to divide tissue into meaningful spatial regions, because these regions often reflect differences in cell types, tissue structure, or disease state. We developed CASTLE, a computational method that improves this process by using information about both spatial location and local cell-type composition. CASTLE builds a biologically informed graph of neighboring spots or cells and learns representations that capture each location’s surrounding tissue environment. Across multiple spatial transcriptomics technologies and tissue types, CASTLE identified spatial domains more accurately and with clearer boundaries than existing methods. In human breast cancer tissue, CASTLE also revealed smaller functional subregions within broader annotated areas, including tumor and stromal compartments with distinct biological programs. These results show that incorporating cell-type information can improve tissue mapping and help researchers better understand tissue organization in health and disease.
SN - 1553-7404
SN - 1553-7390
ER -