Abstract
Gene co-expression maps transcriptome-wide gene-gene relationships, yet high-quality estimates cover less than half the genome. Meanwhile, spatial omics either profiles restricted in situ panels or lacks cellular resolution. Extending co-expression transcriptome-wide could overcome these limitations by inferring unassayed gene expression at subcellular resolution. Here we show that CoxFormer integrates literature-derived gene knowledge with co-expression networks from bulk tissues and large-scale single-cell atlases to learn 512-dimensional representations for 32,016 human genes. These embeddings capture functional gene relationships and serve as a generative prior for spatial inference across platforms and modalities. Without requiring a matched single-cell RNA-sequencing reference, CoxFormer supports four applications beyond measured genes: histology-based expression imputation, gene activity prediction from chromatin accessibility, subcellular super-resolution inference, and pathological region detection. Together, CoxFormer extends gene embedding from gene- and cell-level tasks to whole-transcriptome spatial inference, providing a unified framework for biological analysis beyond the limited gene coverage of current spatial omics technologies.
Subject terms: Computational models, Bioinformatics
Yang, Liao, Zhang and colleagues present CoxFormer, an approach that learns whole-transcriptome gene representations from biomedical knowledge and co-expression data, thereby enabling spatial omics to predict unmeasured genes, enhance resolution and identify disease-related tissue regions.
Introduction
Gene co-expression reflects the coordinated regulation of genes across diverse cellular states and has long served as an important indicator for understanding gene functions and mechanisms1,2. At the transcriptome-wide scale, such co-expression patterns help systematically outline gene-gene relationships and provide a principled basis for transcriptomic analysis. However, existing high-quality co-expression estimates typically rely on large curated databases and stringent expression-filtering strategies. These estimates often exclude lowly expressed genes and restrict analyses to a limited subset of the transcriptome, typically covering less than 50% of genes, thereby constraining the use of co-expression knowledge3,4.
A similar coverage issue arises in the field of spatial transcriptomics. Specifically, targeted spatial transcriptomics platforms such as Xenium5, CosMx6, and MERFISH7,8 provide high-sensitivity, subcellular spatial resolution, but they rely on predefined gene panels, precluding unbiased whole-transcriptome profiling. While traditional imputation methods can extend gene coverage, they typically require single-cell RNA sequencing (scRNA-seq) references for unassayed genes and are developed for single-omics application, limiting their transfer capability across omics assays such as transcriptomics and epigenomics. Another challenge lies in sequencing-based spatial transcriptomics platforms, such as ST9, 10× Visium, and Slide-seq10. These profile expression at spot-level resolution across the transcriptome, with each spot typically aggregating transcripts from multiple cells. The absence of transcriptome-wide gene-gene relationships means these existing resolution-enhancement methods are only useful for genes directly measured by the assay and lack generative ability.
A universal gene embedding, which represents each gene as a numerical vector summarizing its biological properties and relationships with other genes, may help address these limitations by capturing transcriptome-wide gene-gene relationships and enabling the generation of unassayed gene expression. Existing efforts to learn gene representations broadly fall into two categories. Transformer-based foundation models, including scBERT11, Geneformer12, and scGPT13,14, are extensively pretrained on large-scale single-cell datasets, demanding massive corpora and substantial computational resources15,16. Alternative methods leverage existing large language models to extract gene knowledge from the biomedical literature, as exemplified by GenePT17 and its subsequent applications, e.g., GenePert18, Scouter19, and scLAMBDA20. However, these text-derived embeddings often fail to incorporate domain-specific biological knowledge, such as experimentally validated and quantitatively curated co-expression relationships. Beyond these methodological challenges, the utility of existing methods is frequently limited by the narrow application scopes, which largely focus on the representational power of gene embeddings for gene- and cell-level prediction tasks while ignoring their generative potential. As a result, the corresponding generative strategies remain poor at leveraging gene embeddings to impute expression beyond measured panels under multimodal spatial contexts.
Taken together, an ideal gene-embedding framework should be capable of tackling the following three tasks: (1) Integrate complementary sources of biological information, such as literature-derived knowledge of gene functions or pathways, and quantitative relationship data, including co-expression networks or correlation patterns; (2) Provide a single set of robust and reusable gene embeddings that can be directly applied to diverse downstream applications at the gene, cell, and tissue levels across various technologies and platforms; (3) Capture the inherent complex relationships among genes to enable whole-transcriptome inference and predict molecular profiles for previously unmeasured genes solely from the measured panel.
To address these challenges in molecular profiling and gene embedding, we introduce the CoxFormer (Co-expression pre-trained Transformer) package. Unlike existing co-expression estimation methods, which cover ~ 50% of genes, our framework comprehensively integrates biological prior knowledge with data-driven information from co-expression networks and transcriptome-wide correlation patterns, yielding co-expression relationships for 32,016 human genes. These heterogeneous sources are unified to generate a representative and universal gene embedding that demonstrates robust performance in fundamental gene- and cell-level benchmark tasks. To extend its utility, we further develop a flexible generative framework that adapts CoxFormer embedding to complex multimodal scenarios, including histology images and spatial coordinates, across technologies and platforms. This enables context-aware generation across multiple biological dimensions, including gene identity, spatial resolution, and biological conditions. Here, we demonstrate these generative capabilities through advanced applications such as super-resolution enhancement, the prediction of expression and activity score for genes not included in targeted assays, and the detection of pathologically relevant tissue regions. Unlike existing methods with limited applicability, CoxFormer provides a flexible framework for analyzing omics data at the gene, cell, and tissue levels.
Results
An overview of CoxFormer
To overcome the limitations of current gene embeddings and spatial omics techniques, we systematically apply complementary data-driven information and biological knowledge sources to obtain universal CoxFormer embeddings for 32,016 human genes (Fig. 1a). We obtain additional data-driven quantitative information from two sources: the COXPRESdb co-expression matrix from bulk microarray data on 18,858 genes1, and transcriptome-wide correlation information for 32,101 genes derived from over 10 million cells from 123 healthy tissue projects in the Human Cell Atlas (HCA)21. To collate biological information, we use web crawlers to obtain descriptions of 43,661 genes from biological literature in the NCBI22, GeneCards23, and UniProt24 websites. We then convert these descriptions into 3072-dimensional numerical vectors using text-to-embedding API from OpenAI. To integrate these two complementary sources, we construct a human transcriptome-wide graph, where each node represents a gene and each edge represents the relationship between genes. We assign the text-derived embeddings as node features, and single-cell correlations as the initial edge weights. The goal of the graph neural network learning is to reconstruct the bulk co-expression associations in the observed partial gene set and propagate these patterns to the full gene set. Finally, we encode the human whole transcriptome co-expression profiles from the estimated completed graph into 512-dimensional dense representations using an autoencoder framework, yielding the final CoxFormer embeddings.
Fig. 1. Overview of CoxFormer universal gene embedding and cross-modal spatial inference.

CoxFormer consists of two sequential modules for (1) learning universal gene representations and (2) enabling versatile spatial omics prediction. a Universal gene-embedding learning. CoxFormer integrates complementary information from three sources: (i) curated gene descriptions collected from NCBI Gene, GeneCards, and UniProt and encoded as text-derived node features (43,661 genes); (ii) transcriptome-wide gene-gene correlations computed from > 10 million HCA cells from across 123 projects to provide scalable correlation-based relational structures (32,101 genes); and (iii) high-quality but incomplete bulk-tissue co-expression associations from COXPRESdb (18,858 genes). A graph neural network (GNN) uses the text-derived node features together with correlation-informed message passing to propagate relational patterns across the transcriptome, reconstructing and completing bulk co-expression associations beyond the observed COXPRESdb subset. The completed whole-transcriptome co-expression profiles are then compressed into 512-dimensional CoxFormer embeddings using an autoencoder, yielding universal gene representations for downstream gene- and cell-level tasks. b Cross-modal spatial generative framework. A Transformer-based framework integrates CoxFormer embeddings with high-resolution histology images via a visual Transformer (ViT) encoder and spatial coordinates via Fourier feature mapping and a Multi-Layer Perceptron (MLP). The generated embeddings (Emb) are processed by Transformer blocks composed of attention layers and feed-forward networks (FFN), which model long-range spot-to-spot dependencies to capture spatial context for molecular prediction. c Downstream spatial applications enabled by the framework: (1) gene expression prediction, (2) gene activity score prediction, (3) super-resolution enhancement, and (4) pathological region detection.
The CoxFormer embeddings provide advances from multiple key perspectives. Fundamentally, CoxFormer incorporates descriptive biological knowledge relevant to genes from comprehensive databases and is empowered by OpenAI API25; this avoids the need for the extensive and laborious pretraining stage used for traditional foundation models and captures rich semantic information on gene functions. Building upon this semantic foundation, CoxFormer integrates information on quantitative gene relationships based on empirical expression data, including large-scale co-expression patterns from bulk tissues and single-cell atlases for millions of cells. By injecting these empirical quantitative insights into large language models, CoxFormer exploits the power of both general-purpose AI and domain-specific biological knowledge. Crucially, unlike existing gene embeddings, which focus on gene- and cell-level representation tasks, CoxFormer applies its generative ability to multimodal context-aware scenarios, thus addressing key limitations of current spatial transcriptomics technologies that rely on predefined gene panels or limited spatial resolutions. By capturing the universal relationships among genes, CoxFormer has the ability to generate across multiple biological dimensions. Generating along the gene identity dimension enables the prediction of genes not included in predefined panels and further completes whole-transcriptome inference from targeted assays; generating along the spatial dimension enables super-resolution accuracy in sequencing-based spatial transcriptomics platforms, while generating along pathobiological conditions enables the detection of diseased tissues. This generative capability supports a range of spatial omics applications, from simple gene/cell tasks to complex context-aware spatial inference across different datasets and platforms. CoxFormer’s robustness and versatility facilitate downstream biologically interpretable tasks and advanced translational research.
We illustrate the benefits of CoxFormer through its applications in comprehensive gene-, cell-, and tissue-level tasks. At the gene level, CoxFormer shows strong and consistent performance in representative gene-property prediction tasks, including the prediction of transcription-factor (TF) attributes and promoter methylation states. At the cell level, it supports accurate cell-type annotation across multiple scRNA-seq datasets. At the tissue level, CoxFormer addresses several critical limitations of spatial omics technologies by incorporating a flexible Transformer-based spatial generative framework (Fig. 1b) that uniformly integrates CoxFormer embeddings with histology images and spatial coordinates to leverage multimodal information. This framework has a generative capability that enables four key applications, as demonstrated in Fig. 1c: (i) prediction of spatial transcriptomic profiles from histology; (ii) estimations of gene activity scores (GAS) for chromatin accessibility; (iii) super-resolution imputation from spot-level to subcellular resolution; and (iv) detection of pathologically relevant tissue regions. We demonstrate these advanced applications for different technologies and platforms, including Visium, spatial ATAC-RNA-seq, and Xenium. We show that CoxFormer provides a comprehensive foundation for both fundamental single-cell omics analyses and multimodal spatial omics applications. The framework overcomes predefined gene panel constraints and low spatial resolution limitations, enabling whole-transcriptome inference across diverse biological contexts.
CoxFormer captures biologically meaningful manifolds
A biologically meaningful gene embedding is expected to organize genes into compact, well-separated functional modules while placing related programs in nearby regions of the manifold. Aligning with these principles, CoxFormer embeddings create a highly organized functional map when visualized through Uniform Manifold Approximation and Projection (UMAP) (Fig. 2a). To validate this structure, we perform Gene Ontology (GO) enrichment analysis of the clustered genes. This reveals highly significant annotations that reflect the broad-ranging and well-known functional programs of human genes, including immune-proliferative programs, core cellular machinery, metabolic processes, and tissue-specialized functions. These programs are further illustrated by the enriched GO terms and representative genes (Fig. 2a and Supplementary Figs. 1a–d and 2a–c). For instance, the immune module is characterized by the enrichment of essential pathways such as regulation of immune response and T cell activation. The functionally and biologically meaningful nature of CoxFormer embeddings is further substantiated by the representative lineage genes, notably CD family members (e.g., CD2, CD27, CD28) and CCL chemokines (e.g., CCL3, CCL4, CCL5). Moreover, the manifold exhibits an informative geometric structure that reveals important biological insights. For instance, the immune and proliferation programs display clear co-localization; they occupy nearby regions and form a continuous immune-proliferation axis, rather than appearing at distant locations. Together, these results indicate that CoxFormer organizes genes into interpretable functional modules while preserving both the functional specificity and biological neighborhoods of related gene programs.
Fig. 2. CoxFormer organization of genes into an interpretable functional manifold and evaluation across multiple gene- and cell-level tasks.

