Skip to main content

Thank you for visiting You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

SpaGCN: Integrating gene expression, spatial location and histology to identify spatial domains and spatially variable genes by graph convolutional network


Recent advances in spatially resolved transcriptomics (SRT) technologies have enabled comprehensive characterization of gene expression patterns in the context of tissue microenvironment. To elucidate spatial gene expression variation, we present SpaGCN, a graph convolutional network approach that integrates gene expression, spatial location and histology in SRT data analysis. Through graph convolution, SpaGCN aggregates gene expression of each spot from its neighboring spots, which enables the identification of spatial domains with coherent expression and histology. The subsequent domain guided differential expression (DE) analysis then detects genes with enriched expression patterns in the identified domains. Analyzing seven SRT datasets using SpaGCN, we show it can detect genes with much more enriched spatial expression patterns than competing methods. Furthermore, genes detected by SpaGCN are transferrable and can be utilized to study spatial variation of gene expression in other datasets. SpaGCN is computationally fast, platform independent, making it a desirable tool for diverse SRT studies.

This is a preview of subscription content, access via your institution

Access options

Rent or buy this article

Prices vary by article type



Prices may be subject to local taxes which are calculated during checkout

Fig. 1: Workflow of SpaGCN.
Fig. 2: Spatial domains and SVGs detected in the human primary pancreatic cancer tissue data.
Fig. 3: Spatial domains and SVGs detected in the LIBD human dorsolateral prefrontal cortex data.
Fig. 4: Spatial domains and SVGs detected in the mouse brain posterior brain data.
Fig. 5: Joint spatial domain detection across multiple mouse brain tissue sections using SpaGCN.
Fig. 6: Spatial domains and SVGs detected in the mouse visual cortex STARmap data.

Data availability

