Painting the Missing Genes: How stPainter Brings Pan-Cancer Spatial Transcriptomics into Sharper Focus

Spatial transcriptomics shows where cells are located, but limited gene panels can leave their molecular identities incomplete. We developed stPainter to recover genome-wide expression and reveal fine-grained tumor ecosystems without requiring a matched single-cell reference.
Painting the Missing Genes: How stPainter Brings Pan-Cancer Spatial Transcriptomics into Sharper Focus
Like

Share this post

Choose a social network to share with, or copy the URL to share elsewhere

This is a representation of how your post may appear on social media. The actual post will vary between social networks

Seeing both the cells and their surroundings

A tumor is not simply a collection of cancer cells. It is a complex ecosystem containing immune cells, fibroblasts, blood vessels and many other cell populations. These cells communicate with one another, organize into spatial niches and collectively influence tumor development and treatment response.

Single-cell RNA sequencing has transformed our ability to study these cellular populations by measuring thousands of genes in individual cells. However, the tissue must first be dissociated, meaning that information about where each cell was originally located is lost.

Spatial transcriptomics addresses this limitation by measuring gene expression while preserving tissue structure. Recent imaging-based technologies, such as Xenium and CosMx, can profile RNA molecules at single-cell or even subcellular resolution. In principle, this allows researchers to identify not only what types of cells are present, but also where they are located and which cells they interact with.

Yet an important challenge remains: spatial transcriptomics often provides an incomplete molecular picture.

The missing-gene problem

Compared with conventional single-cell RNA sequencing, imaging-based spatial technologies usually measure a predefined panel of genes. Even panels containing several thousand genes represent only a fraction of the full transcriptome. Detection sensitivity can also vary substantially across genes and cell types.

As a result, many cells contain sparse expression profiles. Important markers may be missing simply because they were not included in the experimental panel or were not detected. This makes it difficult to distinguish closely related cell populations, identify rare subtypes or characterize the biological programs operating in different regions of a tumor.

Computational gene-imputation methods attempt to recover this missing information by integrating spatial data with single-cell RNA-sequencing references. Most existing approaches, however, require a reference dataset generated from the same tissue or cancer type. A new model may need to be trained for each new experiment.

This dependence on matched references limits scalability. In clinical or exploratory studies, an appropriate reference may not be available at all.

Our central question was therefore: Could one model learn general principles of cellular gene expression across many cancers and then use this knowledge to enhance a previously unseen spatial dataset?

From dataset-specific training to pan-cancer pretraining

To explore this idea, we developed stPainter, a conditional generative model pretrained on a large pan-cancer single-cell RNA-sequencing atlas.

The atlas contains approximately 1.3 million cells spanning 21 cancer types. Rather than learning only the characteristics of one particular tumor, stPainter learns a broad representation of cellular states shared across malignancies, together with cancer-specific patterns.

This changes the conventional workflow. Instead of searching for a matched reference and retraining a model for every spatial dataset, researchers can apply the pretrained stPainter model directly. In machine-learning terminology, this is a form of zero-shot generalization.

The name stPainter reflects the model’s purpose: it uses the molecular patterns learned from the pan-cancer atlas to fill in missing parts of sparse spatial transcriptomes, while retaining the information that was actually observed.

How does stPainter work?

stPainter combines two components: a variational autoencoder and a Gene Diffusion Transformer.

The variational autoencoder first compresses a high-dimensional gene-expression profile into a compact latent representation. This can be thought of as summarizing the essential biological identity of a cell using a relatively small number of informative features. Compression also helps reduce technical noise.

The Gene Diffusion Transformer then learns how realistic cellular states are distributed within this latent space. During inference, stPainter does not generate a cell from scratch. It starts from the observed spatial transcriptomic profile, introduces a controlled amount of noise and then uses a reverse-diffusion process to guide the cell toward a biologically plausible state learned from the pan-cancer atlas.

Finally, the model decodes this refined representation into a genome-wide gene-expression profile.

Importantly, stPainter produces two complementary outputs. The first is an imputed expression matrix containing nearly 10,000 genes, which can support analyses such as marker identification and pathway enrichment. The second is a compact latent embedding that can be used directly for clustering and visualization.