a UMAP of CoxFormer embeddings for 32,016 human genes. Genes form compact, well-separated modules, with related programs showing meaningful proximity. Colored clusters indicate representative functional groups; for each cluster, Gene Ontology enrichment analysis highlights coherent biological themes (bar plots), and representative marker genes are annotated in the insets. GO enrichment is evaluated using one-sided Fisher’s exact tests with Benjamini–Hochberg correction; bars show -transformed adjusted P values. Source data are provided as a Source Data file. b Benchmark of CoxFormer and gene embedding baselines derived from bulk transcriptomics, single-cell transcriptomics, and biomedical literature. Rows represent different gene embedding methods. Gene-level performance is summarized by the gene-task score and further decomposed into logistic regression (LR) and support vector machine (SVM) evaluations. Each point in the LR and SVM panels represents one gene-level binary classification task, including dosage sensitivity classification of transcription factors (DS), bivalent-gene classification between bivalent and non-methylated promoters (BG), promoter methylation-state classification between bivalent and Lys4-only-methylated promoters (MC), and transcription-factor regulatory range prediction (TF). Cell-level performance is summarized by the cell-task score and further decomposed into supervised cell-type classification and unsupervised clustering evaluations. Each point in the classifier and clustering panels represents one scRNA-seq dataset, including Human CD34+ Bone Marrow (BM), Diffuse Large B-cell Lymphoma formalin-fixed paraffin-embedded (FFPE) (DLBL), Lung Cancer FFPE (LC), and Breast Cancer FFPE (BC). The overall score summarizes the combined gene-level and cell-level benchmark performance, with a higher value indicating better performance. Bars show mean ± standard deviation (SD) with individual points (n = 4 tasks or datasets per method). Source data are provided as a Source Data file. c UMAP visualization of CoxFormer-derived cell embeddings across the four datasets (DLBL, LC, BC, and BM) showing dataset-specific cell-state structure and separation of major populations.
We further systematically evaluate CoxFormer in comparison to the representative gene embeddings learned from bulk transcriptomics (FRoGS26, TCGA-Embedding27, Gene2Vec28), single-cell transcriptomics (scGPT13, GeneFormer12) and the biomedical literature (GenePT17, BioVec29, Mut2Vec30). We benchmark these embeddings on four gene-level binary classification tasks: identifying the dosage sensitivity of TFs, differentiating TFs by their regulatory range, and distinguishing bivalent promoters from non-methylated promoters and bivalent promoters from Lys4-only-methylated promoters (Fig. 2b). Performance is assessed under two classifiers, logistic regression (LR) and support vector machine (SVM), using multiple complementary classification metrics, and the results are aggregated into a unified gene-task score (“Methods”). Overall, CoxFormer achieves the best gene-task score across the four tasks, outperforming embeddings that rely primarily on expression data as well as those derived mainly from biomedical text. This advantage is consistent with CoxFormer’s design, which jointly leverages curated co-expression resources and single-cell correlation to capture transcriptome-wide gene-gene relationships and pairs them with gene-level textual descriptions that encode functional semantics. While scGPT-Human achieves a competitive aggregated score, it requires computationally intensive large-scale pretraining, whereas CoxFormer is trained efficiently on a single GPU. In each task, CoxFormer shows particularly strong performance in identifying TF dosage sensitivity and distinguishing bivalent from Lys4-only-methylated promoters. Detailed per-task results are provided in Supplementary Figs. 3a, b and 4a, b. We further perform the gene network comparison benchmark on curated GO-GO and KEGG-GO matched gene-set pairs, where CoxFormer shows strong ranking performance (Supplementary Note 1).
Transitioning from genetic functionality to cell biology, we evaluate all the methods using cell-level tasks in which cell embeddings are constructed as expression-weighted averages of gene embeddings17. We consider four scRNA-seq datasets: Diffuse Large B-cell Lymphoma Formalin-Fixed Paraffin-Embedded (FFPE) (DLBL), Lung Cancer FFPE (LC), Breast Cancer FFPE (BC), and Human CD34+ Bone Marrow (BM). Both unsupervised clustering and supervised cell-type classification are assessed using standard metrics and summarized into an aggregated cell-task score (“Methods”), where a higher value indicates better overall performance (Supplementary Figs. 5a, b and 6a, b). Notably, GeneFormer-20L95M shows strong performance in the cell-level benchmarks, which may benefit from its large-scale single-cell transcriptomic pretraining and its ability to capture cell-type-specific transcriptional programs. However, this advantage is less consistent in the gene-level benchmarks, where CoxFormer achieves consistently superior scores across different classifiers. Taken together, CoxFormer achieves the best overall benchmark performance when gene-level and cell-level evaluations are jointly considered, followed by ScGPT-Human and GeneFormer-20L95M (Fig. 2b). We further visualize the learned CoxFormer cell embeddings with UMAP across all datasets (Fig. 2c). The UMAP manifold shows distinct and clustered patterns of cell types; for example, BM cells trace a coherent hematopoietic continuum with clear separation of major lineages31, whereas BC cells split cleanly into malignant versus immune/stromal compartments and the finer immune substructure is further resolved32,33.
In functional analysis and other applications, CoxFormer learns meaningful representations of human biology, facilitates downstream clustering and both gene- and cell-level classification tasks, and exhibits robust performance across diverse biological contexts.
CoxFormer accurately predicts the expression of unseen genes without external single-cell reference
CoxFormer shows robust performance across fundamental gene- and cell-level tasks, with its learned embeddings capturing biologically meaningful representations and regulatory relationships. We therefore ask whether CoxFormer can move beyond representational analysis and serve as a generative prior in spatial assays, extending its applicability from a limited gene panel to the transcriptome-wide expression of unassayed genes. To that end, we develop a Transformer-based spatial generative framework to generate expression profiles for specified target genes. We integrate multimodal spatial context when available, including high-resolution histology images, coordinate-based positional encodings, and the observed expression (“Methods”). A key distinction from standard imputation pipelines is that our approach does not rely on external single-cell reference; instead, it exploits the gene-gene relationships encoded in CoxFormer to generalize about unseen targets based on observed genes in a zero-shot manner. We apply this framework to spatial transcriptomics datasets and evaluate its ability to recover the spatial expression patterns of held-out genes.
To simulate the common scenario of running spatial assays with a limited gene panel, we train the model to infer unmeasured genes from a restricted set of measured transcripts from six human breast cancer (HBC) Visium datasets34. Specifically, the top 1000 most highly variable genes (HVGs) are used to construct a pseudo-panel setting, where 900 HVGs are randomly selected as observed inputs for model fitting and the remaining 100 HVGs are held out as unseen targets to evaluate prediction quality (“Methods”; Fig. 3a). We further confirm the robustness of this design using an 80:20 split, which shows consistent conclusions (Supplementary Note 2). We compare CoxFormer with representative scRNA-seq reference-based methods, including SpaOTsc35, SpaGE36, Tangram37, gimVI38, stPlus39, novoSpaRc40, Seurat41, and LIGER42, all provided with a matched reference data of 6178 cells. Without requiring this reference information, CoxFormer achieves the highest prediction accuracy across all datasets, as reflected by the averaged Pearson’s correlation coefficient (Fig. 3b); similar conclusions can be drawn from the other metrics, as reported in Supplementary Figs. 7 and 8. The comparison between raw-count and normalized-input settings also shows consistent conclusions, indicating that CoxFormer’s relative advantage is robust to the input expression scale (Supplementary Note 3). We additionally implement ablation studies to investigate the contribution of histology images and spatial coordinates (Supplementary Figs. 7 and 8). Incorporating a comprehensive spatial context yields the best performance, indicating that the framework benefits from multimodal information. Importantly, when spatial context is removed, and only gene embeddings are used, CoxFormer still outperforms all scRNA-seq reference-based baselines. To quantify the contribution of different information sources, we also compare the CoxFormer embedding with three single-source variants based on Co-expression, Correlation, and Description (Supplementary Note 4).
Fig. 3. CoxFormer enables spatial omics inference for unseen genes.

