New Algorithm Maps Complex Tissue Microenvironments With Single-Cell Precision
Genetics

New Algorithm Maps Complex Tissue Microenvironments With Single-Cell Precision

By integrating cell type composition into spatial graphs, a new computational tool uncovers hidden subdomains in brain and cancer tissues.

By Elizabeth Taylor
Published:
Email this Article
New Algorithm Maps Complex Tissue Microenvironments With Single-Cell Precision
Spatial clustering on the human breast cancer ST data. (a) The manual domain annotation served as the ground truth. (b) Domains detected by CASTLE. (c) The ARI values of four representative methods. (d) The KEGG enrichment analysis of Cluster 4 and 18, focusing on the Healthy_1 region. (e) Expression distribution of the identified marker gene ACTA2 associated with Cluster 4. (f) The comparison of Reactome enrichment analysis of Clusters 8, 10, and 19, focusing on the IDC_2 region. (g) Expression distribution of the identified marker gene AC093001.1 associated with Cluster 8. Lai Wei et al. / PLOS Genetics

A new computational method named CASTLE helps scientists map the microscopic architecture of tissues by integrating spatial gene expression data with cell type information, overcoming a long-standing challenge in spatial biology.

How Cell Type Awareness Sharpens Tissue Boundaries

Spatially resolved transcriptomics allows researchers to measure gene activity within tissues while keeping the physical location of cells intact. A central step in analyzing these datasets is spatial clustering, which groups neighboring cells or measurement spots into distinct regions, such as cortical layers in the brain or specific tumor microenvironments in cancer. Many existing graph-based methods rely only on physical proximity to build networks of neighboring cells, which can blur sharp boundaries where different tissue compartments meet. To solve this, a team of researchers developed CASTLE, short for Cell-type Aware SpaTial domain detection via contrastive Learning Embedding.

The method is described in a study published in PLOS Genetics by Lai Wei, Aoqi Xie, and Yuehua Cui from Michigan State University. Instead of relying purely on spatial distance, CASTLE builds a biologically informed network by combining physical coordinates with cell type compositions derived from deconvolution techniques or direct single-cell annotations. When cell type labels are missing, the algorithm falls back on gene expression similarity to maintain robust performance across different types of experimental platforms.

Testing Performance Across Diverse Tissues and Platforms

The authors evaluated CASTLE against nine other computational methods using datasets from various technologies, including 10x Visium, MERFISH, STARmap, Stereo-seq, and Slide-seqV2. Across 12 sections of the human dorsolateral prefrontal cortex, CASTLE achieved the highest median Adjusted Rand Index, a statistical measure of agreement with expert annotations, and showed lower variability across samples than competing approaches. In mouse main olfactory bulb data, the algorithm accurately separated concentric layers, such as the granule cell layer and the rostral migratory stream, which were frequently conflated by other tools.

Fig 1: Overview of CASTLE. CASTLE starts with the gene-expression matrix and performs data augmentation for self-supervised contrastive learning. It builds a cell type–aware spatial graph by combining spatial proximity with biologically informed similarity from (deconvolved) cell-type compositions or expression-based similarity when labels are unavailable. Using this graph, CASTLE learns low-dimensional embeddings that preserve informative signals from gene expression, spatial location, and the local neighborhood context. A decoder then maps these embeddings back to the original feature space to reconstruct the expression matrix, which is then used for spatial clustering and supports downstream analyses such as domain interpretation, pathway enrichment, and microenvironment profiling.
Overview of CASTLE. CASTLE starts with the gene-expression matrix and performs data augmentation for self-supervised contrastive learning. It builds a cell type–aware spatial graph by combining spatial proximity with biologically informed similarity from (deconvolved) cell-type compositions or expression-based similarity when labels are unavailable. Using this graph, CASTLE learns low-dimensional embeddings that preserve informative signals from gene expression, spatial location, and the local neighborhood context. A decoder then maps these embeddings back to the original feature space to reconstruct the expression matrix, which is then used for spatial clustering and supports downstream analyses such as domain interpretation, pathway enrichment, and microenvironment profiling. Credit: Lai Wei et al. / PLOS Genetics

When applied to human breast cancer tissue, CASTLE not only recovered broad architectural regions like invasive ductal carcinoma and ductal carcinoma in situ, but also uncovered functionally distinct subdomains within those categories. Pathway enrichment analyses revealed that these subdomains reflected underlying biological differences, such as extracellular matrix remodeling, oxidative phosphorylation, and translation control programs.

Limitations and Future Directions

Despite its strong performance, the authors note several limitations. The current framework assumes that tissue domains are reflected in local cell type composition, meaning it may provide less benefit in tissues where boundaries are driven strictly by subtle transcriptional states rather than cellular mixing. Furthermore, inaccuracies in upstream cell type deconvolution or annotation can propagate into the graph construction step and influence final clustering outcomes. Future improvements could incorporate histology images, uncertainty estimates, and multi-slice batch integration to further enhance spatial domain mapping.

The research was published in PLOS Genetics on November 17, 2026.

Fact Checked

This article has been fact checked for accuracy, with information verified against reputable sources. Learn more about us and our editorial process.

Last reviewed on .

Article history

  • Latest version

Cite this page:

Taylor, Elizabeth. “New Algorithm Maps Complex Tissue Microenvironments With Single-Cell Precision.” BioScience. BioScience ISSN 2521-5760, 17 November 2026. <https://www.bioscience.com.pk/en/subject/genetics/castle-cell-type-aware-spatial-domain-detection-via-contrastive-learning-embedding>. Taylor, E. (2026, November 17). “New Algorithm Maps Complex Tissue Microenvironments With Single-Cell Precision.” BioScience. ISSN 2521-5760. Retrieved November 17, 2026 from https://www.bioscience.com.pk/en/subject/genetics/castle-cell-type-aware-spatial-domain-detection-via-contrastive-learning-embedding Taylor, Elizabeth. “New Algorithm Maps Complex Tissue Microenvironments With Single-Cell Precision.” BioScience. ISSN 2521-5760. https://www.bioscience.com.pk/en/subject/genetics/castle-cell-type-aware-spatial-domain-detection-via-contrastive-learning-embedding (accessed November 17, 2026).
End of the article