This dual output allows the model to enhance spatial data at both the gene level and the cell-population level.

Testing whether the reconstructed landscape is biologically meaningful

A reconstructed expression profile is useful only when it preserves real biological structure. We therefore evaluated stPainter across spatial transcriptomic datasets representing several cancer types and compared it with six established computational methods.

In datasets where measured genes could be hidden and subsequently predicted, stPainter showed strong recovery of gene-expression patterns. It also preserved the spatial distributions of well-known markers associated with T cells, macrophages, epithelial cells, endothelial cells and fibroblasts.

The latent representations generated by stPainter substantially improved unsupervised clustering. In the colorectal cancer dataset, the resulting clusters corresponded closely to independently assigned cell identities and formed spatially coherent tissue regions. Competing approaches more frequently merged biologically distinct populations or divided one population across several noisy clusters.

We also wanted to evaluate the predictions using a different experimental modality. For this purpose, we compared the stPainter-enhanced transcriptomic landscape with spatially resolved protein measurements generated using CODEX on adjacent tissue sections.

The distributions of major cell populations inferred from stPainter showed strong agreement with the protein-based maps. This cross-modal validation provided important evidence that the model was not merely producing mathematically plausible expression profiles, but was recovering biologically meaningful spatial organization.

Revealing cell populations hidden by sparse measurements

One of the most encouraging results was stPainter’s ability to resolve fine-grained cellular heterogeneity.

Within the T-cell compartment, the enhanced data distinguished naïve, memory, regulatory, effector, exhausted and proliferating T-cell states. Within the myeloid compartment, it identified macrophages, monocytes, neutrophils, dendritic-cell populations and rarer regulatory dendritic cells.

stPainter also separated epithelial cells into differentiated, basal, stem-like, proliferative and invasive states. These populations expressed distinct gene programs and occupied different regions of the tissue. Differentiated epithelial cells were associated with organized glandular structures, whereas invasive epithelial cells were preferentially located near the invasive tumor front.

Such distinctions are difficult to obtain from sparse spatial measurements alone because many defining marker genes may be absent or weakly detected.

What this could mean for spatial cancer research

stPainter is designed to make single-cell spatial transcriptomics more informative and easier to analyze. By reducing reliance on tissue-matched reference data, the framework may support studies of rare cancers, limited clinical samples and newly generated datasets for which an ideal reference does not exist.

The model is not intended to replace experimental measurement. Imputed genes remain computational predictions and should be interpreted carefully, particularly when drawing conclusions about individual genes. Their greatest value may lie in recovering broader cellular programs, improving population-level analyses and generating hypotheses for further experimental validation.

Several challenges remain. The current pan-cancer atlas contains unequal numbers of cells from different malignancies, meaning that rare cancers are less well represented. Future models could incorporate larger and more balanced atlases, learn sample-specific detection biases and integrate additional molecular modalities. Understanding the biological programs encoded by individual latent dimensions will also be an important direction.

More broadly, our results suggest that pretrained generative models can provide a shared computational foundation for spatial omics. Just as large pretrained models have changed language and image analysis, models trained on diverse cellular atlases may help researchers interpret new biological datasets without rebuilding an analytical system from the beginning.

By painting in information that current technologies cannot fully capture, stPainter offers a clearer view of the cellular communities that shape cancer.

Please sign in or register for FREE

If you are a registered user on Research Communities by Springer Nature, please sign in

Follow the Topic

Bioinformatics
Life Sciences > Biological Sciences > Biological Techniques > Computational and Systems Biology > Bioinformatics
Artificial Intelligence
Mathematics and Computing > Computer Science > Artificial Intelligence
Transcriptomics
Life Sciences > Biological Sciences > Biological Techniques > Gene Expression Analysis > Transcriptomics
Cancer Genetics and Genomics
Life Sciences > Biological Sciences > Cancer Biology > Cancer Genetics and Genomics
Cancer Microenvironment
Life Sciences > Biological Sciences > Cancer Biology > Cancer Microenvironment