a Overview of the pseudo-panel benchmark for unseen-gene prediction in spatial transcriptomics. CoxFormer is trained on observed genes and predicts held-out targets in a zero-shot manner without external scRNA-seq reference. b Prediction accuracy across six human breast cancer (HBC) Visium tissue sections, quantified by Pearson’s correlation coefficient (PCC) for held-out genes using raw-count data. For each tissue section, PCC was averaged across the held-out genes. CoxFormer is compared with representative reference-based baselines (SpaOTsc, SpaGE, Tangram, gimVI, stPlus, novoSpaRc, Seurat and LIGER), all provided with a matched scRNA-seq reference. Bar plots show mean ± standard deviation (SD) with individual points (n = 6 tissue sections per method). Source data are provided as a Source Data file. c Representative spatial expression maps for a held-out gene (APOC1) across six HBC sections using raw-count data. CoxFormer consistently recovers the ground-truth spatial pattern, whereas competing methods show dataset-dependent failures or collapse to near-uniform predictions. d Cross-omics evaluation of a human hippocampus spatial ATAC-RNA-seq dataset via PCC, structural similarity index (SSIM), and root mean squared error (RMSE). Radar plot comparing CoxFormer with ablated variants that isolate individual information sources (co-expression, correlation, and description) for predicting gene activity scores (GAS) of held-out genes. Source data are provided as a Source Data file. e Predicted versus ground-truth GAS maps for five representative genes (SMIM27, BIN2, ASAH1, NPAS4, and SMDT1). CoxFormer better matches spatial contrast and localization than the ablated variants. f Region-by-gene GAS heatmaps for two hippocampal layers (dentate gyrus granule cell layer [DG GCL] and the CA3 pyramidal layer [CA3 Pyr]) using the top differentially expressed genes. CoxFormer largely preserves the layer-specific block structure and directional changes observed in the ground truth.
We further visualize the predicted expression of a representative held-out gene, APOC1, which is upregulated in breast cancer and closely linked to lipid metabolism and tumor-associated macrophage programs43. Across the six HBC datasets, some of the competing methods collapse to show near-uniform low expression and fail to generate the spatial pattern (e.g., novoSpaRc and LIGER), whereas others show clear dataset-dependent failures. For example, gimVI produces a reasonable pattern for HBC4 but largely misses the signals in other datasets, while SpaGE captures the overall spatial pattern in several datasets but breaks down for HBC5. In contrast, CoxFormer consistently recovers the spatial pattern of APOC1 expression across all six datasets, closely matching the ground truth (Fig. 3c).
CoxFormer extends accurate imputation to spatial epigenomics data
We further extend the application of CoxFormer to the spatial assay of transposase-accessible chromatin, highlighting its cross-omics applicability beyond transcriptomics. The task is to predict GAS, a gene-level accessibility measure obtained by aggregating chromatin fragments within gene loci and weighting their distances to transcription start sites (“Methods”). We evaluate this setting in a human hippocampus spatial ATAC-RNA-seq dataset with paired spatial epigenomics and spatial transcriptomics measurements. To emulate a practical setting, where only a subset of genes is observed for model fitting, we construct a pseudo-panel over the top 1000 HVGs identified from the paired transcriptomics data. Specifically, 900 genes are used as observed inputs to train the predictor, and the remaining 100 genes are held out and used to assess the method’s ability to predict GAS for unseen genes (“Methods”). As with the gene expression profile prediction setting, CoxFormer does not require an external reference to predict the GAS of unseen genes; instead, it leverages the inherent relationships among genes captured in gene embeddings.
To benchmark the GAS prediction performance, we compare CoxFormer with three ablated variants that isolate individual information sources, namely gene co-expression (the COXPRESdb-derived co-expression matrix), gene correlation (transcriptome-wide gene-gene correlations estimated from the HCA), and gene description (text-derived gene representations obtained via the OpenAI embedding API). Notably, we do not include scRNA-seq reference-based spatial methods (e.g., Tangram and SpaGE) because these approaches are solely designed for expression imputation and are not applicable to cross-omics GAS prediction. CoxFormer outperforms these variants across evaluation metrics computed between predicted and ground-truth GAS, as shown in the radar plot in Fig. 3d. This demonstrates that CoxFormer can successfully integrate data-driven and biological literature information from diverse sources.
We next visualize the spatial patterns of predicted and ground-truth GAS to assess whether the models capture biologically interpretable accessibility programs (Fig. 3e). Five representative genes (SMIM27, BIN2, ASAH1, NPAS4, and SMDT1) are selected to cover hippocampus-relevant neuronal programs and fundamental biological processes. The results show that CoxFormer reliably captures the ground-truth spatial GAS patterns, while the co-expression variant model only partially captures correct signals (Fig. 3e and Supplementary Fig. 9a).
We then focus on two well-established hippocampal layers, the dentate gyrus granule cell layer (DG GCL) and the CA3 pyramidal layer (CA3 Pyr)44. Using the top differentially expressed genes (DEGs) between these two regions, we visualize region-by-gene GAS heatmaps (Fig. 3f and Supplementary Fig. 9b). The ground truth shows a clear block structure, where many genes display smooth and gradual expression patterns between DG GCL and CA3 Pyr, reflecting coordinated layer-specific accessibility programs. CoxFormer largely preserves this block structure and the associated directional changes for the top DEGs, whereas the co-expression variant model recovers limited gene patterns. Overall, this spatial epigenomics benchmark shows that, beyond transcriptomics, CoxFormer embeddings support robust unseen-gene generalization for ATAC-derived GAS, demonstrating its cross-omics applicability to epigenomics.
CoxFormer enables expression imputation and spatial resolution enhancement for unassayed genes
We have shown that CoxFormer can use a limited gene panel to generalize on the transcriptome-wide expression of unseen genes, without relying on external scRNA-seq references. However, a major limitation of many spatial transcriptomics platforms is that expression is typically measured at the spot resolution, which masks within-spot heterogeneity and limits access to cellular-scale patterns. Coupling transcriptome-wide inference with enhanced spatial resolution would therefore yield both broader molecular coverage and finer spatial detail from such measurements. Using our Transformer-based spatial generative framework, we enable subcellular-scale prediction within each spot while predicting the expression profiles of genes absent from the panel (“Methods”; Fig. 4a).
Fig. 4. CoxFormer enables super-resolution imputation and zero-shot prediction of unassayed genes in Xenium skin sections.

a Overview of the cross-section super-resolution setting. CoxFormer is trained on the observed genes across Sections A and B, then applied to Section B to generate spot-level and subcellular-scale predictions. b Gene partitioning for evaluation on two Xenium human skin sections (Section A: 378-gene panel; Section B: 280-gene panel). The 280 overlapping genes are split into training genes (fully observed; n = 168), test genes (observed in Section A but masked in Section B; n = 56) and zero-shot genes (masked in both sections; n = 56). c Spot-level imputation accuracy for the 56 masked test genes in Section B. CoxFormer outperforms the super-resolution baseline iStar across RMSE, SSIM, and PCC. Source data are provided as a Source Data file. d Predefined tissue regions in Section B (epidermis, immune infiltration and melanoma tumor) used for downstream evaluation. e Region separation obtained by clustering the predicted subcellular-scale expression in Section B for iStar and CoxFormer; the latter yields clearer separation of epidermal and immune-infiltrated domains. f Zero-shot subcellular-scale prediction for genes absent from the measured panel in Section B. Shown are representative marker genes (CD3D, CLDN1, LUM and COL6A3) with Xenium ground-truth and CoxFormer predictions; CoxFormer recovers compartment-specific patterns and fine-grained ring-like spatial structures. g Region-resolved cell-cell communication analysis in Section B after transcriptome-wide augmentation with CoxFormer-imputed genes. Dot plots show the top 10 ligand-receptor pairs per region ranked by specificity; dot size encodes specificity rank, and color indicates the ligand-receptor (LR) score.
To demonstrate this capability in a cross-sectional setting, we study two high-quality Xenium in situ human skin sections. Section A is profiled using the standard Human Skin Gene Expression Panel (378 genes), whereas Section B is measured with a custom panel limited to 280 genes. To create spot-level supervision for super-resolution, the Xenium cellular transcripts are aggregated into coarse pseudo-spots, each with a diameter of 55 μm. We further partition the 280 overlapping genes into three sets (Fig. 4b): (1) fully observed training genes (n = 168), which are expressed in both sections and used as model input; (2) partially observed test genes (n = 56), which are expressed in Section A but artificially masked in Section B and are used to benchmark conventional imputation; and (3) unobserved zero-shot genes (n = 56), which are artificially masked in both sections and used to assess zero-shot performance on unseen genes.
With this design, we quantify the cross-section imputation accuracy for the 56 partially observed test genes. Evaluation is performed at the spot level (“Methods”), and CoxFormer consistently outperforms iStar45, a representative super-resolution baseline, across all metrics (Fig. 4c). At an enhanced resolution, CoxFormer produces smoother and more spatially coherent gene maps, whereas iStar often yields fragmented patterns (Supplementary Fig. 2.10). To assess whether these super-resolved predictions preserve tissue structure, clustering is performed on the predicted expression in Section B (Fig. 4d). CoxFormer recovers the ground-truth structures and clearly delineates the epidermis, immune infiltration sites, and melanoma tumor regions (Fig. 4d, e), whereas the results from iStar show evident mixing of the epidermal and immune-infiltrated domains. We further compare CoxFormer with scRNA-seq reference-based imputation methods in Section B and evaluate the imputed profiles at the single-cell level using segmented cell information (Supplementary Note 5).
The same framework is further evaluated in a challenging zero-shot setting, where target genes are entirely absent from the measured panel. Using the 56 genes unobserved in both sections, CoxFormer produces subcellular-scale, spatially structured predictions for marker genes that delineate distinct tissue regions (Fig. 4f)46. For example, CLDN1, an epithelial marker, shows elevated expression localized to the epidermal region, consistent with the region boundaries in Fig. 4d and the Xenium ground truth. Likewise, CD3D, a T-cell marker, is selectively enriched in the immune-infiltrated area, matching the ground-truth pattern. Beyond these regional markers, CoxFormer also captures intricate extracellular-matrix-associated programs. The expression patterns of LUM and COL6A3 exhibit pronounced ring-like stromal structures that align with the Xenium measurements, demonstrating that the model can recover the delicate spatial architectures of completely unassayed genes. Multi-scale visualizations across four resolutions (4×, 16×, 64×, and 256×) are provided in Supplementary Figs. 11 and 12, and full-section predictions are shown in Supplementary Fig. 13.
Finally, using Section B, we investigate whether transcriptome-wide subcellular imputation with enhanced spatial resolution can make region-resolved cell-cell communication (CCC) analysis more informative (“Methods”). In an analysis of the original 280-gene panel, CCC inference is severely underpowered and yields only four robust ligand-receptor pairs (Supplementary Fig. 14a, b). Upon expanding the 280 measured genes of Section B to 32,018 genes with CoxFormer, the inferred CCC landscape becomes substantially richer (Fig. 4g), revealing additional plausible region-associated signaling modules that remain undetected in the limited panel. For example, extracellular-matrix and adhesion signaling (e.g., COL1A1 → SDC1) become prominent, consistent with matrix-rich microenvironments47. Epidermal junction programs are recovered with strong epidermis-associated specificity (e.g., DSG1 → DSC3)48. In parallel, immune-recognition signals emerge in the immune-infiltrated compartment (e.g., SFTPD → SIRPA)49. These interactions also exhibit spatial patterns consistent with the region annotations in Fig. 4d (further visualized in Supplementary Fig. 15), supporting more interpretable and region-resolved CCC discovery beyond the scope of the limited gene panel.
CoxFormer identifies pathological regions without reference
In addition to enabling whole-transcriptome prediction and super-resolution, CoxFormer embeddings serve as an intrinsic “healthy reference”, as illustrated by their use in the delineation of pathological regions using an unsupervised, reference-free strategy. There are three steps to the strategy (Fig. 5a). First, we train the Transformer-based spatial generative framework on only spatially stable housekeeping genes, allowing it to learn mapping from gene to gene expression in the “healthy” distribution. Second, we generate transcriptome-wide expression profiles with the trained model as a “pseudo-healthy” reference. Third, we quantify the residuals between the real and generated gene expression of non-housekeeping genes, then apply clustering to automatically segment the tissue into normal and abnormal regions (“Methods”). This framework is mainly based on a hypothesis that the divergence between the real pathological expression and the generated healthy baseline would reveal disease-specific alterations.
Fig. 5. Reference-free pathological region detection in colorectal cancer liver metastasis using CoxFormer.

