Fig. 2: Identification of critical regions in thymic spatial transcriptomics (ST) slices, and depiction of changes in cell type with spatial distance.

a Algorithm for identifying cortical and medullary regions of thymus and segmenting thymic lobules based on spatial transcriptome data (TSO-his). Details are provided in “Methods” section. b Critical tissue regions of Thy5 (top) and Thy7 (bottom) thymus sections as determined by TSO-his analysis. Left: Hematoxylin and Eosin (H&E) slices (control); Middle: medullary scores of spatial spots; Right: cortex, medulla, and Medulla-Cortex (M-C) boundaries. Medullary center spots in thymus sections are marked in green. Segmentation results for other ST slices can be found in Supplementary Figs. 3e, f (n = 8 biological replicates). c Dissection of thymus ST slices into lobules based on the nearest-neighbor strategy using TSO-his. Left: Thy5; Right: Thy7. d Hierarchical clustering of identified cortical and medullary regions in lobules of eight thymus slices, with similarity measured by Pearson correlation of averaged expression profiles between regions. e Spatial-distance applied to eight thymus ST slices, illustrating the distribution of signature gene scores for 34 cell types from the distal cortex to medullary center. The lines, representing the relationship between spatial distance and signature scores of cell types, were smoothed using the generalized linear models, and the shaded areas around these lines denote the 95% confidence intervals for the fitted values. f, g Spatial spot scores of Thy 5 (f) and Thy7 (g) samples based on signature genes of cell types and smoothed using the “wkde” method in the Nebulosa R package70. Enriched populations in cortical regions (cTECs, DP_blast, and abT(entry)) and medullary regions (mTEC, CD4+ T and CD8+ T) are shown. h Network plots showing cell-cell communications derived from CellChat. (left) Fb vs. T cells and (right) VSMC vs. T cells. The thickness of the edges indicates the strength of the interaction. Nodes are color-coded according to the cell types. (i) Comparison of shared and unique significant ligand-receptor interactions (%) between CellChat31 and CellPhoneDB32 tools. (left) Fb vs. T cells, (right) VSMC vs. T cells. (j) Dot plot showing the selected significant ligand-receptor pairs. (left) Fb vs. T cells and (right) VSMC vs. T cells. The color of the dots reflects communication probabilities and dot size represents computed p-values. Empty space indicates that the communication probability is zero. P-values were computed from one-sided permutation tests. cTEC: Cortical thymic epithelial cells, mTEC: Medullary thymic epithelial cells, VSMC: Vascular Smooth Muscle Cell, Fb: Fibroblasts, DP_blast: Double positive blast cells, DP_re: Double positive rearrangement cells. Source data are provided as a Source Data file.