The authors analyzed seven publicly available SRT datasets. The data were acquired from the following websites or accession numbers: (1) human primary pancreatic cancer ST data (GSE111672); (2) LIBD human dorsolateral prefrontal cortex, dorsolateral prefrontal cortex 10x Visium data (; (3) mouse posterior brain 10x Visium data (; (4) mouse cortex SLIDE-seqV2 data (; (5) mouse visual cortex STARmap data (; (6) mouse olfactory bulb ST data (; (7) mouse hypothalamus MERFISH data ( Details of the datasets analyzed in this paper are described in Supplementary Table 1.

Code availability

An open-source implementation of the SpaGCN algorithm can be downloaded from


  1. Asp, M., Bergenstrahle, J. & Lundeberg, J. Spatially resolved transcriptomes-next generation tools for tissue exploration. Bioessays 42, e1900221 (2020).

    Article  Google Scholar 

  2. Lubeck, E., Coskun, A. F., Zhiyentayev, T., Ahmad, M. & Cai, L. Single-cell in situ RNA profiling by sequential hybridization. Nat. Methods 11, 360–361 (2014).

    Article  CAS  Google Scholar 

  3. Shah, S., Lubeck, E., Zhou, W. & Cai, L. In situ transcription profiling of single cells reveals spatial organization of cells in the mouse hippocampus. Neuron 92, 342–357 (2016).

    Article  CAS  Google Scholar 

  4. Eng, C. L. et al. Transcriptome-scale super-resolved imaging in tissues by RNA seqFISH. Nature 568, 235–239 (2019).

    Article  CAS  Google Scholar 

  5. Moffitt, J. R. et al. Molecular, spatial, and functional single-cell profiling of the hypothalamic preoptic region. Science 362, eaau5324 (2018).

    Article  Google Scholar 

  6. Chen, K. H., Boettiger, A. N., Moffitt, J. R., Wang, S. & Zhuang, X. RNA imaging. Spatially resolved, highly multiplexed RNA profiling in single cells. Science 348, aaa6090 (2015).

    Article  Google Scholar 

  7. Wang, X. et al. Three-dimensional intact-tissue sequencing of single-cell transcriptional states. Science 361, eaat5691 (2018).

    Article  Google Scholar 

  8. Lee, J. H. et al. Highly multiplexed subcellular RNA sequencing in situ. Science 343, 1360–1363 (2014).

    Article  CAS  Google Scholar 

  9. Stahl, P. L. et al. Visualization and analysis of gene expression in tissue sections by spatial transcriptomics. Science 353, 78–82 (2016).

    Article  CAS  Google Scholar 

  10. Rodriques, S. G. et al. Slide-seq: A scalable technology for measuring genome-wide expression at high spatial resolution. Science 363, 1463–1467 (2019).

    Article  CAS  Google Scholar 

  11. Stickels, R. R. et al. Highly sensitive spatial transcriptomics at near-cellular resolution with Slide-seqV2. Nat. Biotechnol. 39, 313–319 (2020).

    Article  Google Scholar 

  12. Vickovic, S. et al. High-definition spatial transcriptomics for in situ tissue profiling. Nat. Methods 16, 987–990 (2019).

    Article  CAS  Google Scholar 

  13. Moncada, R. et al. Integrating microarray-based spatial transcriptomics and single-cell RNA-seq reveals tissue architecture in pancreatic ductal adenocarcinomas. Nat. Biotechnol. 38, 333–342 (2020).

    Article  CAS  Google Scholar 

  14. Chen, W. T. et al. Spatial transcriptomics and in situ sequencing to study Alzheimer’s disease. Cell 182, 976–991 e919 (2020).

    Article  CAS  Google Scholar 

  15. Blondel, V. D., Guillaume, J.-L., Lambiotte, R. & Lefebvre, E. Fast unfolding of communities in large networks. J. Stat. Mech.: Theory Exp. 2008, P10008 (2008).

    Article  Google Scholar 

  16. Zhu, Q., Shah, S., Dries, R., Cai, L. & Yuan, G. C. Identification of spatially associated subpopulations by combining scRNAseq and sequential fluorescence in situ hybridization data. Nat. Biotechnol. 36, 1183–1190 (2018).

    Article  CAS  Google Scholar 

  17. Pham, D. et al. stLearn: Integrating spatial location, tissue morphology and gene expression to find cell types, cell–cell interactions and spatial trajectories within undissociated tissues. Preprint at bioRxiv (2020).

  18. Zhao, E. et al. Spatial transcriptomics at subspot resolution with BayesSpace. Nat. Biotechnol. (2021).

  19. Fu, X. et al. Continuous polony gels for tissue mapping with high resolution and RNA capture efficiency. Preprint at bioRxiv (2021).

  20. Chen, A. et al. Large field of view-spatially resolved transcriptomics at nanoscale resolution. bioRxiv. (2021).

  21. Liu, Y. et al. High-spatial-resolution multi-omics sequencing via deterministic barcoding in tissue. Cell 183, 1665–1681 e1618 (2020).

    Article  CAS  Google Scholar 

  22. Cho, C. S. et al. Microscopic examination of spatial transcriptome using Seq-Scope. Cell 184, 3559–3572 e3522 (2021).

    Article  CAS  Google Scholar 

  23. Edsgard, D., Johnsson, P. & Sandberg, R. Identification of spatial expression trends in single-cell gene expression data. Nat. Methods 15, 339–342 (2018).

    Article  Google Scholar 

  24. Svensson, V., Teichmann, S. A. & Stegle, O. SpatialDE: Identification of spatially variable genes. Nat. Methods 15, 343–346 (2018).

    Article  CAS  Google Scholar 

  25. Sun, S., Zhu, J. & Zhou, X. Statistical analysis of spatial expression patterns for spatially resolved transcriptomic studies. Nat. Methods 17, 193–200 (2020).

    Article  CAS  Google Scholar 

  26. Xie, J., Girshick, R. & Farhadi, A. Unsupervised deep embedding for clustering analysis. In Proc. 33rd International Conference on Machine Learning Vol. 48 (JMLR: W&CP, 2016).

  27. Li, H., Calder, C. A. & Cressie, N. Beyond Moran’s I: testing for spatial dependence based on the spatial autoregressive model. Geographical Anal. 39, 357–375 (2007).

    Article  Google Scholar 

  28. Abdelaal, T., Mourragui, S., Mahfouz, A. & Reinders, M. J. T. SpaGE: Spatial Gene Enhancement using scRNA-seq. Nucleic Acids Res. 48, e107 (2020).

    Article  CAS  Google Scholar 

  29. Cable, D. M. et al. Robust decomposition of cell type mixtures in spatial transcriptomics. Nat. Biotechnol. (2021).

  30. Li, D. et al. KRT17 Functions as a tumor promoter and regulates proliferation, migration and invasion in pancreatic cancer via mTOR/S6k1 pathway. Cancer Manag. Res. 12, 2087–2095 (2020).

    Article  CAS  Google Scholar 

  31. Lee, J., Lee, J. & Kim, J. H. Identification of matrix metalloproteinase 11 as a prognostic biomarker in pancreatic cancer. Anticancer Res. 39, 5963–5971 (2019).

    Article  CAS  Google Scholar 

  32. Maynard, K. R. et al. Transcriptome-scale spatial gene expression in the human dorsolateral prefrontal cortex. Nat. Neurosci. 24, 425–436 (2021).

    Article  CAS  Google Scholar 

  33. Dataset. Mouse posterior brain data. 10x Genomics (2020).

  34. Zhang, Y. et al. Purification and characterization of progenitor and mature human astrocytes reveals transcriptional and functional differences with mouse. Neuron 89, 37–53 (2016).

    Article  CAS  Google Scholar 

  35. Partel, G. & Wahlby, C. Spage2vec: Unsupervised representation of localized spatial gene expression signatures. FEBS J. 288, 1859–1870 (2021).

    Article  CAS  Google Scholar 

  36. Kipf, T. N. & Welling, M. Semi-supervised classification with graph convolutional networks. In Proc. International Conference on Learning Representations. arXiv:1609.02907 (2017).

  37. Rousseeuw, P. J. Silhouettes: a graphical aid to the interpretaion and validation of cluster analysis. Computational Appl. Math. 20, 53–65 (1987).

    Article  Google Scholar 

  38. Lakkis, J. et al. A joint deep learning model enables simultaneous batch effect correction, denoising and clustering in single-cell transcriptomics. Genome Res. (2021).

  39. Li, X. et al. Deep learning enables accurate clustering with batch effect removal in single-cell RNA-seq analysis. Nat. Commun. 11, 2338 (2020).

    Article  CAS  Google Scholar 

Download references


This work was supported by the following grants: R01GM125301, R01EY030192, R01EY031209, R01HL113147 and R01HL150359 (to M.L.), and P01AG066597 (to D.J.I. and E.B.L.). We thank R. Moncada and I. Yanai for sharing the human pancreatic cancer histology image data, and R. Stickles, E. Murray, E. Macosko and F. Chen for sharing the SLIDE-seqV2 data.

Author information

Authors and Affiliations



This study was conceived of and led by M.L. J.H. designed the model and algorithm. J.H. implemented the SpaGCN software and led the data analysis with input from M.L., X.L., K.C., A.S., N.M., D.I., E.L. and R.T.S. N.M. contributed to figure design and generation. J.H. and M.L. wrote the paper with feedback from all other coauthors.

Corresponding authors

Correspondence to Jian Hu or Mingyao Li.

Ethics declarations

Competing interests

The authors declare no competing interests.

Additional information

Peer review information Nature Methods thanks Andrew Jaffe, Kristen Maynard and the other, anonymous, reviewer(s) for their contribution to the peer review of this work. Lin Tang was the primary editor on this article and managed its editorial process and peer review in collaboration with the rest of the editorial team.

Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Supplementary information

Supplementary Information

Supplementary Tables 1–3, Figs. 1–42 and Notes 1–3.

Reporting Summary

Rights and permissions

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Hu, J., Li, X., Coleman, K. et al. SpaGCN: Integrating gene expression, spatial location and histology to identify spatial domains and spatially variable genes by graph convolutional network. Nat Methods 18, 1342–1351 (2021).

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI:

This article is cited by


Quick links

Nature Briefing

Sign up for the Nature Briefing newsletter — what matters in science, free to your inbox daily.

Get the most important science stories of the day, free in your inbox. Sign up for Nature Briefing