Spatial transcriptomics technologies generate gene expression profiles with spatial context, requiring spatially informed analysis tools for three key tasks, spatial clustering, multisample integration, and cell-type deconvolution. We present GraphST, a graph self-supervised contrastive learning method that fully exploits spatial transcriptomics data to outperform existing methods. It combines graph neural networks with self-supervised contrastive learning to learn informative and discriminative spot representations by minimizing the embedding distance between spatially adjacent spots and vice versa. We demonstrated GraphST on multiple tissue types and technology platforms. GraphST achieved 10% higher clustering accuracy and better delineated fine-grained tissue structures in brain and embryo tissues. GraphST is also the only method that can jointly analyze multiple tissue slices in vertical or horizontal integration while correcting batch effects. Lastly, GraphST demonstrated superior cell-type deconvolution to capture spatial niches like lymph node germinal centers and exhausted tumor infiltrating T cells in breast tumor tissue. Advances in spatial transcriptomics technologies have enabled the gene expression profiling of tissues while retaining spatial context. Here the authors present GraphST, a graph self-supervised contrastive learning method that learns informative and discriminative spot representations from spatial transcriptomics data. Using spatial transcriptomics (ST), we can concurrently capture gene expression profiles and spatial information to achieve greater insights into both healthy and diseased tissues4. Spatial information is also useful for inferring cell–cell communications, especially juxtacrine signaling5. Within the spatial transcriptomics analysis workflow, assigning capture spots to spatial domains with unsupervised clustering is an essential task. Among the existing clustering methods employed in spatial domain identification, k-means, Louvain’s method6, and Seurat7 utilize only gene expression data to cluster spots into different domains. The domains identified by these methods are often discontinuous as they do not employ spatial information to identify colocalized cells that are likely to belong to the same domain.Within the tissues of multicellular organisms, cells are organized into groups of similar cells physically clustered together. Linking gene expression of cells with their spatial distribution is crucial for understanding the tissue’s emergent properties and pathology8 uses a Hidden Markov Random Field (HMRF) model to detect spatial domains with coherent gene expression patterns by fully exploiting the spatial dependency between spots. SpaGCN9 uses a graph convolutional network-based model to identify spatial domains by integrating gene expression, spatial location, and histology image. stLearn10 combines morphological features obtained from the histology image with gene expression of adjacent spots to cluster similar spots in the tissue. BayesSpace11 adopts a Bayesian statistical method that employs the information from spatial neighborhoods to improve clustering analysis. More recently, STAGATE12 uses a graph attention auto-encoder framework to identify spatial domains by integrating spatial information and gene expression profiles. Another method, Cell Clustering for Spatial Transcriptomics data (CCST), uses a graph convolutional network for unsupervised cell clustering13. However, these methods employ unsupervised learning, and they often show suboptimal clustering performance as the boundaries of identified domains are often fragmented and poorly match the pathological annotations. As ST ground-truth segmentation is usually not available, supervised learning cannot be employed to improve performance. Alternatively, self-supervised learning that uses unlabeled input data has been applied to identify spatial domains. For example, SpaceFlow14 employs a deep graph neural network with a contrastive learning strategy that creates negative examples by randomly permuting its spatial expression graph during the encoder learning process. conST15 proposes a contrastive learning framework with two training stages to learn a representative low-dimensional embedding. The second stage uses contrastive learning at three levels of contrast. However, the lack of consideration of the spots’ local context hampers their performance.Recently, several methods have been proposed to improve spatial domain identification by exploiting spatial information. For example, Giotto16 and scVI17, are not suitable as they only consider gene expression and do not employ the associated spatial information. Although STAGATE can be used to analyze multiple tissue slices, its performance is limited by the lack of batch effect removal capabilities. As such, spatially informed batch correction tools are needed for ST data.Spatial transcriptomics technologies have size restrictions on the area captured during data acquisition. To perform spatial transcriptomics on a tissue slice encompassing a whole organ of interest, the sample is dissected into multiple sections. These adjacent multiple sections will have to be inferred jointly to accurately identify tissue compartments within the whole organ. Multiple tissue sections can also be obtained via serial sectioning of the organ of interest, yielding serial tissue slices that capture 3D information in each spatial transcriptomics experiment. Therefore, there is a need for methods to integrate and learn the joint representation of adjacent tissue sections  and serial tissue sections . Most current analysis methods are suitable for only single tissue slices and cannot jointly identify spatial domains from multiple slices. Moreover, batch correction methods developed for scRNA-seq, such as Harmony19. More recent sequencing-based technologies, including Slide-seq20, DBiT-seq21, Stereo-seq22, PIXEL-seq23, and Seq-Scope24, offer subcellular spatial resolution but suffer from high dropout events that give rise to a very sparse gene-spot matrix. Meanwhile, fluorescent in situ hybridization (FISH)-based methods are capable of achieving subcellular resolution but lack genome-scale gene coverage, with the latest seqFish having a 10,000 gene limit25. To analyze data from low-resolution capture techniques, computational methods such as RCTD26, stereoscope27, SPOTlight28, cell2location29, CARD30, NNLS (AutoGeneS)32, and spatialDWLS33 have been developed. These methods perform cell-type deconvolution of low-resolution spots by leveraging cell-type-specific gene expression from RNA-seq. However, all current deconvolution methods except CARD ignore spatial location information. Moreover, they only return a matrix of cell-type composition, except RCTD and cell2location, which also calculate the cell-type-specific gene expressions for each location. Currently, cell-level deconvolution methods for achieving single-cell resolution of spatial transcriptomes are still lacking. Alternative to deconvolution, the projection of scRNA-seq data onto ST data can create single-cell resolution spatial transcriptomic maps with genome-wide gene coverage, which can also be used to infer cell-type compositions of ST spots and spatial localization of scRNA-seq. Tangram34 and other similar packages adopt a batch integration approach to correct for technical variations in the scRNA-seq and ST data to accomplish projection but do not employ spatial information. Therefore, spatially informed integration of scRNA-seq data with ST is needed to achieve more accurate cell-type deconvolution of ST and spatial registration of scRNA-seq.Current technological limitations also prevent ST from achieving single-cell resolution with gene coverage comparable to single-cell RNA sequencing (scRNA-seq). The popular 10x Visium platform can capture scRNA-seq scale transcriptomes but uses 55 µm capture spots that are larger than typical cells (5–10 µm)To address the aforementioned challenges, we developed GraphST, a graph self-supervised contrastive learning method that makes full use of spatial information and gene expression profiles for spatially informed clustering, batch integration, and cell-type deconvolution. By using self-supervised contrastive learning in GraphST, we found that it improves performance in learning relevant latent features for downstream analysis. GraphST first combines graph neural networks with augmentation-based self-supervised contrastive learning to learn representations of spots for spatial clustering by encoding both gene expression and spatial proximity. For the cell-type deconvolution task, we train an auto-encoder to learn informative cellular features from the scRNA-seq data in an unsupervised way. Thereafter, GraphST learns a mapping matrix to project the scRNA-seq data into the ST space based on their learned features via an augmentation-free contrastive learning mechanism where the similarities of spatially neighboring spots are maximized, and those of spatially non-neighboring spots are minimized. The mapping matrix is then used to estimate the cell-type compositions of ST spots. We extensively tested GraphST for the three analysis tasks on different 10x Visium, Stereo-seq, and Slide-seqV2 datasets of human and mice tissues, including the human brain, human breast cancer tissue, human lymph node, mouse breast cancer, mouse olfactory bulb, mouse brain, and mouse embryo. The clustering tests demonstrated GraphST’s superiority over seven existing methods in identifying spatial domains. Joint analyses on the mouse breast cancer and mouse brain datasets showed that GraphST was able to accurately identify spatial domains from multiple tissue slices while removing batch effects effectively without needing to explicitly detect batch factors. We also tested GraphST’s projection of scRNA-seq data onto ST to predict cell states (cell types and sample types) in spatial spots. The computed cell-to-spot mapping matrix gave a more accurate estimate of cell-type compositions than cell2location, the best-performing deconvolution method. Moreover, GraphST can transfer scRNA-seq-derived sample phenotypes onto ST. We demonstrated this capability by delineating tumor and normal adjacent regions in a tumor-derived tissue slice.GraphST comprises three modules, each with graph self-supervised contrastive learning architectures tailored for the three tasks respectively: spatially informed clustering Fig. , verticaIn the spatial clustering module, we adopt augmentation-based contrastive learning. We augment data by creating a corrupted graph by randomly shuffling gene expression vectors across spots while keeping the adjacency matrix of the original graph unchanged. As is observed in many tissue types, a spot in the spatial data usually contains cell types similar to its local context, e.g., one-hop or two-hop neighbors. Different spots in a tissue sample can have different local spatial contexts. Compared to a global context, the local context can better preserve spot-specific local neighborhood information and spot-to-spot variability. Therefore, our self-supervised contrastive learning strategy enforces spot embedding to capture local context, while most other contrastive learning methods capture global context. Specifically, we define positive pairs by pairing spot embedding with its local summary vector and negative pairs by pairing the local summary vector with its corresponding spot embedding from the corrupted graph. The local summary vector represents the local context of a spot and is obtained by a sigmoid of the mean of all its neighbors’ embeddings. This process brings spot embedding closer to its real local context from the original graph and pushes it away from its fake local context from the corrupted graph, such that spatially adjacent spots will have similar embeddings while nonadjacent spots will have dissimilar embeddings. Furthermore, considering that the corrupted graph has the same topological structure as the original graph, we define a corrupted contrastive loss (formula (5)) for the corrupted graph and combine it with the original contrastive loss (formula (4)) to form a symmetric contrastive loss, which can make the model training more stable and balanced. In addition to the contrastive loss, GraphST’s objective function includes a self-reconstruction loss. The learned representation 16, the mutual nearest neighbors (MNN) approach35, and Seurat 3.08. Moreover, as these methods were designed for nonspatial scRNA-seq data integration, they ignore spatial information when correcting for batch effects.In the vertical and horizontal integration module, GraphST learns batch-corrected representations of spots that can be used for downstream analysis, such as joint spatial clustering to map common spatial domains across multiple tissue sections. Before training the model in the GraphST framework, multiple sections are aligned vertically or stitched horizontally, and a shared graph is constructed. Thereafter, graph self-supervised contrastive learning is performed using the shared graph, which allows for the GraphST model to automatically smooth features of adjacent spots within and across sections. Therefore, after model training, not only do neighboring spots from the same section have similar representations, but neighboring spots from different sections will also have similar representations. Our GraphST framework removes batch effects implicitly during model training, unlike most existing approaches that remove batch effects by explicitly detecting batch factors, such as HarmonyIn the third module, GraphST projects scRNA-seq to ST by augmentation-free contrastive learning to achieve spatially informed cell-type deconvolution of ST spots. To reduce noises resulting from sequencing technology, we use an auto-encoder to learn cell representation 36. This dataset contains spatially resolved transcriptomic profiles of 12 DLPFC slices, each depicting the four or six layers of the human dorsolateral prefrontal cortex and white matter (WM). Here we tested GraphST and competing methods for their ability to recover the annotated anatomical cortex layers in an unsupervised manner. Across all 12 slices, GraphST achieved the highest median score of 0.60 among all methods, with only STAGATE’s performance as a close second  datasetond Fig. . GraphSTNext, we illustrate the results with one slice (#151673) in Fig. 19 and showed that GraphST was the best method. The full analysis results are available in Supplementary File Among the methods tested in this example, we only applied Seurat, STAGATE, and GraphST to the subsequent Stereo-seq and Slide-seq examples due to data format incompatibility. Consequently, we also tested all eight methods on a 10x Visium mouse brain dataset22. We first annotated the coronal mouse olfactory bulb’s laminar structure using the DAPI-stained image, identifying the olfactory nerve layer (ONL), glomerular layer (GL), external plexiform layer (EPL), mitral cell layer (MCL), internal plexiform layer (IPL), granule cell layer (GCL), and rostral migratory stream (RMS)  Fig. . OverallMS) Fig. . The resMS) Fig. . Here, wIn this example, we compared Seurat, STAGATE, and GraphST using a mouse hippocampus dataset acquired with Slide-seqV2. For this comparison, we employed the annotated Allen Brain Atlas as the ground truth Fig. . AlthougNwd2 and Gpr151. For the third ventricle, the Enpp2 expression did not align well with GraphST’s detected V3 region, but the latter better resembled the V3 region in the annotated brain reference. For comparison, Seurat and STAGATE’s V3 regions were closer to the shape of Enpp2 expression region but did not match the anatomical shape well.We further examined the regions’ marker gene expressions to verify GraphST’s clustering Fig. . For mos22. Tissue domain annotations were obtained from the original study wherein Leiden clustering from SCANPY37 was applied to the union of neighborhood graphs constructed using spatial proximity and transcriptomic similarity, and the computed clusters were annotated based on differentially expressed genes. We first examine the clustering results of the E9.5 embryo. Although the original annotation had 12 reference clusters , structural similarity index measure (SSIM), root mean squared error (RMSE), and Jensen–Shannon divergence (JSD) to compare performance  and cycling, dark zone (DZ), light zone (LZ) B cells to the annotated germinal center locations ons Fig. . Furtherons Fig. . In all ons Fig. . The map46 study with 78,886 cells and 30,062 genes and annotated with 33 cell types. The cell types spatially mapped by GraphST exhibited cortical layer-specific distribution patterns  dataset. The DLPFC has a clear layered tissue structure Fig.  which carns Fig. . Here, wWe further tested GraphST and cell2location for cell-type deconvolution with the mouse brain anterior dataset. GraphST similarly showed mappings with higher density and sharper edges, while cell2location’s mappings tend to be more diffuse. The full analysis results are presented in Supplementary File 47 onto the breast cancer ST dataset  in the IDC regions . The correspondence of the single cells with their mapped regions was also visualized with UMAP Fig. . Of the 50 and Bassez et al.51 in other human breast cancer samples, and both studies demonstrated their reactivation with anti-PD-L1 therapy to harness their cytotoxicity against the tumor cells.As the T cells were found across different tissue regions , we further investigated their differences Fig. . We firs49. In conclusion, this case study demonstrated the value of cell type and sample type deconvolution in exploring the heterogeneity present within tissues that may otherwise not be apparent from the histological analysis. Moreover, such analysis can also help to determine the appropriate number of regions for clustering purposes.When comparing the spatial mapping of cells from adjacent normal and solid tumor sites, adjacent normal cells were mainly mapped onto the Healthy  and Tumor edge  regions Fig. . The DCISpatial transcriptomics is a powerful experimental approach that measures gene expression while retaining the associated spatial context. This combination of gene expression and spatial information enables spatially informed clustering to identify coherent tissue domains that are biologically relevant. While powerful, ST faces technological limitations that computational approaches can help mitigate. First, ST capture areas are currently limited in size, necessitating multiple adjacent tissue slides to capture larger tissue samples. Horizontal data integration is thus needed for integrated studies. Extension to the three-dimensional characterization of a sample will require vertical data integration of serial tissue slides. Second, the two major experimental approaches in ST have their respective limitations, namely sequencing-based approaches with a low spatial resolution with each spot containing more than one cell and imaging methods with lower gene coverage at a higher subcellular resolution. Here, additional RNA-seq data offers the opportunity to infer the cellular composition or cellular transcriptome for the two approaches, respectively. In particular, scRNA-seq with single-cell resolution genome-wide gene coverage but no spatial information is highly relevant. We can perform ST spot cellular deconvolution with scRNA-seq, as well as assign cells and their transcriptomes to spots. In this paper, we presented GraphST, a graph self-supervised contrastive learning method that can effectively and efficiently perform spatial clustering, spatial transcriptomics data integration, and scRNA-seq data transfer onto ST data. GraphST employs graph neural networks to learn informative representations of the gene expression profiles with spatial locations. The learned representations are further refined using graph self-supervised contrastive learning with the spatial context information to be more informative and discriminative. For scRNA-seq data transfer, we use an auto-encoder to first extract features from the scRNA-seq data while reducing the noise before using spatially informed contrastive learning to train the cell-to-spot mapping matrix.When clustering spots in diverse ST datasets, GraphST was better than competing methods at identifying biologically accurate structures in highly heterogeneous tissue samples. We also demonstrated GraphST’s ability at vertical and horizontal data integration with multiple tissue samples. GraphST detected domains that were more continuous across samples and more accurate when integrating ST data horizontally. When integrating ST data vertically, it identified biologically coherent spatial domains that aligned across samples while removing the batch effect present. Finally, we validated GraphST’s ability to map scRNA-seq data onto ST-acquired spots to quantify the spatial distribution of cell types. We exemplified GraphST’s utility in analyzing tissue microenvironment by deconvoluting both the cancer cells and immune milieu present in breast cancer tissue.The key features of GraphST responsible for its superior performance are the use of graph neural networks and contrastive learning in capturing gene expression together with spatial information. While existing methods such as SpaGCN and STAGATE also use graph neural networks to learn gene expression and spatial information, they show poorer clustering performance and lack the ability to accomplish batch integration. The main differences between GraphST and these methods lie in the use of graph self-supervised contrastive learning to strengthen the latent representation learning and additional preservation of local spatial context information of spots. This makes the learned representation more informative and discriminative, thus improving clustering performance. Moreover, while there are similarities between GraphST and STAGATE in the integration of multiple samples, STAGATE’s limited capability in batch effect removal greatly limited its performance in vertical integration. On the other hand, although conST and SpaceFlow also adopted graph contrastive learnings for spatial clustering, GraphST possesses major technical differences and performance advantages compared to the other two methods. GraphST is different from conST and SpaceFlow in its definition of positive/negative pairs, formulation of the objective function and contrastive loss, and training procedure  onto the spatial space. Thus, GraphST can directly project scRNA-seq data onto the spatial spots to achieve cell-level deconvolution. While the mapping matrix learning process is similar between GraphST and Tangram, there are notable differences. Tangram only uses the raw gene expression, while GraphST employs augmentation-free contrastive learning to learn the mapping matrix and take in both the spatial location information and the informative and noise-reduced gene expression from the graph deep learning modules as input.In cell-type deconvolution, GraphST also offers improvements over competing methods. Most existing deconvolution methods, such as SPOTLightWe designed GraphST to be user-friendly and capable of processing data acquired from different experimental platforms. GraphST has been validated on 10x Visium, Slide-seqV2, and Stereo-seq data, and we plan to extend it to other ST platforms, such as MERFISH and Nanostring CosMx SMI. GraphST is also designed to be computationally efficient in handling challenges from large datasets. We anticipate that future developments in ST technologies will bring about subcellular resolution with full gene expression profiling, as well as general growth in dataset sizes. The largest dataset we tested contained about 100,000 spots (E14.5 mouse embryo), and it required 30 mins of wall-clock time on a server with Intel Core i7-8665U CPU and NVIDIA RTX A6000 GPU. We believe that our algorithm can handle existing datasets as well as newer ones in the near future. We also plan to further improve performance through distributed computing and batch training implementations.37. The normalized gene expression counts are then scaled to unit variance and zero mean. Finally, the top 3000 highly variable genes (HVGs) are selected to be input into the GraphST model. For ST cell-type composition deconvolution, scRNA-seq data is similarly preprocessed, where the raw gene expression counts are first log-transformed and normalized by library size and then scaled to unit variance and zero mean. Subsequently, the top 3000 highly variable genes are selected. To ensure consistent feature information, the common preprocessed HVGs of the scRNA-seq and ST data are used as input to GraphST to learn the latent representations of cells and spots, respectively.For spatial clustering, GraphST takes in gene expression counts and spatial position information. Raw gene expression counts are first log-transformed and normalized by library size via the SCANPY packagek spots as its neighbors from the top nearest neighbors. From our testing, GraphST achieved its best performance in most of the tested datasets with The strength of spatial transcriptomics is the associated spatial information that can be exploited to identify similar cell states that are also spatially co-located and thus demarcate tissue substructures. To make full use of the spatial information, we convert it into an undirected neighborhood graph For spatial clustering, a graph self-supervised contrastive learning framework is proposed to learn the spot representations from the input gene expression profiles and spatial information. Figure For subsequent contrastive learning, we first generate a corrupted neighborhood graph via data augmentation. Specifically, given a neighborhood graph 52 as encoder to learn a latent representation We designed a GNN-based encoder to learn spot representations that capture the informative parts of the gene expression profiles and spatial locations. The encoder takes the neighborhood graph After that, the latent representations As the output of the decoder, 53, we aggregate the neighbors’ representations as the local context of a spot i, i.e., To make the representation 54 for the optimization. The learning rate and training epoch are set to 0.001 and 600 for both spatial clustering and multiple ST data integration tasks, while 0.001 and 1200 are used for the scRNA-seq and ST data integration task.The representation learning module of ST data is trained by minimizing the self-reconstruction loss and contrastive loss. Briefly, the overall training loss of this module is defined as:55, to cluster the spots into different spatial domains. Each cluster is regarded as a spatial domain, containing spots with similar gene expression profiles and are spatially proximate. For tissue slices with manual annotation, we set the number of clusters to be the same as the ground truth. For tissue slices without manual annotations, we test different cluster counts and select the count that gives the highest Silhouette score56. Although the reconstructed spatial gene expression After model training, we use the reconstructed spatial gene expression der Fig.  with theThe discussion so far assumes only a single tissue slice as input. For biological analysis of tissue samples, integrated analysis of multiple tissue slices can yield greater insights. Two types of multiple sample analysis are possible, vertically split tissue slices (such as the mouse breast cancer sections 1 and 2) and horizontally split tissue slices (such as the mouse brain anterior and posterior sections). For the former, one major challenge for integrated analysis is the presence of batch effects among different slices, hindering data integration. For the latter, the challenge is to assign spots to domains such that the domains straddling the joining edge are aligned.57 to align their H&E images to ensure that the two slices are adjacent in space. Next, with the aligned spatial coordinates, a joint neighborhood graph for the two slices is constructed in the same way as with a single slice. The joint construction of the neighborhood graph makes it possible to consider both intra- and inter-slice adjacent spots as neighbors for a specific spot, enabling feature smoothing between adjacent spots across slices during the representation learning. Finally, with the joint neighborhood graph and gene expressions as inputs, GraphST learns the joint representation of the spots from the two slices for downstream spatial clustering .We employed PASTETo integrate scRNA-seq and ST data, we aim to learn a trainable mapping matrix ace Fig. . Each el34, which learns the mapping matrix directly using the raw gene expressions with high noise levels, GraphST retains and refines the informative and noise-reduced features from the raw gene expression profiles of both the scRNA-seq and ST data via deep learning modules before learning the mapping matrix. Specifically, for ST data, we take the output The mapping matrix e 1 Fig.  as the ie 1 Fig. . For theTo learn the mapping matrix }Hs Fig. . The oveUnlike most existing deconvolution methods, such as SPOTLight and cell2location, our GraphST model is independent of the scRNA-seq annotation information  during the mapping process.As the output of Module 3 Fig. , we can To circumvent the influences of spots with low scores, we empirically retain the scores of the top 10% cells for each spot in Although we can determine the spatial distribution of annotations (taking cell type as an example) in the H&E images, some cell types may span different spatial domains such that it becomes difficult to distinguish which cell types are found in which spatial domains. Therefore, we further extend our model to transfer annotations of scRNA-seq data into the spatial domain. With function (11), we can derive the annotation-to-spot projection matrix 5 metastatic murine breast cancer cells (4T1) tagged with luciferase were implanted into the mammary fat pads of 16- to 20-week-old Balb/cNTac mice. Tumor growth was monitored over 2 weeks using a digital caliper. Tumors were excised and extracted at 2 weeks for spatial transcriptomics.All animal work was approved by the NUS Institutional Animal Care and Use Committee (IACUC) and was in accordance with the National Advisory Committee for Laboratory Animal Research (NACLAR) Guidelines  . Here, 1 × 104T1 implanted mammary pad tumors during posttreatment were excised, immediately embedded in optimal cutting temperature (OCT) compound, and frozen on dry ice. Cryoblocks were kept at −80 °C and sent for histology analysis to obtain 20-µm sections. RNA quality was assessed for all tissue blocks using the RNeasy Mini kit (Qiagen). Ten sections were obtained from each cryoblock to verify the RNA quality for each respective block. Then, 600 µl of buffer RLT was added to the 10 sections and subsequently disrupted using a QIAshredder by centrifuging for 2 mins at maximum speed. RNA was extracted from the lysate with the RNeasy Mini kit using instructions from the “Purification of Total RNA from Animal Tissues” section, and quality was assessed via the RNA integrity number (RIN) value determined using the Agilent 2100 Bioanalyzer (Agilent). Cryoblocks-derived sections with RIN value ≥ 8 were used for the subsequent spatial transcriptomics experiments.Sections obtained at 20 µm were placed within the grids on prechilled Visium Tissue Optimization and Gene Expression slides (10x Genomics) and stored at −80 °C. For H&E staining, slides with sections were thawed at 37 °C for 1 min before fixation in methanol at −20 °C for 30 mins. H&E staining was performed according to the manufacturer’s protocol , with hematoxylin staining reduced from 7 mins to 5.5 mins. The optimal tissue permeabilization time of individual cryoblocks of each group was obtained from time-course assays performed on tissue optimization slides. This optimal timing was then used on the gene expression slides with the respective blocks to capture mRNA post-permeabilization. Images were all obtained and stitched together using EVOS FL Auto 2 (Thermofisher Scientific) with a 20x objective , and the raw images were saved in the TIF format. Fluorescence images were acquired using an RFP filter cube  with a 20x objective (Plan fluorite). The created RNA-seq libraries were then sequenced with Novaseq.36 . The number of spots in each slice ranged from 3460 to 4789, with 33,538 genes captured. Each slice was manually annotated to contain five to seven regions, namely the DLPFC layers and white matter. The second dataset of mouse brain tissue was downloaded from the publicly available 10x Genomics Data Repository (https://www.10xgenomics.com/resources/datasets). This dataset had two sections, of which we selected the anterior section. The selected section contained 2695 spots with 32,285 genes captured and was manually annotated with 52 regions using the Allen Brain Atlas reference (https://mouse.brain-map.org/static/atlas). The third dataset of the mouse olfactory bulb was acquired using Stereo-seq22, which was further processed and annotated58. The data contained 19,109 spots and 14,376 genes. The fourth dataset of the mouse hippocampus was acquired with Slide-seqV2 and was downloaded from . The section used was Puck_200115_08, with 52,869 spots. The last dataset consisted of Stereo-seq data acquired from two mouse embryos (E9.5 and E14.5)22, which we downloaded from https://db.cngb.org/stomics/mosta/. The E9.5 embryo data consisted of 5913 bins and 25,568 genes, while the E14.5 embryo data consisted of 92,928 bins and 18,566 genes.For spatial clustering, we employed five spatial gene expression datasets . The third example used the human brain sample DLPFC dataset, of which we used slice #151673. The corresponding snRNA-seq data of archived postmortem dorsolateral prefrontal cortex (BA9) tissue was acquired with the 10x Genomics Chromium platform (https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE144136). The snRNA-seq dataset was composed of 78,886 cells with 30,062 genes46. The final deconvolution example utilized the human breast cancer sample obtained from the publicly available 10x Genomics Data Repository (https://www.10xgenomics.com/resources/datasets/human-breast-cancer-block-a-section-1-1-standard-1-1-0). The dataset contained 3798 spots with 36,601 genes and was manually annotated with 20 regions. The corresponding scRNA-seq data were downloaded from the database DISCO47, consisting of cells from two different samples, i.e., adjacent normal and solid tumor (https://www.immunesinglecell.org/). The data consisted of 476,571 cells with 5000 genes, which we downsampled to 46,080 cells while maintaining the relative cell-type composition.In the third task of ST cell composition deconvolution with scRNA-seq reference data, we employed both simulated and experimentally acquired data. The first example tested simulated data obtained from the benchmarking study by Li et al.7 and spatial methods Giotto8, SpaGCN9, SpaceFlow14, conST15, BayesSpace11, and STAGATE12. To evaluate the performance of multiple tissue slice integration, we compared GraphST with Harmony16, scVI17, and STAGATE for vertical integration and STAGATE and SpaGCN for horizontal integration. For ST cell-type deconvolution with scRNA-seq data, GraphST was compared with cell2location, which had been benchmarked to be the best existing method41, as well as Seurat, RCTD, SPOTlight, and NNLS.To showcase the effectiveness of GraphST in spatial clustering, we compared GraphST with seven state-of-the-art methods, the nonspatial method SeuratSeurat. Seurat is a popular single-cell transcriptomics analysis library that has been extended to handle spatial transcriptomics data. We used the default pipeline and default parameters in Seurat as described in the spatial clustering vignette. As we were unable to specify the number of clusters in Seurat, we ran the FindClusters function at different resolutions and chose the resolution that gave us the desired number of clusters.Giotto. Giotto is a toolbox designed for spatial data analysis. We followed the tutorial in Giotto’s Github repository with default settings to preprocess the data. For clustering, we used the hidden random Markov random field model-based module designed for spatial pattern discovery. Specifically, we used the Giotto functions, init_hmrf_v2 and do_hmrf_v2 with default parameter values. The HMRF workflow is given at: https://bitbucket.org/qzhudfci/smfishhmrf-r/src/master/TRANSITION.md.SpaGCN. SpaGCN is a graph convolutional network approach that integrates gene expression, spatial location information, and histological images for ST data analysis. SpaGCN is one of the only two other methods that can perform horizontal ST data integration. Following the tutorial, we applied SpaGCN to spatial clustering and horizontal ST data integration with the default parameter settings. In particular, the parameter ‘histology’ was set to ‘False’. The learning rate and max training epoch were set to 0.05 and 200, respectively.conST. conST is a contrastive learning-based method that combines gene expression, spatial information, and morphology for ST data analysis. We applied conST on the DLPFC samples for spatial clustering with default parameter settings. Specifically, the parameter ‘use_img’ was set to ‘False’. The number of neighbors was set to 10 when constructing the neighborhood graph. The training epoch and learning rate were set to 200 and 0.01, respectively.SpaceFlow. SpaceFlow is a deep graph network that is developed for ST data analysis by combining gene expression profiles with their spatial locations. We ran SpaceFlow for comparison on spatial clustering. We used the default parameter settings to preprocess data and run the model. In particular, the gene with expression in fewer than three cells and cells with expression of fewer than 100 genes were removed. After that, the normalized expression was multiplied by a scale factor of 10,000 and log-transformed with a pseudo-count one. As feature inputs, 3000 highly variable genes were selected. The learning rate, training epoch, and regularized weight factor were set at 0.001, 1000, and 0.1, respectively.BayesSpace. BayesSpace uses a Bayesian model with a Markov random field to model spatial transcriptomics data for clustering, utilizing both spatial and gene expression information. We followed the analysis tutorial for BayesSpace in its GitHub repository and used the following parameters, nrep = 50,000 and gamma = 3, platform = “Visium” and mode = “normal”.STAGATE. STAGATE is another deep learning model-based method that combines an auto-encoder with a graph attention mechanism to learn latent representation by modeling both gene expression profiles and spatial location information. We ran STAGATE for spatial clustering and vertical and horizontal ST data integration. All experiments were implemented using the recommended parameters in the package vignette. Specifically, with raw gene expressions, the top 3000 highly variable genes were first selected and then log-transformed and normalized according to library size. The parameter ‘alpha’ was set to 0. The learning rate and training epoch were left at the default 0.0001 and 500, respectively.Harmony. Harmony is a nonspatial batch correction method. We used Harmonypy (https://github.com/slowkow/harmonypy) for batch integration of the two mouse breast cancer datasets. The dataset was first preprocessed using the standard Scanpy workflow, including log-normalization, scaling, and PCA dimension reduction. We used the PCA embeddings and sample batch information as input to Harmonypy and obtained the batch-corrected embeddings.scVI. scVI is another nonspatial batch correction method that combines stochastic optimization with deep neural networks. We employed the scVI package (version 0.19.0) for batch integration. The input dataset was preprocessed using the standard Scanpy workflow. After log-normalization, 1200 highly variable genes were selected as input for data integration. The model was set up and trained using the following default parameters: ‘n_hidden: 128, n_latent: 10, n_layers: 1, dropout_rate: 0.1, dispersion: gene, gene_likelihood: zinb, latent_distribution: normal’. The output of corrected latent embeddings was then used for downstream analysis.cell2location. cell2location employs a Bayesian model to estimate the spatial distribution of cell types in the ST data of a given tissue using single-cell or nuclei RNA-seq data as reference. We first performed the initial preprocessing of removing mitochondrial genes from the ST data. For the scRNA-seq reference dataset, we performed very permissive gene selection using the following parameters: ‘cell_count_cutoff = 5’; ‘cell_percentage_cutoff = 0.03’ and ‘nonz_mean_cutoff = 1.12’. We used these selection criteria instead of the standard highly variable gene selection to retain rare marker genes while removing most of the uninformative genes. To estimate reference cell-type signatures from the single-cell RNA-seq profiles, we used cell2location with the default negative binomial regression. We used the following parameters: ‘max_epochs = 250’; ‘batch_size = 2500’; ‘train_size=1’; ‘lr=0.002’; ‘use_gpu=True’ to train the model and export the estimated cell abundance for each cell type. In the next step, cell2location performed spatial mapping by taking the spatial dataset and estimated cell abundance for each cell type from scRNA-seq reference dataset as input to output the estimated cell abundance at all spatial locations. Here, we set the hyperparameters: ‘N_cells_per_location=30’ (number of cells per location) and ‘detection_alpha=20’ (for within-experiment variation in RNA detection) and other parameters such as: ‘max_epochs=30000’; ‘batch_size=None’; ‘train_size=1’ and ‘use_gpu=True’. The cell abundance in each spatial location was visualized in scatter plots with Scanpy’s ‘scanpy.pl.spatial’ command.RCTD. RCTD is a model-based approach that leverages cell type profiles learned from single-cell RNA-seq to decompose cell type mixtures. We followed the guidelines on the RCTD GitHub repository: https://raw.githack.com/dmcable/spacexr/master/vignettes/spatial-transcriptomics.html. The model was set up and trained using the following parameters: doublet_mode = ‘full’.SPOTlight. SPOTlight is a nonnegative matrix factorization regression model that uses a modified nonnegative least squares (NNLS) method to deconvolute ST capture locations (spots). We followed the guidelines on the SPOTlight GitHub repository: https://marcelosua.github.io/SPOTlight/. The model was set up and trained using the following parameters, transf = ‘uv’, method = ‘nsNMF’.NNLS. (AutoGeneS) NNLS is a computational method to estimate the absolute cell abundance of cell types given the reference signatures of cell types. NNLS implementation is a part of the AutoGeneS package.No statistical method was used to predetermine the 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.Further information on research design is available in the Supplementary InformationReporting SummaryPeer Review File


Chromatin-informed Inference of Transcriptional Regulators Using Self-attention mechanism (CITRUS). CITRUS models the impact of somatic alterations on transcription factors and downstream transcriptional programs. Our approach employs a self-attention mechanism to model the contextual impact of somatic alterations. Furthermore, CITRUS uses a layer of hidden nodes to explicitly represent the state of transcription factors (TFs) to learn the relationships between TFs and their target genes based on TF binding motifs in the open chromatin regions of tumor samples. We apply CITRUS to genomic, transcriptomic, and epigenomic data from 17 cancer types profiled by The Cancer Genome Atlas. CITRUS predicts patient-specific TF activities and reveals transcriptional program variations between and within tumor types. We show that CITRUS yields biological insights into delineating TFs associated with somatic alterations in individual tumors. Thus, CITRUS is a promising tool for precision oncology.Cancer is a disease of gene dysregulation, where cells acquire somatic and epigenetic alterations that drive aberrant cellular signaling. These alterations adversely impact transcriptional programs and cause profound changes in gene expression. Interpreting somatic alterations within context-specific transcriptional programs will facilitate personalized therapeutic decisions but is a monumental task. Toward this goal, we develop a partially interpretable neural network model called  The complex interplay between signaling inputs and transcriptional responses dictates important cellular functions. Dysregulation of this interplay leads to development and progression of disease, which has been most clearly delineated in the context of certain cancers. Cancer cells acquire somatic alterations that modify signaling and transcriptional programs, leading to profound changes in gene expression. We still lack a complete understanding of how somatic alterations affect cellular function in cancer. To begin to understand these effects, it is important to study somatic alterations within the specific transcriptional context in which they are found. Context- and patient-specific studies can be achieved with machine learning techniques, which are expected to facilitate personalized therapeutic decisions.In the last decade, a monumental effort has been made to molecularly profile tumors by consortia, including The Cancer Genome Atlas (TCGA) and the International Cancer Genome Consortium ,2. The mDeep learning is a powerful tool for capturing non-linear feature interactions that can explain the underlying biological phenomena. For example, attention mechanism is a deep learning method that has been widely used in computer vision and natural language processing. In contrast to traditional deep learning methods, the self-attention mechanism considers the contextual relationship of the input features and assigns attention weights to each input . In geneChromatin-informed Inference of Transcriptional Regulators Using Self-attention mechanism (CITRUS), a partially interpretable neural network model with encoder-decoder architecture. CITRUS links somatic alterations to transcriptional programs by modeling the statistical relationships between mutations, CNVs, gene expression, and TF-target gene information derived from ATAC-seq  from the Genomic Data Commons (GDC) portal   .PIK3CA gene—from the originally published Supplementary Data . We filtered TFs that were not expressed in at least 50% of samples in at least one of the seventeen tumor types. Further, similarity of predicted target peak sets was measured using the Jaccard index (size of intersection/size of union). If two TFs had a high Jaccard index (>0.5), we looked at the mean Jaccard index of each TF with all other TFs, and we removed the TF with the largest mean Jaccard index. The final set contained 320 TF binding motifs. Then, we associated each peak to its nearest gene in the human genome using the ChIPpeakAnno package  based on ATAC-seq pan-cancer dataset . Therefocis-BP  TF motifcis-BP  to find  package . ATAC-ses-BP P < 0−5. We fCITRUS is a framework for modeling impact of somatic alterations on transcriptional programs through the latent hidden status of the tumor. Figure N × M, N is the maximal number of gene mutations/copy number events of each tumor (∼1000); M is the embedding size (512). This conversion also set up the foundation for self-attention mechanism which in turn to feeds into our attention weight analyses.In the encoder module of the CITRUS model, each mutant gene is mapped into the gene embedding, and aggregated together with cancer type embedding to form the tumor embedding through weighted sum. Like ‘word embedding’ in the natural language processing (NLP) field, our gene embedding represents each distinct somatic alteration with a particular continuous number vector such that somatic alteration that share similar biological functions are located close to each other in embedding space, which is a Euclidean space. It captures the functional similarity among somatic alterations perturbing common pathways. Our pre-trained gene embedding was derived from the gene2vec method based on the co-occurrence information of somatic alterations, which utilized the skip gram word2vec algorithm based on the context-target word pairs. If two mutant genes co-exist with a third gene in similar pattern, they tend to share similar gene embeddings. In the CITRUS model, we uploaded the pre-trained gene embedding and further updated/finetuned it under the supervision of mRNA profile. From the point of the implementation, we created embedding space only for somatic alterations of each tumor, so that the sparse high dimension vector of tumor somatic alterations ( >10k) was converted into a dense 2d array with smaller dimensions Cancer type embedding acts in a similar way by converting each cancer type into a vector, then merging with gene embedding to form a personalized tumor embedding. The added cancer type information provides additional guidance for the model training in a multi-cancer type data setting and further improves the prediction performance and shortens the training time for the model to converge see the . The conm is number of mutant genes. The encoder module first maps each gene We design a self-attention mechanism which assigned importance weights to input features  through the model training. Formally, given a specific tumor The self-attention mechanism takes the gene embeddings of all mutated/altered genes as an input and outputs the attention weights where In the case of multi-head attention mechanism, we have parameters for multiple heads The attention mechanism captures the context of co-existing somatic alterations and their complex interactions, which is lost in simpler models. Interested readers can find the mathematical details of self-attention mechanisms in the cited reference .In the decoder module of CITRUS, we first infer the TF activities from the encoded tumor embedding We used tanh activation instead of ReLU operation, which is more widely used in deep learning, because it has similar performance to that of ReLU in our model and generates more biologically meaningful results , and training was performed using the Adam optimizer with default parameters except for the learning rate (15) and weight decay. We set the learning rate to We implemented CITRUS through the PyTorch package . Therefore, our hyperparameter tuning strategy combined automatic and manual tuning. First, we created empirical settings for each parameter and randomly selected a set of parameters from 100 combinations. We utilized the best-performing settings to narrow down the preliminary decisions and correlation among parameters. Then, we tuned parameters independently or in sub-groups manually or by grid search.Model robustness: The learning rate is perhaps the most important hyperparameter in neural network training. We first tested the learning rate in a range of settings , starting with the lowest setting and progressing to larger values until validation loss started to diverge. We found that if the learning rate was too small, overfitting occurred and picked up input noise. Additionally, overfitting reduced the number of driver genes that were covered in downstream attention weight analyses. If the learning rate was too big, however, the model could not converge to an optima and yielded higher validation loss. Ultimately, we selected learning rates of 10−3 and 10−4 and applied a weight penalty (weight decay) to find an optimal combination of settings. We set the weight decay range from 10−6 to 10−4 and performed a grid search. The optimal settings for learning rate and weight decay were determined to be 10−3 and 10−5, respectively. Although large batch sizes can accelerate learning rates and training, our experiments indicated that a learning rate of 10−3 was the largest value that maintained validation accuracy when tested on increasing batch sizes . We found that larger batch sizes tended to have slightly higher gene-wise correlation at the cost of longer training time. To balance execution time, we selected a batch size of 100. The early stopping patience setting is also related to the learning rate and batch size. Specifically, higher learning rates and larger batch sizes require smaller patience to stop training. Higher patience settings may otherwise cause overfitting. Using our selected learning rate and batch size settings, a patience of 30 was generally sufficient to maintain training without stopping too early (underfitting) due to fluctuation and without halting too far from the optima (overfitting). We validated a patience setting of 30 by comparing it with a case of overfitting. We selected the lowest loss point in the overfit training and measured how far it was from the model with early stopping. During early stages of training, the model showed an initial drop in validation performance followed by a rise. To avoid this inconsistency, we did not apply early stopping for the first 180 test steps. To test the attention mechanism, we created a mesh grid for two attention sizes  and four attention head settings . We then performed an exhaustive grid search within these settings. Based on prediction performance, we selected 256 and eight as the optimal values for attention size and attention head, respectively.Finally, we fine-tuned our model by adjusting the dropout rate. Because we used weight decay for regularization, dropout is considered a secondary regularization for our model. In addition to hidden layer dropout, we also applied dropout to our input to reduce input noise and network redundancy and to generate a more stable hidden TF layer. We tested a sequence of five dropout rates . All dropout rate settings yielded performances above 0.9 for average sample correlation in the testing set. We determined the dropout rate optimal value (0.2) primarily based on driver gene coverage in self-attention analyses.As we used an early stopping mechanism, we set the maximum iteration parameter to 1000. This setting ensures that the training process stops either once the patience setting is satisfied or once the maximum iterations is reached. Code testing and quick runs were performed with a maximum iteration of one.We tested two activation functions: ‘ReLU’ and ‘tanh’. Although both activation functions performed similarly, ‘tanh’ generated more biologically meaningful results and was selected. We also tested l2, minimax and standard normalization  to normalize gene expression and found that scale normalization generated the best prediction accuracy for our model settings.M tumor samples profiled using RNA-seq with N genes, we let Y∈NRxM be the log10 gene expression profiles of tumor samples. Each column of Y corresponds to an RNA-seq experiment for a cancer type. We define the TF attributes of each gene in a matrix D ∈NRxQ, where each row represents a gene, and each column represents a TF vector. The TF vector indicates whether there is a binding site for the TF on each gene based on ATAC-seq data. We define the somatic alteration attributes of tumor samples as a matrix P ∈MRxS where each row represents a tumor sample, and each column represents the somatic alteration status for the tumor sample. We set up a bilinear regression problem to learn the weight matrix W ∈QRxS on paired TF and somatic alteration features:AR is an algorithm for efficiently solving a regularized bilinear regression problem  and was We can transform the system to an equivalent system of equations by reformulating the matrix products as Kronecker products:where ⊗ is a Kronecker product, and vec is a vectorizing operator that stacks a matrix and produces a vector. The result of this system is a standard  regression problem. Full details and a derivation of the reduced optimization problem are provided elsewhere . For stain silico knock out approach that removes a specific somatic mutation (or copy number variation) g from all the tumor samples that carry it. The new somatic alteration profiles and the CITRUS-inferred TF activities generate a ‘wild type’ corpus that does not contain the alteration g. In contrast, the original samples containing the alteration g serve as the ‘mutant/altered’ group. We then conducted t-tests between the mutant and wild type groups to evaluate the impact of mutation g. This approach captures the contextual effects of mutations through the non-linear attention module of CITRUS and provides a controlled experimental environment that holds all mutations constant except for mutation g. For complex genotypes, the model explains TF activity across tumors. We then corrected for multiple hypotheses across models, treating inferred TF activities as separate groups of tests.We implemented an For each somatic mutation or copy number variation, we calculated the P-value of its frequency in a cancer subtype compared to other subtypes using Fisher's exact test. The P-value was further adjusted through FDR across subtypes. To identify the relative frequency of a somatic alteration in a subtype, we defined an association score, which is the product of the relative frequency direction and −log10FDR.P-values for multiple hypothesis testing based on two methods: Bonferroni and FDR (BH method).Statistical tests were performed with the R statistical environment (4.0.2) and Python. For population comparisons of inferred TF activities, we performed Student's t-tests and determined the direction of shifts by comparing the mean of the two populations. We corrected raw To systematically interpret somatic alterations within context-specific transcriptional programs and to identify disrupted TFs that drive tumor-specific gene expression patterns across multiple cancer types, we developed CITRUS , breast cancer , cervical squamous cell carcinoma and endocervical adenocarcinoma , colorectal adenocarcinoma , esophageal carcinoma , glioblastoma multiforme , head and neck squamous carcinoma , kidney renal cell-clear carcinoma , kidney renal papillary cell carcinoma , liver hepatocellular carcinoma , lung adenocarcinoma , lung squamous cell carcinoma , pheochromocytoma and paraganglioma , prostate cancer , stomach adenocarcinoma , thyroid carcinoma , and uterine corpus endometrial carcinoma .We applied this approach to 17 tumors from TCGA and identified key TFs associated with somatic alterations. Our dataset included samples from 17 different tumor types for which mRNA, somatic mutation and copy number variation data were available. ATAC-seq data were available for subset of patients: bladder urothelial carcinoma  between predicted and measured gene expression profiles on the testing set . CITRUS achieved significantly better performance than a regularized bilinear regression algorithm called affinity regression (AR)  that wasTP53 and PIK3CA had high attention weights. However, our self-attention mechanism assigned low attention weights to many frequently altered genes. We also observed a few infrequently altered genes with high attention weights. For example, the H3K4 methyltransferase KMT2C had a high attention weight in BRCA but was infrequently altered. Indeed, KMT2C is a key regulator of ERα activity and anti-estrogen response in breast cancer  and the frequencies of somatic alterations (used as the control group) across all cancer types and within each cancer type Figure . In genet cancer ,25.9 database. We first grouped all the genes into two parts with the threshold of 2 (log(attention + 1) ≥ 2 as the more attended group, and log(attention + 1) < 2 as the less attended group). Using Fisher's exact test, we verified that known cancer driver genes were enriched in the highly attention group (P = 4.48 × 10−41) in the pan-cancer analysis. We further examined driver enrichment using the frequently mutated genes. We found the frequently mutated genes with lower attention weight were not significantly enriched in cancer drivers  unlike frequently mutated genes with higher attention weight  Briefly, we selected the top 100 frequently mutated genes and divided them into two groups (high attention and low attention group) by several different separation thresholds (P < 0.05) while the low attention group does not (P > 0.05).We found genes with high attention weights were enriched for known cancer drivers using the IntOGenresholds . For eacWe used CITRUS to infer patient-specific TF activities across tumor types. Clustering tumors by these inferred TF activities largely recovered the distinction between major tumor types Figure . Interest-test and compared inferred TF activities between samples in each tumor type versus those in all other tumor types. We corrected for false discovery rate (FDR) across TFs and identified significant shared and cancer-specific TFs, which are listed in c-Myc gene transcription, had significantly higher inferred activity in many cancer types, including LIHC, HNSC, BLCA, ESCA, CESC, LUSC, PRAD, BRCA and UCEC. Consistent with previous reports, IRF3 activity was significantly higher in GBM .Next, we asked whether CITRUS could identify cancer subtypes based on the TF activity associated with somatic alterations. We conducted in silico knock out approach that removes a specific somatic mutation (or CNV) g from all carrier tumor samples in each TCGA cancer study and then predicts altered TF activity (see Methods). Using this approach, we were able to identify TFs whose inferred activity was significantly dysregulated by somatic alterations in known cancer driver genes. Figure PIK3CA, PTEN, KRAS, TP53 and CTNNB1 that were significantly associated with various TF activities across UCEC tumors . UCEC samples with PTEN mutations were mutually exclusive with TP53, CTNNB1, and KRAS mutations and showed distinct TF activity patterns. Mutations in PTEN that inactivate its phosphatase activity result in increased PI3K signaling. Consistent with this effect, TFs associated with PTEN mutations were involved in cell cycle and differentiation, including E2F5, TP63, ELF3, DBP, ZKSCAN3, LHX2, HOXB6, SOX9, DBP, MYLB1 and GLIS1. TFs associated with CTNNB1 mutant status were involved in WNT and TGF-beta signaling including TCF7, TCF7L2, TCF7L1, FOXH1, EMX1 and MYBL1.As our goal was to decipher cancer-specific downstream effects of targeted therapies and to discover secondary targets for combination drug strategies, we developed a systematic statistical approach for modeling the impact of somatic alterations on TF activity. We implemented an PIK3CA, PTEN, MAP2K4, GATA3, TP53 and CDH1 were significantly associated with various TF activities. In BRCA, ∼36% of tumors have PIK3CA activating mutations, ∼35% have TP53 mutations, ∼15% have GATA3 mutations, ∼15% have CDH1 mutations, ∼10% have PTEN mutations, and ∼7% have MAP2K4 mutations. Activating mutations in PIK3CA often occur in one of three hotspot locations  and promote constitutive signaling through the pathway. TFs associated with PIK3CA mutations were involved in WNT signaling, epithelial–mesenchymal transition, and cancer stem cell transition, including ELF3, TFEC, STAT4, STAT5B, NFATC1, GLIS1, CDC5L and AR. We also examined protein microarray-based AKT1 kinase assay and SILAC-based phosphoproteomic data from isogenic knock-in breast cell lines harboring mutations of PIK3CA   .PIK3CA and TP53 mutations were mutually exclusive, and our in silico knock out analysis associated distinct TFs with these mutations. TP53 mutant tumors were associated with increased activity of TFs that have roles in tumor growth, such as ETS2 and FOSB, growth modulation, such as THAP1, CREB3L1 and CEBPZ, and development, such as MEF2C/D, MEOX1 and MSX1. We performed similar analyses for other cancer types . CITRUS provides a systematic framework for integrating regulatory genomics with tumor expression and somatic alterations to better understand how expression programs are affected by somatic alterations in cancers and to infer patient-specific TF activities. Our method uses a deep learning framework called a self-attention mechanism to capture the complex contextual interactions between somatic alterations. For a more accurate representation of TF-target gene relationships, we leveraged ATAC-seq tumor data from TCGA patients. CITRUS is designed to capture the flow of information from altered genes  to TFs to target genes, and our The key advantage of the CITRUS model is that it enables the detection and representation of the functional impact of somatic alterations on transcription factors, which in turn enables detection of common mechanisms of tumors even if tumors host different somatic alteration. Further, a specific mutated gene usually contains a specific type of mutations, so in a lot of cases, the mutated gene is already very informative of the mutation types. In cases where a somatic alteration is associated with the activity of a targetable TF or their upstream/downstream component the knowledge of putative downstream positive and negative effectors can aid in the identification of combination therapies. For example, one could perform shRNA or CRISPR/Cas screening of downstream TFs to identify those whose knockdown/deletion leads to reduced/enhanced proliferation. This mechanistic information could inform the development of combination therapies, e.g. by selecting agents known to alter activity of these specific TFs.One limitation of the TF binding motif approach utilized by CITRUS is that TFs of the same family often share a similar motif and thus are difficult to disambiguate. Therefore, TF motifs may encompass the activities of multiple TFs. Moreover, co-binding TF binding patterns (e.g. AP-1−IRF complexes) can be biologically meaningful for gene expression and are not currently represented in our model. Future models will work to represent these composite elements as features. Another limitation is that we do not represent directionality in the TF–target gene priors (i.e. whether a gene is activated or repressed by a TF). Prior knowledge of whether the TF is acting as an activator or as a repressor would add meaningful interpretation to inferred TF activities. These limitations may confound the interpretation of the activity of TFs with context-specific activator and repressor roles. Further, regulatory network analysis of tumor datasets is also complicated by the presence of stromal/immune cells within the tumor and the heterogeneity of the cancer cells themselves. However, our framework can be extended to model single-cell RNA-seq or deconvoluted RNA-seq via computational methods.Despite these limitations, modeling the impact of somatic alterations on transcriptional programs may ultimately enable the development of individualized therapies, aid in understanding mechanisms of drug resistance, and allow the identification of biomarkers of response. We anticipate that computational modeling of transcriptional regulation across different tumor types will emerge as an important tool in precision oncology, aiding in the eventual goal of selecting the best therapeutic option for individual patients.https://gdc.cancer.gov/about-data/publications/ATACseq-AWG). RNA-seq gene expression, somatic mutation, copy number variation, and clinical data are available in a public repository from TCGA’s Firehose data run (https://confluence.broadinstitute.org/display/GDAC/Dashboard-Stddata). Only the samples ‘whitelisted’ by TCGA for the Pan-Cancer Analysis Working Group were used in the study. For our analysis, we only used samples with parallel RNA-seq, somatic mutation, and GISTIC copy number data. Processed input and output files have been made available at the supplementary website for the paper: https://sites.pitt.edu/∼xim33/CITRUS.ATAC-seq data are available in the public repository Genomic Data Commons (https://github.com/osmanbeyoglulab/CITRUS.The software for CITRUS is available at gkac881_Supplemental_FilesClick here for additional data file.


Liver disease carries significant healthcare burden and frequently requires a combination of blood tests, imaging, and invasive liver biopsy to diagnose. Distinguishing between inflammatory liver diseases, which may have similar clinical presentations, is particularly challenging. In this study, we implemented a machine learning pipeline for the identification of diagnostic gene expression biomarkers across several alcohol-associated and non-alcohol-associated liver diseases, using either liver tissue or blood-based samples.We collected peripheral blood mononuclear cells (PBMCs) and liver tissue samples from participants with alcohol-associated hepatitis (AH), alcohol-associated cirrhosis (AC), non-alcohol-associated fatty liver disease, chronic HCV infection, and healthy controls. We performed RNA sequencing (RNA-seq) on 137 PBMC samples and 67 liver tissue samples. Using gene expression data, we implemented a machine learning feature selection and classification pipeline to identify diagnostic biomarkers which distinguish between the liver disease groups. The liver tissue results were validated using a public independent RNA-seq dataset. The biomarkers were computationally validated for biological relevance using pathway analysis tools.Utilizing liver tissue RNA-seq data, we distinguished between AH, AC, and healthy conditions with overall accuracies of 90% in our dataset, and 82% in the independent dataset, with 33 genes. Distinguishing 4 liver conditions and healthy controls yielded 91% overall accuracy in our liver tissue dataset with 39 genes, and 75% overall accuracy in our PBMC dataset with 75 genes.Our machine learning pipeline was effective at identifying a small set of diagnostic gene biomarkers and classifying several liver diseases using RNA-seq data from liver tissue and PBMCs. The methodologies implemented and genes identified in this study may facilitate future efforts toward a liquid biopsy diagnostic for liver diseases.Distinguishing between inflammatory liver diseases without multiple tests can be challenging due to their clinically similar characteristics. To lay the groundwork for the development of a non-invasive blood-based diagnostic across a range of liver diseases, we compared samples from participants with alcohol-associated hepatitis, alcohol-associated cirrhosis, chronic hepatitis C infection, and non-alcohol-associated fatty liver disease. We used a machine learning computational approach to demonstrate that gene expression data generated from either liver tissue or blood samples can be used to discover a small set of gene biomarkers for effective diagnosis of these liver diseases.  •Diagnosis of liver diseases involves multiple tests, often including invasive liver biopsy.•Machine learning computational methods were used with gene expression data.•These methods accurately classified alcohol-associated and non-alcohol-associated liver diseases.•Promising blood-based diagnostic gene biomarkers were identified.•These methods and biomarkers could aid in the development of liquid biopsy for liver disease. Liver disease is responsible for 2 million deaths worldwide annually, ranking as one of the leading causes of death in the world.,Development of liquid biopsies using blood-based biomarkers holds great promise when used with genomic data. For example, one recent study on epigenetic universal cancer biomarkers utilized DNA methylation markers.In this study, we chose to analyze gene expression in PBMCs for a variety of reasons. PBMCs can be extracted from a blood sample, pelleted and flash frozen, and provide ample material for RNA sequencing (RNA-seq). The differences in gene expression of PBMCs have been shown to reflect disease state. Additionally, we also characterized gene expression of liver tissue. The liver tissue served as a benchmark against which PBMCs could be compared, since pathology of liver tissue is currently the standard for distinguishing between liver diseases.We were primarily interested in distinguishing between AH and AC, which may have similar clinical presentations. To establish the robustness of our models in discriminating between inflammatory liver diseases, we further sought to distinguish alcohol-associated liver diseases from non-alcohol-associated liver diseases, such as NAFLD and HCV. Therefore, we have trained ML models to differentiate between these liver diseases and healthy controls. As part of the classification process, we have also identified effective diagnostic gene biomarkers.Like most individual biomedical research studies, ours was limited to a small number of participant samples due to the high costs of recruitment, sequencing, data storage, and data analysis. The gene expression data is also inherently highly dimensional. Datasets that contain more features than samples are difficult to classify. Therefore, it was crucial in our study to use statistical and ML techniques tailored for handling small sample and large feature sizes. In addition to identifying useful PBMC-based diagnostic biomarkers of liver diseases, our secondary goal was to evaluate multiple bioinformatic pipelines in the context of analyzing small sample size RNA-seq data. Special focus was given to feature selection, wherein, we compared several different feature selection approaches. Overall, our ML pipeline demonstrated excellent classification performance across the liver diseases using both liver tissue and PBMCs.This study was primarily conducted using biospecimens collected from participants enrolled by the Southern California Alcoholic Hepatitis Consortium (SCAHC). The protocol was approved by the IRB, and informed written consent was obtained from all participants. The liver tissue from participants with AC, NAFLD, HCV, and healthy controls were obtained from the liver tissue cell distribution system (LTCDS) at University of Minnesota. Participant demographics are outlined in The biospecimens consisted of 137 PBMC samples and 67 liver tissue (LV) samples. The liver diseases represented were encoded with 2 letter symbols (as presented in the tables and figures) as follows: alcohol-associated hepatitis (AH), alcohol-associated cirrhosis (AC), NAFLD (NF), chronic HCV (HP), and healthy controls (CT). All PBMC and liver tissue samples were collected from distinct participants except for 19 participants with AH that provided both sample types. Most of the AC participants within the SCAHC study were expected to be in-patients with decompensated cirrhosis. The inclusion and exclusion criteria can be found in the supplementary materials. Best efforts were made during recruitment of the AH and non-AH groups within the SCAHC study to match based on age, sex, and ethnicity. Severity-based matching was not possible due to small sample size.RNAlater (Invitrogen) and flash frozen in liquid nitrogen. The liver tissue samples for healthy controls, AC, NALFD, and HCV conditions were obtained from University of Minnesota LTCDS.The blood samples and liver biopsies from participants with AH were collected before starting treatment. Blood samples from all other groups were collected at entry into the study. PBMCs were freshly isolated from the blood samples by Ficoll-Histopaque  gradient centrifugation, flash frozen, and then stored in a liquid nitrogen tank. The AH biopsy sample was placed in a cryovial containing Several samples were removed prior to use in our study, due to poor read quality.We divided our data into 4 datasets, which we refer to as follows: LV 2-Way, LV 3-Way, LV 5-Way, and PBMC 5-Way. LV 2-Way included liver tissue samples from participants with AH (n = 32) and healthy (n = 8) conditions. The LV 3-Way included liver tissue from participants with AH (n = 32), healthy (n = 8), and AC (n = 8) conditions. The LV 5-Way included liver tissue from participants with AH (n = 32), healthy (n = 8), AC (n = 8), NAFLD (n = 10), and HCV (n = 9) conditions. The PBMC 5-Way included PBMC samples from participants with AH (n = 38), healthy (n = 20), AC (n = 40), NAFLD (n = 20), and HCV (n = 19) conditions.We validated our liver tissue ML models using the GSE142530 dataset.For each sample and workflow within our data, standard fragments per kilobase of exon model per million reads mapped (FPKM) values were directly extracted from the corresponding alignment results (BAM files) using the Cuffquant utility of the Cufflinks suite (release 2.2.1).The classification and feature selection pipeline process flow is visualized in Regardless of the feature selection method used, once the features were selected, the classification process was similar. The classifiers were evaluated using k-fold nested cross-validation (k outer and inner = 5). The feature selection was performed inside of inner and outer loops of nested cross-validation. The classification performance was primarily evaluated using confusion matrices, overall, and per-class accuracies. The features selected in the outer loop of nested cross-validation were merged together to form the candidate gene set, if they appeared in at least 4 out of 5 training sets. The resulting candidate gene sets were then evaluated using gene enrichment analysis. A combination of feature size, overall accuracy, per-class accuracies, and gene enrichment analysis were then used to pick a best gene set for each dataset. In the case of liver tissue datasets, the best gene sets were then further evaluated in an independent validation dataset. We used Python 3.7+ for all ML analysis, and all of the classifiers were implemented in scikit-learn package. The power size calculation was performed in R.The ML analysis for all 4 of our datasets was performed and was reported in this study using logistic regression (LR), k-nearest neighbors (kNN), and support vector machine (SVM) classifiers. The corresponding hyper-parameters used during grid search can be found in the codebase.p value cut-off of 0.05 and regular expression matching. The terms used for pathways regular expression matching included names of various immune system pathways. The terms used for tissue regular expression matching included names of various cell types that comprise blood and liver tissues. The terms used for disease regular expression matching included the conditions within this study  along with a few other liver and blood disorders.The genes selected during feature selection were computationally evaluated for biological relevance using gene enrichment analysis via Enrichr with pathway, tissue, and disease Enrichr libraries.in silico biological relevance of many different gene sets, we devised a simple tallying system to count the number of hits within pathway, tissue, and disease libraries that passed the adjusted p value cut-off and regular expression matching. For each of the 4 datasets, we identified a gene set , gene set-enrichment analysis (GSEAPreranked), and blood transcription module (BTM) analysis (BloodGen3Module) tools.i.e., LV 2-Way, LV 3-Way, or LV 5-Way), using only the best genes selected for that dataset. The hyper-parameters for this classifier were selected by performing a regular cross-validation over the entirety of the corresponding liver dataset. The trained model was then tested in the independent dataset. While the PBMC 5-Way model could not be tested in an independent dataset set due to lack of appropriate public data, the methods prior to the independent dataset evaluation were the same for both liver and PBMC tissues. Therefore, we are confident that the PBMC genes identified in this study will have reasonable generalization. Additionally, the PBMC dataset had twice as many samples available for training and testing as the liver dataset, thereby also strengthening confidence in the best PBMC gene set. For additional details regarding methods, please refer to the After the best gene set was selected for each of our 3 liver tissue datasets, the independent validation dataset was utilized as follows. The ML classifier that performed best with the selected gene set was trained on the entirety of the corresponding liver dataset , complement system, and agranulocyte adhesion and diapedesis. TREM1 expression in resident and infiltrating immune system cells promotes inflammation during the course of liver disease.CXCR1 gene within the PBMC 5-Way dataset. Altered expression of CXCR1 in circulating monocytes of patients with cirrhosis has previously been established.Using the best gene signature identified in the PBMC 5-Way dataset , we examined significantly enriched pathways with IPA for each pairwise comparison. The significantly enriched pathways mainly fell into 2 categories: iron homeostasis and immune system processes. Iron homeostasis pathways included heme biosynthesis, tetrapyrrole biosynthesis, and erythropoietin signaling. Iron homeostasis is one of the principal liver functions, while most of the functional iron in the body is stored in hemoglobin within red blood cells. Large amounts of iron are recycled from senescent erythrocytes by macrophages.,,Pathway analysis of the Liver 5-Way dataset identified many pathways related to metabolism, biosynthesis, and degradation. For example, when comparing disease groups in the liver dataset  to healthy controls, some commonly and significantly enriched pathways involved degradation of bupropion, methylglyoxal, tryptophan, acetone, nicotine, and melatonin. Retinoate, retinol, and estrogen biosynthesis pathways were also highly enriched. Abnormal estrogen metabolism due to liver disease has been established previously.MMP8, PLA2G4C, and IFITM3 genes, respectively, in the PBMC 5-Way dataset. In the LV 5-Way dataset, these pathways were enriched by MMP7, PLAG2GA, and a combination of IFITM1, IFI6, and ISG15 genes, respectively. Genes in the MMP family have been established as key actors in liver regeneration and fibrosis.Both PBMC 5-Way and LV 5-Way datasets were enriched for several common immune system pathways, such as: inhibition of matrix metalloproteases (MMPs), macrophage migration inhibitory factor regulation of innate immunity, and interferon signaling pathways. As reported by IPA, these pathways were enriched by IFITM1, IFI44L), MMP , iron homeostasis , and tumor necrosis factor  genes. Notably, these findings are similar to our results when comparing the best gene sets across 5-Way PBMCs and 5-Way LV datasets. The similarities in directionality of gene expression between liver and PBMC samples lend credence to using blood-based biomarkers for AH.We further analyzed the gene expression data from the 19 participants with AH who donated both liver tissue and PBMCs. We identified several genes and gene families that were similarly up- or downregulated within both AH sample types, when compared with healthy controls . The genWhile we achieved excellent classification performance and the identification of biologically relevant gene signatures, there were several limitations to our study. Use of independent datasets is crucial in ML and biomarker discovery, however, we could not find any publicly available data on gene expression in PBMCs attained from individuals with AH or AC. Therefore, only our liver tissue dataset results could be independently validated at this time. A larger study with more samples is necessary to validate the biomarkers identified. Our classification performance could also be improved with the use of more advanced feature selection methodologies such as multi-objective genetic algorithms.In conclusion, our machine learning approach using gene expression data from PBMCs and liver tissue was effective at distinguishing among multiple liver diseases and healthy controls. Additionally, our models were able to distinguish between clinically similar alcohol-associated liver conditions, such as AH and AC. Notably, the AC group for our PBMC samples included both recently drinking and abstinent individuals with AC. AC in patients reporting recent drinking is especially difficult to distinguish from AH clinically, which further demonstrates the utility of this study. While the gene expression data from liver tissue had better classification performance than that of PBMCs, the attainment of liver biopsy is difficult and not standard of care at many healthcare facilities. PBMCs from blood samples, on the other hand, can be easily attained and stored. Based on the outcome of this study, we have demonstrated that blood-based biomarkers from gene expression can be utilized with machine learning methods for the diagnosis of liver disease, paving the way toward the clinical application of liquid biopsy.10.13039/100000027National Institute on Alcohol Abuse and Alcoholism (NIAAA) award numbers: U01AA021838 (Norden-Krichmar), U01AA021886 (Morgan), U01AA021884 (Morgan), and U01AA021857 (Liu).Funding for this study was provided to the researchers in the Southern California Alcoholic Hepatitis Consortium (SCAHC) by the Study concept and design ; enrolled participants and collection of samples ; data curation and formal analysis ; analysis and interpretation of data ; resources ; software design and implementation for bioinformatics, statistical, and machine learning analyses of the RNA-seq data (SL); software for initial preprocessing, data cleaning, and alignment pipeline (CM); validation ; supervision ; visualization (SL); writing original draft (SL); writing – review and editing .GSE142530 (https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE142530).The human RNA raw sequencing data in this study requires deposit into dbGaP with controlled access. The public RNA data used for validation in this study is available in the GEO database under accession number 10.13039/100006483AbbVie, 10.13039/100005564Gilead, Genfit, and 10.13039/100004334Merck. The remaining authors have nothing to disclose.T.R.M. has received grant/research support from Please refer to the accompanying ICMJE disclosure forms for further details.