a Overview of the unsupervised, reference-free pipeline. A spatial generative framework is trained on spatially stable housekeeping genes to learn a “pseudo-healthy” baseline, then used to generate transcriptome-wide expression; residuals on non-housekeeping genes are used for DEG detection and spatial clustering to segment normal versus abnormal regions. b Four colorectal cancer liver metastasis sections used for benchmarking, spanning untreated and therapy-perturbed (PR) colorectal cancer (CRC) and liver metastasis (LM) tissues. Created in BioRender. Yang, Y. (2026) https://BioRender.com/4hf4a90. c Aggregate abnormal-region detection performance across sections, comparing CoxFormer with reference-based spatial imputation methods (SpaGE, SpaOTsc, Tangram, gimVI, novoSpaRc, Seurat, LIGER, and stPlus). The left panel shows the mean ROC curve, and the right panel summarizes recall, accuracy, precision, and F1 score. Bar plots show mean ± standard deviation (SD) with individual points (n = 4 tissue sections per method). Source data are provided as a Source Data file. d Spatial segmentation maps on an untreated colorectal cancer section. CoxFormer delineates abnormal regions that closely match the ground-truth annotations, whereas competing methods show noisy or incorrect boundaries. e Representative housekeeping genes showing the agreement between measured expression and CoxFormer reconstruction, which provides a stable baseline for downstream deviation analysis. f Comparison of measured expression of representative CRC-associated marker genes (CD44, GPA33, EPCAM, GUCA2A, and CEACAM7), comparing measured expression with the CoxFormer-generated “pseudo-healthy” baseline, highlighting the disease-associated deviations within abnormal regions. g Gene Ontology biological process enrichment of the top differentially expressed genes between CoxFormer-segmented normal and abnormal regions. The processes are dominated by extracellular remodeling and motility-related programs. The six most significantly enriched terms are shown. Gene ratio denotes the proportion of overlapping genes in each GO term, bubble size indicates the number of overlapping genes, and color represents -transformed Benjamini–Hochberg-adjusted P values. Enrichment is evaluated using one-sided Fisher’s exact tests. Source data are provided as a Source Data file.
We benchmark the pathological annotation task using four human colorectal cancer liver metastasis (CRLM) sections with annotated abnormal regions, with colorectal cancer (CRC) and liver metastasis (LM) tissues for both untreated and therapy-perturbed (PR) conditions (Fig. 5b). We compare CoxFormer with representative reference-required imputation methods (SpaGE, SpaOTsc, Tangram, gimVI, Seurat, stPlus, novoSpaRc, and LIGER). Across all evaluation criteria, CoxFormer achieves the most accurate abnormal-region annotations (Fig. 5c), with per-section performance detailed in Supplementary Figs. 16a–19a. Importantly, even without leveraging external scRNA-seq references, CoxFormer still yields an area under the receiver operating characteristic curve (AUROC) of 0.91 averaged across four sections (Fig. 5c, left panel) and a recall score over 0.98 (Fig. 5c, right panel). As a representative example, we focus on the untreated CRC section, with the results for the other sections shown in the Supplementary Figs. 17–19. CoxFormer’s quantitative advantage is visually demonstrated in the segmentation results in the spatial maps (Fig. 5d and Supplementary Figs. 16b–19b) and the corresponding UMAP visualizations with tumor segmentation (Supplementary Figs. 16c–19c), where it detects abnormal regions precisely delineating the tumor boundaries, whereas the competing methods produce noisy or incorrect detections.
We further demonstrate CoxFormer’s power to detect abnormal regions via its ability to: (1) reconstruct the housekeeping gene profiles, and (2) differentiate between the real pathological expression and the generated “pseudo-healthy” pattern. To validate the framework’s reconstruction capability, we compare the true and reconstructed gene expression heatmaps (Fig. 5e and Supplementary Figs. 16d–19d). There are 10 representative housekeeping genes, including PRCC and PSMD650. CoxFormer reconstructs these gene profiles in close alignment with the ground truth, demonstrating that it can provide a stable reference against pathological alterations. Next, we contrast the measured expression with the “pseudo-healthy" reference for CRC-associated markers (Fig. 5f). Consistent with prior reports that GUCA2A and CEACAM7 are downregulated in colorectal tumors due to dedifferentiation51, CoxFormer reveals their suppressed expression within the abnormal compartment relative to the pseudo-healthy baseline. This finding suggests that the housekeeping-conditioned model captures gene-gene dependencies and reveals the systematic deviations accompanying malignant transformation.
Finally, we visualize the expression patterns of the top 200 DEGs between the normal and abnormal regions segmented by CoxFormer across all four sections (Supplementary Figs. 20a, b and 21a, b). We then perform GO biological process enrichment using identified DEGs, as shown for the untreated CRC section in Fig. 5g. The enriched terms are primarily related to extracellular remodeling and motility-related programs, including extracellular matrix organization, extracellular structure organization, and regulation of cell migration/positive regulation of cell motility. These functions are consistent with stromal reorganization and invasion-associated processes in CRLM47, evidence that the CoxFormer-identified abnormal domains capture biologically meaningful pathological tissue states.
Discussion
As a result of our work, we propose the use of CoxFormer as a universal gene embedding framework that comprehensively integrates biological knowledge and data-driven co-expression relationships to enable whole-transcriptome inference across diverse contexts and technologies. Unlike existing methods that either require intensive pretraining on massive single-cell corpora or rely solely on general-purpose language models, CoxFormer systematically combines qualitative biological descriptions from literature databases and quantitative co-expression patterns from both bulk tissues and large-scale single-cell atlases. Moreover, CoxFormer employs a graph neural network to reconstruct and complete transcriptome-wide co-expression networks, then utilizes autoencoder architecture to compress these relationships into low-dimensional gene embeddings. The whole framework generates robust, reusable, and universal CoxFormer embeddings that capture the intrinsic complex relationships among genes. Finally, we have designed a flexible generative framework for applying CoxFormer embeddings to diverse downstream applications, ranging from gene-level to complex spatial inference tasks.
Conventionally, predicting the expression of unmeasured genes in spatial omics data requires external reference datasets, which are often unavailable or difficult to obtain. CoxFormer successfully enables the accurate prediction of spatial gene expression, GAS, and super-resolution enhancement without requiring external references. This ability is due to its exploitation of the universal nature of CoxFormer embeddings and our flexible generative framework, which can be adapted to diverse technologies and platforms.
Through the comprehensive applications of CoxFormer to diverse datasets and downstream tasks, we demonstrate that the framework addresses several critical limitations of multiple spatial omics technologies. Via its spatial pattern prediction of unmeasured genes, CoxFormer accurately predicts the expression profiles in Visium spatial transcriptomics of HBC data with the highest prediction accuracy outperforming competing methods, which typically require matched external reference datasets. Beyond the generative ability for transcriptomics, CoxFormer also applies to epigenomics by generating GAS for chromatin accessibility in spatial ATAC-RNA-seq data from the human hippocampus. In a super-resolution enhancement task, CoxFormer enhances the detection accuracy from spot-level expression to a subcellular resolution, as validated on Xenium platforms. Transitioning from spatial prediction to whole-transcriptome generation, it further extends the targeted assays from 280 to 32,018 genes, identifying CCC programs undetectable by the original panel, such as extracellular-matrix and adhesion signaling (e.g., COL1A1 → SDC1). Lastly, CoxFormer shows strong potential for pathological detection and translational research, as demonstrated by its precise tumor region detection in CRLM samples across different treatment conditions. These comprehensive and vital applications highlight CoxFormer’s versatility and robustness in overcoming predefined gene panel constraints, enabling whole-transcriptome inference, and further facilitating translational research.
Although CoxFormer provides a strong foundation for the rapidly evolving landscape of spatial omics technologies, several limitations remain. First, while CoxFormer already integrates spatial coordinates and histology images, future iterations could include more sophisticated spatial modeling to account for tissue context information; for example, an advanced model should be able to characterize complex organs and developmental processes when handling 3D spatial profiling technologies52–54. Second, the flexible generative framework of CoxFormer could be extended to the integration of additional modalities beyond transcriptomics and chromatin accessibility, including proteomics55–57 and metabolomics data58,59. Finally, CoxFormer can be naturally extended to broader tissue coverage by incorporating additional HCA projects processed under a consistent pipeline, or other high-quality human single-cell atlases, as such resources become available. Meanwhile, CoxFormer currently leverages co-expression networks and does not explicitly model signed regulatory interactions, such as inhibitory TF-target relationships curated in CollecTRI60. Incorporating regulatory-network priors or dynamic context-specific gene relationships61,62 may further enhance its ability to capture tissue- and disease-dependent regulatory programs.
Methods
Ethics approval and consent to participate
No ethical approval was required for this study. All utilized public datasets were generated by other organizations that obtained ethical approval.
Construction of CoxFormer embeddings
Data curation and gene representation
To construct a unified representation of 32,016 human genes, we utilize complementary data from three sources. First, we obtain high-confidence co-expression profiles from the COXPRESdb database (Microarray_m.c7 version) to set up reliable gene-gene relationships. Specifically, we aggregate normalized bulk microarray data for 18,858 genes, resulting in a dense co-expression matrix Ccox (18,858 × 18,858).
Next, we integrate scRNA-seq data from the HCA to extend gene coverage beyond microarray limitations. This dataset contains 123 healthy tissue projects covering breast, lung, pancreas, skin, anterior palate rugae, oral tissue, peripheral blood, and bone marrow, comprising 10.4 × 106 cells sequenced using 10× Genomics V2 chemistry. Following standard quality control and project-specific Pearson correlation analysis, we construct a global correlation matrix Ccor (32,101 × 32,101) using a cell-count weighted aggregation approach. For each gene pair (i, j):
| 1 |
where nk denotes the cell count of project k, and if is defined and 0 otherwise.
To incorporate functional semantics beyond transcriptional patterns, we also collect 82,718 textual descriptions from the NCBI Gene, GeneCards, and UniProt databases. We group these descriptions by gene and encoded them using the OpenAI text-embedding-3-large model, which creates dense 3072-dimensional embedding vectors for all 43,661 genes. We then define the target gene universe as the overlap between the text-annotated genes and the genes in Ccor, resulting in 32,016 genes for the construction of a unified representation.
Together, these complementary sources provide statistical, structural, and semantic views of gene relationships, forming the foundation of the CoxFormer embeddings.
Transcriptome-wide co-expression graph completion
We formulate transcriptome-wide co-expression estimation as a graph completion problem that integrates high-confidence bulk co-expression with transcriptome-wide but noisy scRNA-seq covariation. Let denotes the partially observed co-expression graph, where contains gene pairs with measured co-expression values ci,j. Our objective is to learn a parametric model that predicts co-expression for any gene pair in the gene set , thereby extending the reliable patterns supported by curated edges to previously unmeasured pairs.
As a global structural prior, we construct a weighted correlation graph from the scRNA-seq correlation matrix Ccor by assigning each gene pair (i, j) an edge weight . Importantly, because transcriptome-wide correlations are substantially noisier than curated bulk co-expression measurements, we use Ccor to guide information propagation and neighborhood construction, rather than treating correlations as direct co-expression estimates. Considering that a fully connected graph over genes is computationally prohibitive, we sparsify the correlation graph by retaining the top-K most correlated neighbors for each gene, which yields a scalable dependency structure while preserving local covariation neighborhoods. On the resulting sparse graph, we perform L layers of message passing with mean aggregation63. We initialize each gene node with its text-derived embedding as the node representations, . At each layer l ∈ {1, 2, …, L}, we aggregate messages from the top-K neighborhood as:
| 2 |
and update node representations by:
| 3 |
After L layers, the refined representation encodes gene-level functional semantics while being regularized by the correlation-defined neighborhood context, enabling co-expression to be predicted from paired representations. Specifically, for a gene pair (i, j), we predict co-expression using an Multi-Layer Perceptron (MLP) edge predictor:
| 4 |
We train the model by minimizing the mean squared error loss over observed co-expression edges between measured values ci,j and predictions :
| 5 |
After training, we apply the learned predictor to all gene pairs to obtain a completed co-expression matrix Ccox with entries . This provides transcriptome-wide co-expression estimates consistent with curated bulk measurements yet informed by global scRNA-seq covariation. Further details on the implementation are provided in the Supplementary Note 6.
Latent space compression via Transformer-based autoencoding
Although each gene can be represented by a 32,016-dimensional co-expression vector, using these vectors directly is computationally expensive in downstream applications. To that end, we reduce the dimensionality of these co-expression vectors using a deep autoencoder. We implement both the encoder fenc and the decoder fdec using stacked Transformer blocks in a symmetric architecture64. Attention mechanism is applied throughout encoding and reconstruction, allowing the model to effectively capture biological dependencies and long-range interactions inherent in the gene regulatory network.
Formally, we specify the training objective as follows. For each gene i, we use the corresponding row vector as the input co-expression feature vector. The encoder fenc maps this high-dimensional vector to a 512-dimensional latent vector ei, and the decoder fdec reconstructs the original input from ei:
| 6 |
We train the model by minimizing the mean squared reconstruction loss :
| 7 |
which encourages the latent vector to preserve the co-expression structure encoded in Ccox. We therefore use the encoder outputs {ei} as the CoxFormer gene embeddings. Notably, we use a 512-dimensional latent representation as the default CoxFormer embedding, which provides a practical balance between representational capacity and computational efficiency. We evaluate the sensitivity of CoxFormer to embedding dimensionality in Supplementary Note 7. Further details on the implementation are provided in the Supplementary Note 8.
A multimodal generative framework for predicting spatial epigenomics and transcriptomics using CoxFormer embeddings
To enhance the applicability of CoxFormer embeddings to advanced genomic analyses, we develop a multimodal generative framework that integrates gene embeddings with available spatial cues, such as H&E histology and spot coordinates, to predict epigenomic and transcriptomic profiles. The framework can fuse gene embeddings with coordinate encodings and image-derived features when available, or operate on gene embeddings alone, enabling seamless use across sequencing technologies and heterogeneous data formats.
Multimodal spatial information extraction and fusion
Spatial transcriptomics datasets usually provide two types of spatial information: spot coordinates and, in some assays, a matched histology image (e.g., H&E in 10× Genomics Visium). When histology is available, we extract morphology from image patches using a Vision Transformer (ViT), yielding patch features of shape npatch × dViT65. To obtain spot-level image features, we average the patch features within each spot and form an image feature , which is then projected by a two-layer MLP with ReLU activations to .
For spot coordinates, we encode the 2D locations with a Fourier feature encoder. We use exponentially spaced frequencies ωf = 2f−1π for f = 1, …, F and compute sinusoidal features for each coordinate dimension66. For a spot i with Xloc,i = (xi, yi), the positional encoding is defined as:
| 8 |
Stacking all spots yielded . We then project them to using a two-layer MLP with ReLU activations.
When neither coordinates nor histology are provided, we introduce learnable latent vectors as the spatial context, which are initialized from a standard normal distribution and optimized during training so that they can be learned directly from the data, allowing the capture of dataset-specific spatial structure.
When both coordinates and histology are present, we construct a unified spatial context by concatenating the image, coordinate, and learnable embeddings after projecting them onto dimensions that are summed to dmodel. When only one spatial input is present, we project it to dmodel dimensions and used it as the spatial context.
Integrating spatial context with CoxFormer embeddings for transcriptome-wide prediction
We formulate spatial prediction as gene-conditioned regression over the spatial context defined above. Because spatially proximal spots tend to exhibit correlated molecular states, we treat the spot-wise spatial context as a sequence of nspot tokens and use an attention-based aggregation mechanism to capture dependencies across the entire tissue section.
To allow each spot to adaptively pool information from other spots, we first compute three learned linear projections of Xspa: a query representation that specifies what a spot is looking for, a key representation that specifies what information a spot can offer, and a value representation that carries the content to be aggregated. Concretely,
| 9 |
where and are learnable projection matrices, and softmax is applied row-wise to normalize attention weights over spots. This operation allows each spot to form a weighted sum of the value vectors from all spots, producing a context-aware spatial representation.
We then incorporate gene-specific information using the CoxFormer embedding of the target gene . Intuitively, we use e to modulate a shared spatial context so that the resulting spot-wise representations become specific to the queried gene and can be directly read out as its spatial expression profile. Concretely, we first project e into the model space via a learnable linear layer Wg to match the dimensionality of . We then broadcast the projected gene vector to all spots, add it to the context-aware spatial representation as conditioning, and finally apply an MLP head to output one scalar per spot:
| 10 |
Here and are learnable parameters, and is an all-ones vector, and ⊗ denotes the Kronecker product that broadcasts the projected gene embedding to all spots. The outputs the predicted expression (or activity score) for gene g across all spots.
Notably, our framework follows the spirit of the Transformer decoder block design64, while adapting it to spatial molecular prediction. Specifically, we predict the spatial profile of a specified target gene across all spots in a single pass, rather than applying the autoregressive next-token prediction that is a common use of Transformer decoders. Training, therefore, does not require causal masking. Moreover, in the absence of CoxFormer embeddings, a Transformer-style transcriptome-wide formulation would typically represent genes as additional tokens, which naively leads to a gene axis on the order of 3 × 104 for the human genome and substantially increases the computational cost. By using the CoxFormer embedding as an external conditioning input, our framework preserves the Transformer’s ability to model long-range spot-to-spot dependencies, while avoiding the need to present the whole genome as gene tokens.
Sparsity-aware objective and model optimization
To handle the sparsity and zero inflation of spatially resolved molecular profiles, CoxFormer uses a weighted reconstruction loss together with an ℓ1 penalty on the predictions. The reconstruction loss is selected according to the input expression scale, with a weighted Huber loss used for normalized expression profiles and a weighted Poisson negative log-likelihood used for raw-count inputs. In both cases, entries are partitioned into non-zero sets (Ωnz = {i: yi > 0}) and zero sets (Ωz = {i: yi = 0}), with separate weights controlling their relative contributions.
For normalized expression profiles, we use a weighted Huber reconstruction loss. The weighting reduces the contribution of zero entries, and the Huber term limits the influence of large residuals. The weighted Huber loss is defined as:
| 11 |
where λnz and λz control the relative contribution of non-zero and zero entries (default λnz = 0.5 and λz = 0.5). Specifically, the Huber term is:
| 12 |
with an adaptive threshold δ computed per mini-batch as the standard deviation of residuals across spots for each sample.
For raw-count inputs, we replace the weighted Huber reconstruction term with a weighted Poisson negative log-likelihood. Given the observed raw count yi and the predicted positive Poisson rate , the loss is defined as:
| 13 |
where corresponds to the log-factorial term in the Poisson likelihood.
The final training objective is:
| 14 |
where controls the ℓ1 penalty.
Further implementation details of the multimodal generative framework are provided in the Supplementary Note 9. Its scalability analysis is presented in Supplementary Note 10.
Downstream analysis
Gene property prediction
To assess whether the CoxFormer embeddings are able to capture intrinsic regulatory semantics, we benchmark their performance on four distinct binary classification tasks that discriminate between distinct gene properties12. Specifically, each sample corresponds to one gene, the input feature is the gene embedding zi, and the ground truth is a curated binary gene-property label from the corresponding published dataset: (1) dosage-sensitive versus dosage-insensitive transcription factors (TFs)67; (2) long-range versus short-range transcription TFs68; (3) bivalent versus non-methylated promoters69 and (4) bivalent versus Lys4-only-methylated promoters69.
For each task, we train supervised models to predict gene properties from the gene embedding zi. To ensure that our evaluation is robust to the choice of downstream model, we train two representative classifiers: Logistic Regression (LR) and Support Vector Machine (SVM). We then evaluate the generalization performance using fivefold stratified cross-validation, and report the mean performance across folds using the metrics, including AUROC, Accuracy, F1-score, Precision, and Recall.
Cell-types annotation
To evaluate the utility of CoxFormer embeddings in cell-level tasks, we derive a cell representation by aggregating gene embeddings according to each cell’s normalized expression profile, then use these cell embeddings for cell-type clustering and classification across tissues. Given a gene expression matrix for ncell cells and ngene genes, we formed the cell embedding for cell i by taking a normalized weighted sum:
| 15 |
where Si,g denotes the expression of gene g in cell i, is the embedding of gene g, and ϵ = 10−12 is a small constant for numerical stability. Building on the cell embeddings defined above, we treat the provided annotations as reference labels. For an unsupervised evaluation, we cluster the cell embeddings with K-means and quantify the clustering quality using the Adjusted Rand Index (ARI), Normalized Mutual Information (NMI), and Adjusted Mutual Information (AMI). In a supervised evaluation, we employ a kNN classifier with stratified fivefold cross-validation and assessed its performance using AUROC, Accuracy, F1-score, Precision, and Recall.
Super-resolution gene expression prediction
Building on the prediction framework above, we extend the histology input from spot-aggregated image features to pixel-level image features for super-resolution inference. Within the spot-level setting, ViT patch features are averaged within each spot to obtain spot-level image features, which support spot-level prediction. While for super-resolution prediction, we avoid this within-spot averaging and instead predict gene expression directly from pixel features. In the implementation, we treat the npix pixel within a spot as a sequence and form a pixel-feature matrix .
We then adapt the spot-level prediction framework at patch resolution. Specifically, each patch feature is mapped to the model dimension with a two-layer MLP with ReLU activations, yielding . We then use self-attention over the npix patches within a spot so that each patch can aggregate information from the other patches in the same spot. The target gene is identified through its CoxFormer embedding, and the model obtains pixel-level predictions for gene g at pixel k in spot i.
Considering that most spatial transcriptomics data encode gene expression at the spot resolution, we train the model under weak supervision by aggregating patch-level predictions within each spot:
| 16 |
We then minimize the sparsity-aware objective defined above between the aggregated prediction and the measured spot-level expression . Training uses the same optimization setting as in the spot-level task, except that we use a batch size of 256.
Cell-cell communication analysis
We perform region-resolved CCC analysis using the LIANA (version 1.6.1) library in Python70, grouping cells into tissue regions (source-target groups) for interaction inference. We first identify candidate ligand-receptor interactions using rank_aggregate() with the consensus resource (resource_name = "consensus") under standard quality control settings (expr_prop = 0.1). We incorporate spatial context by constructing a Gaussian-kernel neighbor graph (bandwidth = 100, cutoff = 0.1) from cell centroid coordinates, and refine interactions using bivariate() with cosine similarity (local) and Moran’s I (global). Significance is assessed via permutation testing (n_perms = 100) with an additional sparsity filter (nz_prop = 0.2).
Differential expression analysis
We identify differentially expressed genes (DEGs) between the target and reference expression profiles using the Scanpy (version 1.9.8) library in Python71. For each gene, we compare expression between the two groups using the Wilcoxon rank-sum test and adjusted P values with the Benjamini–Hochberg procedure. DEGs are defined as genes with an adjusted P value < 0.01 and an absolute log-fold change greater than 3.
GO enrichment analysis
We conduct GO enrichment analysis for each gene set selected from spatial transcriptomics predictions based on CoxFormer embeddings using the GSEApy (version 1.1.8) library in Python with the Enrichr database GO_Biological_Process_202172. For each gene set, enrichment significance is assessed with Fisher’s exact test and controlled for multiple comparisons using the Benjamini–Hochberg procedure. We then rank GO terms by their adjusted P values (cutoff = 0.05), report significance as and visualize the top terms within the Biological Process ontology to summarize the dominant functional signals.
Abnormal region detection
We develop an unsupervised method to delineate abnormal tissue regions. Specifically, we use our spatial transcriptomics prediction framework based on CoxFormer embeddings to infer transcriptome-wide expression from housekeeping genes defined using the curated human housekeeping gene set from HRT Atlas v1.050, and consider these predictions as a pseudo-healthy reference. Accordingly, deviations between the predicted and measured expression are treated as signals of pathological alteration. In the implementation, we first select the top 200 disease-relevant genes the top 200 disease-relevant genes from non-housekeeping genes by differential expression analysis between the measured expression and the pseudo-healthy reference. For this gene set, we define the spot-wise residual as the difference between the predicted and measured expression:
| 17 |
where Yi,g and denote the predicted and measured expression of gene g at spot i, respectively. To delineate abnormal regions, we perform Principal Component Analysis (PCA) on the residual matrix R and apply Leiden clustering, adjusting the resolution to obtain two clusters. For each cluster c, we compute its mean absolute residual:
| 18 |
We label the cluster with the larger as the abnormal region and evaluated detection performance against ground-truth pathological annotations using AUROC, Accuracy, F1 score, Precision, and Recall.
Comparisons of methods
We perform extensive comparisons between the performance of CoxFormer and existing methods in both simulated and real data analyses. In brief, for gene- and cell-level tasks, we compare CoxFormer embeddings with alternative gene embedding baselines. For spatial transcriptomics prediction and pathological region segmentation, we benchmark CoxFormer against representative scRNA-seq reference-based imputation methods. For the spatial epigenomics prediction task, we compare it against three single-source embedding variants using our spatial generative framework. For super-resolution enhancement, we compare CoxFormer with iStar.
Compared methods for gene- and cell-level tasks
We compare CoxFormer with gene embeddings learned using different information sources73, including bulk transcriptomics, single-cell transcriptomics, and the biomedical literature, as provided at https://zenodo.org/records/16764517.
(1) scGPT13: Transformer-based gene embeddings are trained on single-cell gene expression, where scGPT-Human is trained on human single-cell transcriptomics and scGPT-PanCancer is trained on pan-cancer single-cell transcriptomics (dim = 512).
(2) GeneFormer12: Transformer-based gene embeddings are pretrained on single-cell gene expression data, including GeneFormer-6L30M (dim = 256), GeneFormer-12L30M (dim = 512), GeneFormer-12L95M (dim = 512), GeneFormer-20L95M (dim = 896), and the cancer-tuned GeneFormer-12L95M-Cancer (dim = 512). Here, “6L/12L/20L” indicates the number of Transformer layers and “30M/95M” indicates the pretraining scale in millions.
(3) GenePT17: text-derived gene embeddings are obtained by encoding NCBI Gene Summary with OpenAI embedding APIs, where GenePT-Ada uses text-embedding-ada-002 (dim = 1536), and GenePT-Model3 uses text-embedding-3-large (dim = 3072).
(4) BioVec29: literature-derived gene embeddings are trained on biomedical corpora, including BioVec-CBOW (trained with the CBOW), BioVec-SkipGram (trained with the skip-gram), BioVec-FastText (trained with FastText), and BioVec-GloVe (trained with GloVe) (dim = 100).
(5) Mut2Vec30: multi-source gene embeddings integrate mutation profiles, the biomedical literature, and protein-protein interaction information (dim = 300).
(6) Gene2Vec28: bulk gene expression embeddings are learned from PCC-based gene-gene correlation patterns using the skip-gram (dim = 200).
(7) FRoGS26: bulk gene expression embeddings are trained on the ARCHS4 RNA-seq expression compendium (dim = 256).
(8) TCGA-Embedding27: bulk gene expression embeddings are trained on The Cancer Genome Atlas gene expression profiles (dim = 50).
Compared methods for spatial transcriptomics prediction and pathological region segmentation
We compare CoxFormer with existing scRNA-seq reference-based imputation methods that predict gene expression in spatial transcriptomics data74. To ensure reproducibility, each baseline is run with the recommended settings, and key parameters are fixed as follows.
(1) gimVI38: implemented in the Python package scvi-tools and run following the official tutorial from https://docs.scvi-tools.org/en/0.8.0/user_guide/notebooks/gimvi_tutorial.html, where the spatial distribution of genes is obtained using the function model.get_imputed_values() with the argument normalized = False;
(2) SpaGE36: implemented from the GitHub repository SpaGE and run following the tutorial notebook at https://github.com/tabdealal/SpaGE/blob/master/SpaGE_Tutorial.ipynb, where we set the parameter n_pv = Ngene/2;
(3) Tangram37: implemented in the Python package tangram following the instructions at https://github.com/broadinstitute/Tangram, where we set the key parameters to modes = “clusters” and density = “rna_count_based”;
(4) Seurat41: implemented in the R package Seurat (version 5.3.0) following the online integration tutorial at https://satijalab.org/seurat/articles/integration_mapping, where we used reduction = “cca” and k.filter = NA; if Ngene > 30 we set dims = 30, otherwise we set dims = Ngene, and the predicted spatial distribution of genes is obtained using the function TransferData();
(5) SpaOTsc35: implemented from the Python package SpaOTsc following the instructions at https://github.com/zcang/SpaOTsc, where the spatial distribution of genes is computed using the function transport_plan() with parameters alpha = 0, rho = 1.0, epsilon = 0.1, and scaling = False;
(6) novoSpaRc40: implemented in the Python package novosparc and run following the tutorial at https://github.com/rajewsky-lab/novosparc/blob/master/reconstruct_drosophila_embryo_tutorial.ipynb, where we set alpha_linear = 0.5, loss_fun = “square_loss”, and epsilon = 5 × 10−3;
(7) LIGER42: implemented from the GitHub repository https://github.com/MacoskoLab/liger, where the predicted spatial distribution of genes is obtained by k-nearest neighbors (kNN)-based imputation in the shared low-dimensional space (knn = 30);
(8) stPlus39: implemented from the GitHub repository http://github.com/xy-chen16/stPlusand following the recommended settings with t_min = 5 and n_neighbors = 50.
Compared methods for spatial epigenomics prediction
We compare CoxFormer with three single-source embedding variants based on gene co-expression, gene correlation and gene description. The co-expression and correlation representations are constructed from an 18,858 × 18,858 COXPRESdb-derived matrix and a 32,101 × 32,101 transcriptome-wide correlation matrix estimated from the HCA, respectively. Because directly using these high-dimensional per-gene vectors is memory-prohibitive, we apply PCA to reduce them to 512 dimensions, consistent with CoxFormer. In contrast, the description-based representations comprised 43,661 × 3072 text embeddings obtained via the OpenAI embedding API and were used in their original form. Across all variants, we keep the Transformer-based spatial generative framework, with the training protocol and all other settings unchanged.
Compared methods for super resolution enhancement
We compare CoxFormer with iStar45, a widely used framework for enhancing the spatial resolution of Visium measurements by leveraging histology results to infer finer-grained expression patterns. iStar is implemented from the GitHub repository https://github.com/daviddaiweizhang/istar, following the default training setting with epochs = 400 and lr = 1e-4.
Evaluation metrics
We evaluate the performance of CoxFormer and competing methods using a set of complementary metrics. In brief, gene-level tasks and pathological region segmentation tasks are assessed as supervised classification problems using five standard metrics: AUROC, Accuracy, F1-score, Precision, and Recall (AUROC, ACC, F1, PRE, and REC, respectively). Cell-level tasks are evaluated with both supervised cell-type classification (the same five metrics) and unsupervised clustering (ARI, NMI, and AMI), and summarized into an aggregated cell-task score. Spatial prediction tasks are primarily evaluated using three complementary spatial inference metrics: Pearson correlation coefficient (PCC), structural similarity index (SSIM), and root mean squared error (RMSE).
Classification metrics
For supervised classification, we use metrics based on the confusion matrix and predicted probabilities. ACC, PRE, REC, and F1 quantify the point-estimate performance at a fixed decision threshold (0.5). Let TP, FP, TN, and FN denote true positives, false positives, true negatives, and false negatives, respectively. These metrics are defined as:
| 19 |
The AUROC evaluates the global discriminative ability across all decision thresholds. It can be expressed as the integral of a ROC curve that plots the true positive rate (TPR) against the false positive rate (FPR):
| 20 |
Clustering metrics
For unsupervised clustering, we evaluate the agreement between a predicted partition U and ground-truth groups V using information-theoretic and pairwise-consistency metrics. Specifically, we report NMI, AMI, and ARI, where larger values indicate better alignment with the ground-truth structure.
NMI measures the mutual dependence between two partitions and is normalized by their entropies. With I(U; V) denoting mutual information and H(⋅) denoting entropy:
| 21 |
AMI corrects mutual information for chance agreement using the expected mutual information under a standard permutation model:
| 22 |
ARI assesses pairwise agreement between partitions, corrected for chance. Let RI be the Rand index and be its expected value:
| 23 |
where the denominator uses .
Gene-task score
To provide a single summary number for gene-level benchmarks, we compute a gene-task score by averaging the five classification metrics over the four gene-level tasks. Let denote the set of gene-level tasks and . The gene-task score is:
| 24 |
Cell-task score
Similarly, we compute a cell-task score by averaging classification and clustering metrics over the four scRNA-seq datasets. Let denote the datasets and . The cell-task score is:
| 25 |
Spatial inference metrics
To evaluate the consistency between the ground-truth and predicted spatial expression patterns, we use three complementary metrics: PCC, SSIM, and RMSE. For each gene g, let and denote the ground-truth and predicted expression vectors across nspot spots. Let μ(⋅) and σ(⋅) denote the sample mean and sample standard deviation over spots, and let cov(⋅, ⋅) denote the sample covariance. Higher values indicate better performance for PCC and SSIM, whereas lower values indicate better performance for RMSE.
PCC measures linear consistency between the two spatial profiles:
| 26 |
SSIM compares local spatial patterns by combining luminance, contrast, and structural terms. For each gene, we first rescale the spatial maps to [0, 1]:
| 27 |
and denote the rescaled vectors by and . With constants C1 = 0.01 and C2 = 0.03, SSIM is computed as:
| 28 |
RMSE measures the absolute error between standardized profiles. We first apply z-score normalization across spots:
| 29 |
and then compute:
| 30 |
Datasets and preprocessing
Large-scale scRNA-seq data for correlation learning
In the computation of gene correlations, we curate a comprehensive scRNA-seq dataset from the HCA, comprising 10.4 × 106 cells across 123 healthy human tissue projects generated with 10× Genomics V2 chemistry. Raw count matrices are processed using the Scanpy (version 1.9.8) library71, computing quality control (QC) metrics for mitochondrial (MT), ribosomal, and hemoglobin genes. We apply a rigorous outlier detection strategy based on median absolute deviations (MADs). Cells are excluded if their library size, detected gene count, or the percentage of counts in the top 20 genes deviated by more than 5 MADs from the population median. Furthermore, cells exhibiting > 8% mitochondrial counts or those identified as outliers (> 3 MADs) in mitochondrial proportion are removed to ensure high data quality.
ScRNA-seq data for cell-level task
We test cell-type annotation on four datasets, including Human CD34+ Bone Marrow (BM) (n = 5780 cells; 10 cell types), Breast Cancer FFPE (BC) (n = 10,689 cells; 19 cell types), Diffuse Large B-cell Lymphoma FFPE (DLBL) (n = 39,713 cells; 17 cell types), and Lung Cancer FFPE (LC) (n = 35,954 cells; 19 cell types). For each scRNA-seq dataset, we normalize the raw counts by library size to a total sum of 10,000, which is then followed by log-transformation ().
Spatial transcriptomics data for gene expression imputation task
We benchmark CoxFormer’s performance for spatial gene expression prediction using six HBC datasets profiled by the 10× Genomics Visium platform, paired with a matched scRNA-seq reference. To examine the effect of input expression scale, we consider both raw-count and normalized-input settings in this benchmark. For the normalized-input setting, both spatial and scRNA-seq datasets are first normalized by library size to a total sum of 10,000, which is then followed by log-transformation (). Specifically, for the spatial transcriptomics data, we implement an additional quality control step, where genes expressed in fewer than 10% of spatial spots are filtered out to mitigate technical noise. We then identify HVGs using the Scanpy (version 1.9.8) with the sc.pp.highly_variable_genes function (flavor = “seurat_v3”)71, selecting the top 1000 genes for spatial transcriptomics prediction. To assess whether CoxFormer can generate transcript profiles of unknown targets, we randomly partition 90% of HVGs for training and reserve the remaining 10% genes for evaluation.
Spatial epigenomics data for cross-modal applications
We demonstrate the utility of CoxFormer for cross-modality prediction with a human hippocampus dataset measured by spatial ATAC-RNA-seq. For the spatial transcriptomics layer, we apply library-size normalization to a total sum of 10,000 and log-transformation to identify the top 1000 HVGs using Scanpy (v1.9.8) with sc.pp.highly_variable_genes (flavor = “seurat_v3”)71. For spatial epigenomics data, the chromatin accessibility data are obtained as GAS from ref. 44, which are calculated using the Gene Score model implemented in ArchR. To benchmark the prediction, we train the model on 90% of the identified HVG GAS profiles and reserve the remaining 10% for assessment.
Spatial subcellular transcriptomics data for super-resolution enhancement
We utilize high-resolution human skin datasets profiled by the 10× Genomics Xenium in situ platform to benchmark CoxFormer’s performance in super-resolution enhancement. We collect two sections, one that is measured with the standard Xenium Human Skin Gene Expression Panel comprising 280 genes, and another that is profiled with an augmented panel including custom targets, totaling 378 genes.
To evaluate super-resolution imputation, we construct pseudo-Visium datasets by spatially binning the high-resolution Xenium transcript coordinates into spot-level measurements. Specifically, we define capture locations within the tissue area at 100 μm intervals, constructing circular spots with a diameter of 55 μm to match the standard Visium spot geometry. We assign each Xenium transcript to the nearest spot center and aggregated transcript counts per gene within each spot to obtain a spot-by-gene expression matrix. Spots with zero assigned transcripts are removed, yielding two pseudo-Visium skin datasets at spot resolution.
In addition to spot-level expression, we derive cell-scale visual features from the paired histology images. We rescale the Xenium histology images to a resolution of 0.5 μm/pixel and extract a morphological feature vector for each non-overlapping 16 × 16 pixel block using a Vision Transformer (ViT) model pre-trained on large-scale histology images65. Notably, each block represents an 8 × 8 μm tissue region, which approximately corresponds to the scale of a small mammalian cell scale (10–20 μm in diameter).
Spatial transcriptomics data for pathological regions segmentation
For abnormal region detection, we use four spatial transcriptomics sections from a CRLM cohort, including two primary colorectal tumor (CRC) sections and two matched LM sections75. The slides span two clinical conditions, with two sections from an untreated case and two sections from a therapy-treated case showing partial response (PR). Concretely, CRC1 corresponds to an untreated CRC section, LM1 corresponds to an untreated LM section, CRC2 corresponds to a PR CRC section, and LM2 corresponds to a PR LM section. For each slide, we process the raw spot counts using a standard workflow, first normalizing by library size to a total count of 10,000 per spot and then subjected to log-transformation using . We further perform an additional quality control step by filtering out genes expressed in fewer than 10% of spatial spots to reduce technical noise.
For gene splitting, we use a housekeeping (HK) gene-based strategy to predict a pseudo-healthy reference. Specifically, HK genes, defined by a curated list from the ref. 50, serve as observed inputs for model training, whereas all non-HK genes are treated as prediction targets for abnormal region detection. For quantitative evaluation, we randomly hold out 100 HK genes from the input set and included them in the test targets, enabling a direct comparison between predicted and measured expression.
Statistics and reproducibility
No statistical method was used to predetermine sample size. No data were excluded from the analyses. The experiments were not randomized. The Investigators were not blinded to allocation during experiments and outcome assessment.
To reproduce the results presented in this paper, the demo code with default parameters is available at our GitHub repository: https://github.com/yyyancy/CoxFormer.
Reporting summary
Further information on research design is available in the Nature Portfolio Reporting Summary linked to this article.
Supplementary information
Source data
Author contributions
J.L. initiated and designed the study; Y.Y. developed and implemented the model and built the pipeline with assistance from X.L. and H.Z.; Y.Y., X.L., and H.Z. performed the benchmark evaluations and the downstream analyses; J.L., Y.Y., and X.L. wrote the manuscript; Y.Y., X.L., H.Z., Y.D.W., Y.J., X.S., Y.W., T.Y., and J.L. edited and revised the manuscript.
Peer review
Peer review information
Nature Communications thanks Pankaj Yadav and Rui Chen for their contribution to the peer review of this work. A peer review file is available.
Funding
This work was partially supported by the National Natural Science Foundation of China (Grant No. 12371283 and 32561160132 to J.L.; No. 725B2030 to Y.Y.; No. 12371513 to Y.W.), the Shenzhen Loop Area Institute (Grant No. FPF10120250014; Contract No. SLAI2026020007), Shenzhen Fundamental Research Program (Grant No. JCYJ20240813113518024), the Program for Guangdong Introducing Innovative and Entrepreneurial Teams (Grant No. 2023ZT10X044), Shenzhen Science and Technology Program (Shenzhen Key Laboratory Grant No. ZDSYS20230626091302006), the Guangdong Provincial Key Laboratory of Mathematical Foundations for Artificial Intelligence (Grant No. 2023B1212010001), 1+1+1 CUHK-CUHK(SZ)-GDSTC Joint Collaboration Fund (Grant No. 2025A0505000057), and Shenzhen Stability Science Program.
Data availability
Source data are provided with this paper. All datasets utilized in this study are publicly accessible. (1) the COXPRESdb database (Microarray_m.c7 version) is available at https://coxpresdb.jp/download/; (2) the Human Cell Atlas single-cell RNA sequencing (scRNA-seq) dataset is available at https://explore.data.humancellatlas.org/projects; (3) Gene classification datasets are available at https://huggingface.co/datasets/ctheodoris/Genecorpus-30M/tree/main/example_input_files/gene_classification. (4) scRNA-seq datasets for cell-level task: Diffuse Large B-cell Lymphoma FFPE (DLBL), Breast Cancer FFPE (BC), Lung Cancer FFPE (LC) are accessed from the CZ CELLxGENE collection https://cellxgene.cziscience.com/collections/bd552f76-1f1b-43a3-b9ee-0aace57e90d6, and Bone Marrow (BM) are downloaded via scvelo.datasets.bonemarrow(); (5) 10× Visium human breast cancer spatial transcriptomics data (HBC1–6) are available from Zenodo (https://zenodo.org/record/4739739), corresponding to samples CID4535 (HBC1), CID44971 (HBC2), CID4465 (HBC3), CID4290 (HBC4), 1160920F (HBC5), and CID3586 (HBC6); (6) 10× Chromium human breast cancer scRNA-seq data are available from GEO under accession GSM5354513 (https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSM5354513); (7) spatial ATAC-RNA-seq human brain hippocampal spatial transcriptomics and epigenomics data are available at https://cells.ucsc.edu/?ds=brain-spatial-omics; (8) 10× Xenium human skin melanoma data (Section A) are available from 10x Genomics at https://www.10xgenomics.com/datasets/human-skin-preview-data-xenium-human-skin-gene-expression-panel-add-on-1-standard; (9) 10× Xenium human skin melanoma data (Section B) are available from 10× Genomics at https://www.10xgenomics.com/datasets/human-skin-preview-data-xenium-human-skin-gene-expression-panel-1-standard; (10) 10× Visium human colorectal cancer liver metastasis spatial transcriptomics data (CRC1-2 and LM1-2) are available from scCRLM (http://www.cancerdiversity.asia/scCRLM), corresponding to samples ST-P1, colon (CRC1), ST-P4, colon (CRC2), ST-P2, liver (LM1), and ST-P4, liver (LM2); (11) Illumina NextSeq 500 scRNA-seq data from normal human colon are available from GEO under accession GSM7290762 (https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSM7290762); (12) Illumina NextSeq 500 scRNA-seq data from normal human liver are available from GEO under accession GSM7290760 (https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSM7290760). Source data are provided with this paper.
Code availability
CoxFormer is freely available as a Python package accessible at https://github.com/yyyancy/CoxFormer (https://doi.org/10.5281/zenodo.21449139) with detailed tutorials and documentation at https://coxformer.readthedocs.io/en/latest/. To facilitate replication of the figures and results presented in this paper, detailed workflows are provided as Jupyter notebooks within the GitHub repository and documentation.
Competing interests
The authors declare no competing interests.
Footnotes
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
These authors contributed equally: Yiyang Yang, Xu Liao, Haoyu Zhang.
Contributor Information
Yao Wang, Email: yao.s.wang@gmail.com.
Tianshu Yu, Email: yutianshu@cuhk.edu.cn.
Jin Liu, Email: liujinlab@cuhk.edu.cn.
Supplementary information
The online version contains supplementary material available at https://doi.org/10.1038/s41467-026-76404-8.
References
- 1.Obayashi, T., Kodate, S., Hibara, H., Kagaya, Y. & Kinoshita, K. Coxpresdb v8: an animal gene coexpression database navigating from a global view to detailed investigations. Nucleic Acids Res.51, D80–D87 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 2.Van Dam, S., Vosa, U., van der Graaf, A., Franke, L. & de Magalhaes, J. P. Gene co-expression analysis for functional classification and gene–disease predictions. Brief. Bioinforma.19, 575–592 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 3.Wang, Z., Fang, H., Tang, N. L.-S. & Deng, M. Vcnet: vector-based gene co-expression network construction and its application to RNA-seq data. Bioinformatics33, 2173–2181 (2017). [DOI] [PubMed] [Google Scholar]
- 4.Lu, S. & Keleş, S. Debiased personalized gene coexpression networks for population-scale scRNA-seq data. Genome Res.33, 932–947 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 5.Marco Salas, S. et al. Optimizing xenium in situ data utility by quality assessment and best-practice analysis workflows. Nat. Methods.22, 813–823 (2025). [DOI] [PMC free article] [PubMed]
- 6.He, S. et al. High-plex imaging of RNA and proteins at subcellular resolution in fixed tissue by spatial molecular imaging. Nat. Biotechnol.40, 1794–1806 (2022). [DOI] [PubMed] [Google Scholar]
- 7.Chen, K. H., Boettiger, A. N., Moffitt, J. R., Wang, S. & Zhuang, X. Spatially resolved, highly multiplexed RNA profiling in single cells. Science348, aaa6090 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 8.Moffitt, J. R. et al. Molecular, spatial, and functional single-cell profiling of the hypothalamic preoptic region. Science362, eaau5324 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Ståhl, P. L. et al. Visualization and analysis of gene expression in tissue sections by spatial transcriptomics. Science353, 78–82 (2016). [DOI] [PubMed] [Google Scholar]
- 10.Stickels, R. R. et al. Highly sensitive spatial transcriptomics at near-cellular resolution with slide-seqv2. Nat. Biotechnol.39, 313–319 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 11.Yang, F. et al. scBERT as a large-scale pretrained deep language model for cell type annotation of single-cell RNA-seq data. Nat. Mach. Intell.4, 852–866 (2022). [Google Scholar]
- 12.Theodoris, C. V. et al. Transfer learning enables predictions in network biology. Nature618, 616–624 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 13.Cui, H. et al. scgpt: toward building a foundation model for single-cell multi-omics using generative AI. Nat. Methods21, 1470–1480 (2024). [DOI] [PubMed] [Google Scholar]
- 14.Ding, S. et al. scgpt: end-to-end protocol for fine-tuned retinal cell type annotation. Nature Protoc.21, 873–893 (2026). [DOI] [PubMed]
- 15.Simon, E., Swanson, K. & Zou, J. Language models for biological research: a primer. Nat. Methods21, 1422–1429 (2024). [DOI] [PubMed] [Google Scholar]
- 16.Consens, M. E. et al. Transformers and genome language models. Nat. Mach. Intell.7, 346–362 (2025).
- 17.Chen, Y. & Zou, J. Simple and effective embedding model for single-cell biology built from chatgpt. Nat. Biomed. Eng.9, 483–493 (2025). [DOI] [PubMed] [Google Scholar]
- 18.Chen, Y. & Zou, J. Genepert: leveraging genept embeddings for gene perturbation prediction. Preprint at https://www.biorxiv.org/content/10.1101/2024.10.27.620513v1 (2024).
- 19.Zhu, O. & Li, J. Scouter predicts transcriptional responses to genetic perturbations with large language model embeddings. Nat. Comput. Sci.6, 21–28 (2026). [DOI] [PMC free article] [PubMed]
- 20.Wang, G., Liu, T., Zhao, J., Cheng, Y. & Zhao, H. Modeling and predicting single-cell multi-gene perturbation responses with sclambda. Preprint at https://www.biorxiv.org/content/10.1101/2024.12.04.626878v1.full (2024).
- 21.Rozenblatt-Rosen, O., Stubbington, M. J., Regev, A. & Teichmann, S. A. The human cell atlas: from vision to reality. Nature550, 451–453 (2017). [DOI] [PubMed] [Google Scholar]
- 22.Brown, G. R. et al. Gene: a gene-centered information resource at NCBI. Nucleic Acids Res.43, D36–D42 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 23.Stelzer, G. et al. The genecards suite: from gene data mining to disease genome sequence analyses. Curr. Protoc. Bioinforma.54, 1–30 (2016). [DOI] [PubMed] [Google Scholar]
- 24.Consortium, U. et al. Uniprot: the universal protein knowledgebase in 2025. Nucleic Acids Res.53, D609 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 25.OpenAI. New Embedding Models and API Updates (accessed 16 January 2026) https://openai.com/index/new-embedding-models-and-api-updates/ (2024).
- 26.Chen, H. et al. Drug target prediction through deep learning functional representation of gene signatures. Nat. Commun.15, 1853 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 27.Choy, C. T., Wong, C. H. & Chan, S. L. Embedding of genes using cancer gene expression data: biological relevance and potential application on biomarker discovery. Frontiers in genetics.9, 682 (2019). [DOI] [PMC free article] [PubMed]
- 28.Du, J. et al. Gene2vec: distributed representation of genes based on co-expression. BMC Genomics20, 82 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 29.Chen, Q. et al. Bioconceptvec: creating and evaluating literature-based biomedical concept embeddings on a large scale. PLoS Comput. Biol.16, e1007617 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 30.Kim, S., Lee, H., Kim, K. & Kang, J. Mut2vec: distributed representation of cancerous mutations. BMC Med. Genomics11, 33 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 31.Grootens, J., Ungerstedt, J. S., Nilsson, G. & Dahlin, J. S. Deciphering the differentiation trajectory from hematopoietic stem cells to mast cells. Blood Adv.2, 2273–2281 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 32.Tang, W., Wang, X., Han, B., Jiang, S.-H. & Cao, H. Tumor-associated macrophages in cancer: from mechanisms to application. Mol. Biomed.6, 145 (2025). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 33.Laviron, M. et al. Tumor-associated macrophage heterogeneity is driven by tissue territories in breast cancer. Cell Rep.39, 110865 (2022). [DOI] [PubMed] [Google Scholar]
- 34.Wu, S. Z. et al. A single-cell and spatially resolved atlas of human breast cancers. Nat. Genet.53, 1334–1347 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 35.Cang, Z. & Nie, Q. Inferring spatial and signaling relationships between cells from single cell transcriptomic data. Nat. Commun.11, 2084 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 36.Abdelaal, T., Mourragui, S., Mahfouz, A. & Reinders, M. J. Spage: spatial gene enhancement using scrna-seq. Nucleic Acids Res.48, e107–e107 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 37.Biancalani, T. et al. Deep learning and alignment of spatially resolved single-cell transcriptomes with Tangram. Nat. Methods18, 1352–1362 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 38.Lopez, R. et al. A joint model of unpaired data from scRNA-seq and spatial transcriptomics for imputing missing gene expression measurements. In ICML Workshop on Computational Biology, 10.48550/arXiv.1905.02269 (2019). [DOI]
- 39.Shengquan, C., Boheng, Z., Xiaoyang, C., Xuegong, Z. & Rui, J. stplus: a reference-based method for the accurate enhancement of spatial transcriptomics. Bioinformatics37, i299–i307 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 40.Nitzan, M., Karaiskos, N., Friedman, N. & Rajewsky, N. Gene expression cartography. Nature576, 132–137 (2019). [DOI] [PubMed] [Google Scholar]
- 41.Stuart, T. et al. Comprehensive integration of single-cell data. Cell177, 1888–1902 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 42.Welch, J. D. et al. Single-cell multi-omic integration compares and contrasts features of brain cell identity. Cell177, 1873–1887 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 43.Zhang, H. et al. The apolipoprotein C1 is involved in breast cancer progression via EMT and MAPK/JNK pathway. Pathol.-Res. Pract.229, 153746 (2022). [DOI] [PubMed] [Google Scholar]
- 44.Zhang, D. et al. Spatial epigenome–transcriptome co-profiling of mammalian tissues. Nature616, 113–122 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 45.Zhang, D. et al. Inferring super-resolution tissue architecture by integrating spatial transcriptomics with histology. Nat. Biotechnol.42, 1372–1377 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 46.Reynolds, G. et al. Developmental cell programs are co-opted in inflammatory skin disease. Science371, eaba6500 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 47.Winkler, J., Abisoye-Ogunniyan, A., Metcalf, K. J. & Werb, Z. Concepts of extracellular matrix remodelling in tumour progression and metastasis. Nat. Commun.11, 5120 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 48.Harrison, O. J. et al. Structural basis of adhesive binding by desmocollins and desmogleins. Proc. Natl. Acad. Sci. USA113, 7160–7165 (2016). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 49.Gardai, S. J. et al. By binding sirpα or calreticulin/cd91, lung collectins act as dual function surveillance molecules to suppress or enhance inflammation. Cell115, 13–23 (2003). [DOI] [PubMed] [Google Scholar]
- 50.Hounkpe, B. W., Chenou, F., De Lima, F. & De Paula, E. V. Hrt atlas v1. 0 database: redefining human and mouse housekeeping genes and candidate reference transcripts by mining massive RNA-seq datasets. Nucleic Acids Res.49, D947–D955 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 51.Xu, H. et al. Identification and verification of core genes in colorectal cancer. BioMed. Res. Int.2020, 8082697 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 52.Schott, M. et al. Open-st: high-resolution spatial transcriptomics in 3d. Cell187, 3953–3972 (2024). [DOI] [PubMed] [Google Scholar]
- 53.Zhao, H. et al. So3d: a comprehensive three-dimensional spatial omics resource for decoding tissue architecture in physiology and disease. Nucleic Acids Res.54, 1281–1290 (2026). [DOI] [PMC free article] [PubMed]
- 54.Xie, P. et al. Digital reconstruction of full embryos during early mouse organogenesis. Cell188, 4754–4772 (2025). [DOI] [PubMed]
- 55.Karimi, E. et al. Method of the year 2024: spatial proteomics. Nat. Methods21, 2195–2196 (2024). [DOI] [PubMed] [Google Scholar]
- 56.Wu, M. et al. Spatial proteomics: unveiling the multidimensional landscape of protein localization in human diseases. Proteome Sci.22, 7 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 57.Hu, B., Zhu, J. & Zhao, F. The evolving landscape of spatial proteomics technologies in the AI age. Fundam. Res.6, 28–39 (2024). [DOI] [PMC free article] [PubMed]
- 58.Wheeler, K., Gosmanov, C., Sandoval, M. J., Yang, Z. & McCall, L.-I. Frontiers in mass spectrometry-based spatial metabolomics: current applications and challenges in the context of biomedical research. TrAC Trends Anal. Chem.175, 117713 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 59.Min, X. et al. Spatially resolved metabolomics: from metabolite mapping to function visualising. Clin. Transl. Med.14, e70031 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 60.Müller-Dott, S. et al. Expanding the coverage of regulons from high-confidence prior knowledge for accurate estimation of transcription factor activities. Nucleic Acids Res.51, 10934–10949 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 61.Yuan, Q. & Duren, Z. Inferring gene regulatory networks from single-cell multiome data using atlas-scale external data. Nat. Biotechnol.43, 247–257 (2025). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 62.Funk, M. W., Wang, Y. & Wang, L. Airqtl dissects cell state-specific causal gene regulatory networks with efficient single-cell eqtl mapping. Nat. Commun.16, 11403 (2025). [DOI] [PMC free article] [PubMed]
- 63.Hamilton, W. L., Ying, Z. & Leskovec, J. Inductive representation learning on large graphs. Adv. Neural Inf. Process. Syst. 30, 1024–1034 (2017).
- 64.Vaswani, A. et al. Attention is all you need. Adv. Neural Inf. Process. Syst.30, 5998–6008 (2017).
- 65.Chen, R. J. et al. Scaling vision transformers to gigapixel images via hierarchical self-supervised learning. In Proc. IEEE/CVF conference on Computer Vision and Pattern Recognition, 16144–16155 (2022).
- 66.Mildenhall, B. et al. Nerf: Representing scenes as neural radiance fields for view synthesis. Commun. ACM65, 99–106 (2021). [Google Scholar]
- 67.Ni, Z., Zhou, X.-Y., Aslam, S. & Niu, D.-K. Characterization of human dosage-sensitive transcription factor genes. Front. Genet.10, 1208 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 68.Chen, C.-H. et al. Determinants of transcription factor regulatory range. Nat. Commun.11, 2472 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 69.Bernstein, B. E. et al. A bivalent chromatin structure marks key developmental genes in embryonic stem cells. Cell125, 315–326 (2006). [DOI] [PubMed] [Google Scholar]
- 70.Dimitrov, D. et al. Liana+ provides an all-in-one framework for cell–cell communication inference. Nat. Cell Biol.26, 1613–1622 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 71.Wolf, F. A., Angerer, P. & Theis, F. J. Scanpy: large-scale single-cell gene expression data analysis. Genome Biol.19, 15 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 72.Fang, Z., Liu, X. & Peltz, G. Gseapy: a comprehensive package for performing gene set enrichment analysis in Python. Bioinformatics39, btac757 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 73.Zhong, J., Li, L., Dannenfelser, R. & Yao, V. Benchmarking gene embeddings from sequence, expression, network, and text models for functional prediction tasks. Preprint at https://www.biorxiv.org/content/10.1101/2025.01.29.635607v2 (2025).
- 74.Li, B. et al. Benchmarking spatial and single-cell transcriptomics integration methods for transcript distribution prediction and cell type deconvolution. Nat. Methods19, 662–670 (2022). [DOI] [PubMed] [Google Scholar]
- 75.Wu, Y. et al. Spatiotemporal immune landscape of colorectal cancer liver metastasis at single-cell level. Cancer Discov.12, 134–153 (2022). [DOI] [PubMed] [Google Scholar]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Supplementary Materials
Data Availability Statement
Source data are provided with this paper. All datasets utilized in this study are publicly accessible. (1) the COXPRESdb database (Microarray_m.c7 version) is available at https://coxpresdb.jp/download/; (2) the Human Cell Atlas single-cell RNA sequencing (scRNA-seq) dataset is available at https://explore.data.humancellatlas.org/projects; (3) Gene classification datasets are available at https://huggingface.co/datasets/ctheodoris/Genecorpus-30M/tree/main/example_input_files/gene_classification. (4) scRNA-seq datasets for cell-level task: Diffuse Large B-cell Lymphoma FFPE (DLBL), Breast Cancer FFPE (BC), Lung Cancer FFPE (LC) are accessed from the CZ CELLxGENE collection https://cellxgene.cziscience.com/collections/bd552f76-1f1b-43a3-b9ee-0aace57e90d6, and Bone Marrow (BM) are downloaded via scvelo.datasets.bonemarrow(); (5) 10× Visium human breast cancer spatial transcriptomics data (HBC1–6) are available from Zenodo (https://zenodo.org/record/4739739), corresponding to samples CID4535 (HBC1), CID44971 (HBC2), CID4465 (HBC3), CID4290 (HBC4), 1160920F (HBC5), and CID3586 (HBC6); (6) 10× Chromium human breast cancer scRNA-seq data are available from GEO under accession GSM5354513 (https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSM5354513); (7) spatial ATAC-RNA-seq human brain hippocampal spatial transcriptomics and epigenomics data are available at https://cells.ucsc.edu/?ds=brain-spatial-omics; (8) 10× Xenium human skin melanoma data (Section A) are available from 10x Genomics at https://www.10xgenomics.com/datasets/human-skin-preview-data-xenium-human-skin-gene-expression-panel-add-on-1-standard; (9) 10× Xenium human skin melanoma data (Section B) are available from 10× Genomics at https://www.10xgenomics.com/datasets/human-skin-preview-data-xenium-human-skin-gene-expression-panel-1-standard; (10) 10× Visium human colorectal cancer liver metastasis spatial transcriptomics data (CRC1-2 and LM1-2) are available from scCRLM (http://www.cancerdiversity.asia/scCRLM), corresponding to samples ST-P1, colon (CRC1), ST-P4, colon (CRC2), ST-P2, liver (LM1), and ST-P4, liver (LM2); (11) Illumina NextSeq 500 scRNA-seq data from normal human colon are available from GEO under accession GSM7290762 (https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSM7290762); (12) Illumina NextSeq 500 scRNA-seq data from normal human liver are available from GEO under accession GSM7290760 (https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSM7290760). Source data are provided with this paper.
CoxFormer is freely available as a Python package accessible at https://github.com/yyyancy/CoxFormer (https://doi.org/10.5281/zenodo.21449139) with detailed tutorials and documentation at https://coxformer.readthedocs.io/en/latest/. To facilitate replication of the figures and results presented in this paper, detailed workflows are provided as Jupyter notebooks within the GitHub repository and documentation.
