Abstract
With the advent of multiplex fluorescence in situ hybridization (FISH) and in situ RNA sequencing technologies, spatial transcriptomics analysis is advancing rapidly. Spatial transcriptomics provides spatial location and pattern information about cells in tissue sections at single cell resolution. Cell type classification of spatially-resolved cells can also be inferred by matching the spatial transcriptomics data to reference single cell RNA-sequencing (scRNA-seq) data with cell types determined by their gene expression profiles. However, robust cell type matching of the spatial cells is challenging due to the intrinsic differences in resolution between the spatial and scRNA-seq data. In this study, we systematically evaluated six computational algorithms for cell type matching across four spatial transcriptomics experimental protocols (MERFISH, smFISH, BaristaSeq, and ExSeq) conducted on the same mouse primary visual cortex (VISp) brain region. We find that while matching results of individual algorithms vary to some degree, they also show agreement to some extent. We present two ensembl meta-analysis strategies to combine the individual matching results and share the consensus matching results in the Cytosplore Viewer (https://viewer.cytosplore.org) for interactive visualization and data exploration. The consensus matching can also guide spot-based spatial data analysis using SSAM, allowing segmentation-free cell type assignment.
Introduction
Characterizing the spatial distributions of molecularly defined cell types is a shared goal of the Human Cell Atlas, Brain Initiative Cell Census Network (BICCN), and related collaborative efforts. The core elements in this task include transcriptional classification and spatial assignment of cell types, which requires integration of single cell transcriptomics and spatially-resolved transcriptomics to define and match cell type spatially through the analysis of combinatorial gene expression patterns in tissue sections. Single cell RNA sequencing (scRNA-seq) has rapidly progressed into a high throughput standardized methodology and has been used by many labs as a major workhorse for cell type classification in many organs. In contrast, spatial transcriptomics methods are still evolving, varying substantially in methodology, degree of multiplexing, cost, and throughput, lacking consensus data standards and analysis methods.
Characterizing spatially-resolved cell types is essential in the brain in order to study the exceptional cellular heterogeneity and functional significance of its spatial organization. ScRNA-seq has revealed an unprecedented granularity of neuronal cell types in mouse and human brains [1-4], providing a comprehensive landscape of cell type heterogeneity defined by their transcriptional profiles. Recently, a number of multiplex fluorescence in situ hybridization (FISH) and in situ RNA sequencing methods [5-15] have been reported for conducting spatial transcriptomics experiments at the cellular level. Each method is optimized for marker gene panel design, tissue processing, transcript sequencing, and imaging steps of the pipeline, requiring different strategies for data processing, quality control, and downstream analysis. The SpaceTx Consortium, an organized effort consisting of both experimental and computational working groups, took the lead to evaluate the performance of currently available spatially-resolved transcriptomics methods in high quality cortical samples, with the goal of building consensus maps of cortical cell type distributions based on combined analysis of single cell and spatially-resolved transcriptomics. The overarching effort of the SpaceTx Consortium is summarized in [16].
One aim of the SpaceTx Consortium was to make probabilistic assignments of cell types and map their spatial distributions. Here we describe the quantitative meta-analysis of spatial transcriptomics data with a focus on assigning spatial cell types using the reference cell types from scRNA-seq. This is the first-time spatial transcriptomics data has been analyzed and compared across spatial and computational methods for cell type determination on the same tissue. Here we present the results of these analysis efforts along with strategies for visualization of spatial transcriptomics data. Four available datasets from the SpaceTx Consortium and up to six computational methods are systematically evaluated in the following sections. Available datasets and reproducible work covered in this manuscript are publicly available at the SpaceTx website (https://spacetx-website.github.io/index.html).
Results
Analysis overview
We explored multiple approaches to assign the spatial data with reference scRNA-seq cell types, and developed meta-analysis strategies to combine the cell type assignment results from multiple methods to reach consensus assignments (Figure 1). We evaluated datasets from four image-based spatial methods (MERFISH [17, 18], smFISH [5, 19], BaristaSeq [20, 21], and ExSeq [15, 22]) in the mouse primary visual cortex brain region (VISp) [1]. All image data (spot-by-gene matrices) were segmented using the same segmentation procedure – Baysor [23], which also included consistent quality control approaches for doublets and low-quality cell removal. The segmentation step produced the cell-by-gene matrices that were used to assign the spatially-resolved cell types to scRNA-seq reference cell types using cell type matching algorithms. Teams of the SpaceTx Consortium explored six computational algorithms (map.cells* [1], mfishtools [24], fitness landscape model (FLM) [25], FR-Match [26, 27], Tangram [28], and pciSeq [29]), which produced individual cell type assignments with various probabilistic assignment scores. To arrive at consensus cell type assignments, two meta-analysis strategies were developed to combine the individual assignments more qualitatively (Negative Weighting Combining Strategy, hereinafter NWCS), or more quantitatively (Geometric Mean Combining Strategy, hereinafter GMCS) (Methods). In parallel, spot-based cell type assignment was performed by SSAM {Park, 2021 #441 using a guided mode, which partially borrows information from the combined assignment results. All spatial data and cell type assignment results were loaded into the Cytosplore Viewer (https://viewer.cytosplore.org) for interactive visualization and data exploration, where an integrated tSNE {Van der Maaten, 2008 #415} map for all annotated cells in all spatial methods are presented together with single method viewers for comparative analysis.
Spot-based cell type assignment was conducted using SSAM. All data and matching results can be viewed in Cytosplore Viewer (https://viewer.cytosplore.org).
Reference cell types
The goal of this study is to produce an initial cell type matching of the spatially-resolved transcriptomics data to open access reference scRNA-seq cell type datasets (a.k.a. scRNA-seq-reference-based cell type assignment of spatial transcriptomics data). The reference mouse visual cortex (VISp) scRNA-seq data were reported in [1], consisting of 14,249 cells with initial 116 cell types defined for VISp. With a focus on spatial gradients, the SpaceTx Consortium re-clustered the data to arrive at a reference cell type taxonomy that contains 191 consensus higher-resolution cell types at the most granular level and 24 cell type subclasses at the intermediate level [16]. With fewer cells per study and fewer reads per cell, the granularity of spatial data collected in this project is not comparable to these most granular scRNA-seq cell types. Therefore, in this study we assigned the spatial data to the cell type subclasses in the reference cell type taxonomy, which distinguishes major GABAergic, glutamatergic, and glial cell types with layer-specific laminar patterning (full list of reference cell type subclases in Figure 1).
Experimental protocols
As part of the SpaceTx Consortium, tissue sections were successfully collected from mouse VISp and evaluated using MERFISH [17, 18], smFISH [5, 19], BaristaSeq [20, 21], and ExSeq [15, 22] imaging-based experimental protocols. In general, the imaging-based protocols use multi-well plates to stain cells in parallel, and project transcript abundance on microscope images. The spatial methods employ the fluorescent in situ hybridization (FISH) technique to localize the transcript sequences. Since each spatial method has unique requirements for numbers of genes and expression levels, each experimental protocol assembles different probe panels with specific gene sets in their design (Supplementary Table S1). The primary output from the imaging-based protocols is a spot-by-gene matrix, quantifying the gene expression intensities in the pixel arrangement of the image.
Segmentation and quality control
The segmentation step produces a cell-by-gene expression matrix from the image data (spot-by-gene matrix) for downstream analysis. For this purpose, the Baysor algorithm was used because it has been reported to outperform other segmentation tools in terms of yielding better segmentation accuracy, increased number of detected cells, and improved molecular resolution by considering joint likelihood of transcriptional composition and cell morphology [23]. Baysor was applied to perform cell segmentation across all imaging-based protocols to achieve consistent quantification from different protocols. Low quality cells were filtered based on the Baysor cell segmentation statistics, e.g. number of transcripts per cell, elongation characteristics, cell area values, and average confidence scores of segmentation. Cells not passing the quality control filter and cells located outside of VISp based on expert annotation were excluded from further analysis. The final segmented and filtered data (Table 1) were used as the input datasets for downstream cell type assignment analysis.
Comparison of gene properties across experimental protocols
The spatial methods use different reagents, tissue processing steps, barcoding approaches, and amplification methods, resulting in a very different number of genes included in each experiment and different requirements for which genes can be successfully probed (Table 1). With these constraints in mind, gene sets were selected to overlap across experiments to the extent possible to allow comparison between studies. We found that while smFISH and ExSeq had relatively fewer genes per experiment (Table 1), the average number of transcript molecules detected per cell tended to be higher than for MERFISH or BaristaSeq (Figure 2A), even when considering only common genes among experiments (Figure 2B).
Glutamatergic (and to a lesser extent GABAergic) neurons show strong laminar patterning in mouse VISp, and many genes have been well described as showing layer restriction [30], providing a useful ground truth for assessing the accuracy of a subset of genes in each experiment. For all experimental protocols, at least one gene marking L2/3 (Cux2, Lamp5, Cxcl14), L4 (Rorb, Rspo1), L5 (Fezf2, Parm1), and L6 (Sema3e, Foxp2, Syt6) in mouse VISp were assayed; in all cases these genes showed maximal expression at the expected cortical depth (Figure 2C). Additional computationally-derived genes included in the assays showed layer restriction in MERFISH, and to a lesser extent the other experimental protocols (Figure 2D). Together, these results suggest that sufficient information exist from the included gene panels to assign segmented cells to reference cell types at some level of resolution.
Cell-based cell type assignment
Six cell type matching algorithms (map.cells* [1], mfishtools [24], fitness landscape model (FLM) [25], FR-Match [26, 27], Tangram [28], and pciSeq [29]) were applied to assign reference scRNA-seq cell types to each segmented cell with an associated confidence score (a.k.a. probabilistic assignment) based on the cell-by-gene count matrix (Method) produced for the MERFISH data. Applying the cell type matching algorithms produces a cell-by-type matching matrix as a primary output, consisting of probabilistic assignment of each segmented cell to each of the reference cell types. For this study, reference cell type subclasses were matched due to the granularity of spatial data limited by the number of marker genes evaluated.
These cell type assignment methods each have different advantages and experimental biases, and often produce different cell type calls, especially in cells with fewer total transcripts or less confidence segmentation boundaries. To address this, we designed and implemented two combining strategies, each producing a re-calculated confidence score matrix for determining the consensus cell type assignment. The NWCS combined matching is a weighted average of the confidence scores from each individual matching method using only the highest score for each cell (Methods). The GMCS combined matching considers each individual matching result as the vertex of a polygon whose geometric median, the point with minimum average Euclidean distance from these vertices, serves as the combined result (Methods).
For all matching results, deterministic cell type assignment is defined as the cell type with the highest confidence score within a given cell. In the results shown below, matching results of individual algorithms are referred to as “Individual Matching #1-6” and the consensus matching results as “Combined Matching #1-2”. Name key is in figure legend (Figure 3).
Individual matchings
In the following two sections, we look at the MERFISH data to elaborate the details of the cell type matching challenge. A key challenge for the deterministic assignment of cell types was the extensive differences observed among the individual matching results without the availability of a gold standard result to compare against. Confidence scores are defined differently in each matching method and showed very different distributional properties (Figure 3A). Even though all confidence scores are in the range of [0,1], these scores are not directly comparable across individual matching results because they are very different metrics, for example, correlation or bootstrap probability or p-value, with different distributional properties between the different algorithms. As such, the ranks (i.e., ordered statistics) of the scores are pragmatically more useful, with deterministic cell type assignment using the top-ranked confidence score. The deterministic cell type assignment for the L2/3 IT subclass, for example, further revealed the difference in the number of matched cells (Figure 3B) and the spatial distribution of the cells matched to the same subclass in individual matching results (Figure 3C). The differences among individual matching results were also reflected in the substantial amount of disagreements of cells matched to the same subclass (Figure 3D).
Individual Matching #2 gives the smallest number of cells matched to the L2/3 IT subclass, but most of its matched cells are common cells found in all other matchings, which may suggest that the method for Individual Matching #2 has high precision (a.k.a. positive predictive value) for this subclass though its detection rate is low. Similarly, Individual Matching #1 has the second smallest number of cells matched with high precision. We may regard the non-common cells in the venn diagram (Figure 3D) as the cells that have weaker signal and more noise in their combinatorial marker gene expression pattern; these noisy cells appear to form the major source of the observed spillover effect of Individual Matchings #3-6 in their layer distributions (Figure 3C), as Individual Matchings #1-2 are very layer-specific.
That being said, we are not able to conclude that Individual Matchings #1-2 are better than the others, as all cells are assigned a subclass in each matching and the noisy cells might be accidentally assigned to other subclasses with Individual Matchings #1-2 but not the one in this example. Spatial coordinate plots with confidence score intensities for each individual matching are available in Supplementary Figures S1-S6.
Combined matchings
Assuming that the majority of individual methods would produce some level of accurate cell type matching/assignment, combining their results using an ensemble approach may provide the best classification result. We used two different strategies to combine all individual matching results in the ensemble meta-analysis - NWCS and GMCS. Using the L2/3 IT subclass as an example, the combined matchings are more stable in the number of cells matched to the subclass (Figure 3B) and more consistent in the spatial distribution of the matched cells (Figure 3C). Between the two combined matchings, the vast majority of the cells matched to the same subclass (Figure 3E), indicating strong agreement between the two combined matchings. The Combined Matching #1 and #2 assigned 31% and 37% of all MERFISH cells to the L2/3 IT subclass, respectively, though there is still some spillover of the matched cells in the layer distribution. Considering all cells, the two combined matchings produced highly consistent cell type assignment overcoming the large differences among individual matching results, which resulted in 83% (= number of cells assigned the same subclass / total number of cells) of cells being assigned to the same subclass. The combined confidence score intensity matching plots for all cells are available in Supplementary Figures S7-S8; and distribution of all cells in cortical layers by each combined matching are in Supplementary Figure S9. Though the distributions of matched cells in cortical layers are very similar for the abundant GABAergic and glutamatergic subclasses between the two combined matchings (Supplementary Figure S9), they differ in rare and non-neuronal subclasses (e.g., Meis2, Endothelial, and Macrophage), suggesting the increased difficulty for detecting and matching rare cell types in spatial transcriptomics. Overall, these results suggest that, while individual matching algorithms may have different strengths and biases leading to somewhat different results, combined methods via the meta-analysis ensembling approach provide a more robust cell type calling for the spatial cells.
Spot-based cell type assignment
Working directly on the spot-by-gene matrices, the SSAM [31] framework was used to perform and visualize segmentation-free spatial cell type assignments. Unlike the cell segmentation-based cell type matching/assignment methods, SSAM performs pixel-wise cell assignment which does not require prior cell segmentation, thus independent from the accuracy of cell segmentation. Here, SSAM guided-mode was demonstrated to create cell type assignments, which were guided by the mean log-normalized gene expression of the combined cell type matching results (NWCS and GMCS) (Supplementary Figures S10-S17). In general, the resulting SSAM cell type assignments and the segmented cells with cell type assignments from combined matching results showed visual similarity in both meta-analysis combining strategies for all spatial experimental methods (Figure 4). One exception was the GMCS-based cell type assignment of BaristaSeq. This was due to the low quality of the consensus matching; both the segmentation and the SSAM results did not match the previously known layer structure of the visual cortex.
However, detailed comparison revealed that some cell types were mapped to some area that was not identified as segments in the cell-based approach, especially the VLMC subclass in the multiplexed smFISH dataset (Figure 4). The marker gene of the VLMC subclass showed a more similar gene expression pattern as SSAM identified, which strongly assumes the existence of cells in the region. This observation demonstrates that SSAM could be used as a complementary method to quickly visualize spatial cell types which were possibly missed by prior cell segmentation. Indeed, these results could be used to improve segmentation algorithms. Also, due to the lower density of mRNAs captured by BaristaSeq compared to other FISH methods, the SSAM cell type assignment of BaristaSeq was noisy. Overall, the SSAM analysis shows that a spot-based approach, such as SSAM, is equally capable of revealing good-quality segmentation-free cell type assignment for spatial transcriptomics pixel data, especially using the guided mode analysis when precise gene signatures are given.
Another major difference was that SSAM introduced a spatial pattern of CR subclass in NWCS-guided smFISH data (bright green cells pointed by an arrow in Figure 4). This pattern was derived from one CR cell in the NWCS matching, which is actually not CR cell type but more likely to be a new Layer 4 IT cell type (or cell state) which was reported previously [31], this possibly confused the matching algorithms to match the cell type differently. Although there was only one cell having the CR cell type in the lower layer 4, SSAM successfully assigned the cells having similar gene expression patterns in the cell type assignments. In the case of GMCS, since the consensus matching does not discriminate any cells in layer 4, all cells were then matched to layer 4 which is the closest one.
Cytosplore Viewer for comparative visualization of spatial protocols
ScRNA-seq based gene imputation for data visualization
To compare the different spatial transcriptomics protocols, a combined embedding was generated. A major challenge is that each protocol measures a different set of genes, and the number of shared genes is very small. The four protocols (MERFISH, smFISH, BaristaSeq, and ExSeq) share only six common genes, while the number of genes measured per dataset varies from 22 to 253 genes, where the union of these measured genes contains a set of 314 union genes (Supplementary Table S1). To solve this, we applied SpaGE [32] to impute the expression of the missing genes in each dataset separately and obtain a total of 314 genes per dataset. For each spatial dataset, SpaGE integrates the spatial data with a reference scRNA-seq data measured from the same tissue, and provides prediction for the expression of the missing genes. For example, the MERFISH dataset has 253 measured genes, SpaGE was applied to impute the expression of the 61 remaining genes. Additionally, to reduce batch effects in the joint multi-protocol embedding, we used SpaGE to re-impute the expression of the measured genes in each spatial dataset separately, using a leave-one-gene-out scheme. Taking the MERFISH dataset as an example, SpaGE uses 252 genes for integration with the reference scRNA-seq dataset and provides predicted expression, for the left-out gene, imputed from the scRNA-seq data. This process is applied for all measured genes in each spatial datasets to ensure that all spatial datasets are aligned to the reference scRNA-seq data, and that the expression of all genes is obtained from the same (scRNA-seq) domain. Finally, we generated a combined tSNE embedding for all four spatial datasets using the imputed expression matrix of all 314 genes.
Comparative visualization between protocols
For comparative visualization of the different spatial protocols, Cytosplore Viewer (https://viewer.cytosplore.org) was extended with functionality for side-by-side visualization of multiple spatial data sets, in combination with the consensus clustering described above. A comparative view was developed that enables interactive selection from the consensus clustering hierarchy (Figure 5A), or from the joint tSNE embedding combining cells from all spatial protocols. Also, either the measured and imputed expression values can be painted on the spatial and tSNE maps enabling comparison of spatial expression patterns across spatial protocols. Finally, functionality for differential expression (DE) analysis between two manual selections (drawn either in the spatial maps or the tSNE maps) was implemented, enabling quick retrieval of differentially expressed genes between regions or cell types. Comparing cell selections within one protocol returns DE of the measured genes for that protocol. Manual selection of cells in the combined tSNE map returns DE of the imputed gene sets.
Single protocol and SSAM visualization
Apart from the comparative visualization, functionality for visualizing individual protocols was developed, consisting of a linked spatial and tSNE map (Figure 5B). The tSNE maps were computed on the measured cell-by-gene expression matrices of the individual spatial datasets. Since SSAM omits the step of direct cell segmentation, estimating local correlation between SSAM Kernel Density Estimate profiles and the cluster prototypes, direct comparison between cell-segmented and estimated local correlation maxima was not possible. As such, the individual SSAM local maxima-by-gene matrices were included in the single protocol visualizations.
Discussion
This manuscript focused on the meta-analysis of cell type matching between spatial transcriptomics data and scRNA-seq reference cell types. The spatial transcriptomics methods are fast evolving, which requires up-to-speed development of data analysis pipelines. Significant emphasis has been devoted to computational algorithms focused on the segmentation step of the imaging-based spatial transcriptomics analysis pipeline [9, 19, 23, 33, 34]; however, limited focus has been on investigating the performance of spatial cell type matching in downstream analyses. This work is the first-time evaluation of scRNA-seq-reference-based cell type matching performance across spatial transcriptomics experimental methods and cell type matching computational methods on the same tissue section.
We first compared gene detection sensitivity and gene expression patterning across spatial experimental methods, which revealed high variability and very different dynamic range in the in situ hybridization data across different experimental protocols. We also presented a systematic evaluation of the individual cell type matching algorithms and the combined matching strategies using the MERFISH dataset as an example. The cell-based cell type matching algorithms were applied following the same segmentation step on the image data. Individual matching results varied largely in their metrics of matching confidence as well as their deterministic cell type assignments, among which no overall “winner” could be claimed. Given the variable performance of individual matching results, we used ensemble meta-analysis approaches to combine these individual matchings to form consensus results. The meta-analysis approaches largely improved the agreement between the consensus matchings, where the majority of the cells have the same cell type assignment by the two combined matching strategies. Using the spot-based cell type matching algorithm, similar results as the consensus results could be efficiently obtained without explicit segmentation, given precise gene signatures are available.
A Cytosplore Viewer compilation allows all spatial cells from all evaluated experimental protocols to be viewed in an integrated tSNE map based on the SpaGE-imputed expression scores from scRNA-seq reference data. This enables interactive selection of cells (either through free-form selection or per cell type subclasses), confirming the consistency of the layer patterns across spatial protocols. Differential analysis between free-form cell selections proved particularly useful for identifying gene expression gradients across cortical layers and confirming them across protocols. A side-by-side comparison between the segmentation-based workflow and SSAM revealed a larger density of local maxima detected by SSAM compared to the segmentation-based analysis, however the spatial patterning of cell type subclasses was highly conserved between both methods. Finally, a direct comparison between both combining strategies revealed similar cell type matching results for smFISH, MERFISH and ExSeq. For BaristaSeq, the combined matching by GMCS resulted in inconclusive results, whereas the NWCS matching still performed reasonably well.
The spatial transcriptomics community is growing rapidly with advancements in both experimental and computational methods. For downstream cell type analysis, challenges and opportunities co-exist as well-benchmarked analysis pipelines are lacking. A major goal of the future work would be to promote standardization in data formats and computational methods, including methods for marker selection, probe design, cell segmentation, cell nuclei and boundary delineation, cell type matching, spatial pattern recognition, etc. It will need the community to provide public access to large, high-quality, uniformly collected datasets from all current spatial transcriptomics methods, in common standard file formats, to accelerate innovation in the computational analysis of such data.
Methods
Cell-based cell type matching algorithms
We evaluated six computational cell type matching algorithms, namely map.cells* [1], mfishtools [24], fitness landscape model (FLM) [25], FR-Match [26, 27], Tangram [28], and pciSeq [29].
The map.cells* algorithm uses a derivative from the map.cells function in “scratch.hicat” R package [1] (https://github.com/AllenInstitute/scrattch.hicat) that was altered to make it more suitable for smaller gene panels. It is a bootstrap-based method that uses Pearson correlation to assess the similarities between cells and cell type clusters.
The mfishtools algorithm [24] (https://github.com/AllenInstitute/mfishtools) also uses Pearson correlation to match cells from spatial transcriptomics method to cell type cluster medians in a scRNA-seq reference dataset. This algorithm first applies filtering and scaling strategies to the mFISH and scRNA-seq datasets, and then uses correlation-based assessment to find the best fitting cell type cluster. There are several parameters allowing flexibility in filtering and analysis. Probabilities for cell type assignment were approximated using the following:
scaledCorrelation = pmax(y-(max(y)/2),0)^2 probability = scaledCorrelation/sum(scaledCorrelation)where y is the vector of correlations between a given spatial transcriptomics cell and the median expression of each scRNA-seq cell type cluster. Finally, several functions for visualization of matching results and assessment of matching accuracy are included in the mfishtools R package and were applied in this study. A vignette for application of this method is available as part of the “mfishtools” R library.
The FR-Match algorithm [27] (https://github.com/JCVenterInstitute/FRmatch) requires an initial de novo clustering of the spatial transcriptomics data, which provides a supervised mode for the algorithm. Both the candidate spatial cell clusters and the scRNA-seq reference cell types were input to the algorithm, and the best-matched reference cell types for each spatial cell were obtained using the cell-to-cluster function (FRmatch_cell2cluster) implemented in the “FR-Match” R package [26].
Probabilistic Cell typing by In situ Sequencing (pciSeq) [29] (https://github.com/acycliq/pciSeq) is a Python package for probabilistic cell typing by in situ sequencing. It uses a Bayesian algorithm, leveraging scRNA-seq data to first estimate the probability of each spot belonging to a cell and then each cell to a scRNA-seq cluster. Spots dataframe, segmentation image labels, and scRNA-seq data are required inputs to the algorithm.
Combining strategies for consensus matching
Negative Weighting Combining Strategy (NWCS)
A weighting approach was designed to combine the six individual cell type matching results. An evaluation of the individual matching results revealed that: 1) The probabilistic assignments (a.k.a. confidence scores) that reflect the confidence of matching for each spatial cell to each reference cell type showed very different distributions from method to method; some were more binary as either 0 or 1 and others showed more plateau distributions (Results). 2) Despite the distributional difference, some cells were assigned to the same cell type with the highest confidence score by all of the methods (i.e., well-matched cells), whereas other cells were only matched to a cell type with a high score by only one method (i.e., poorly-matched cells). In order to avoid the bias introduced by the accidental assignment of those poorly-matched cells, we designed a negative weighting scheme to borrow the best-matched confidence score among all methods. NWCS performs the following steps to combine the individual matching results: 1) Find the best-matched cell types of each cell by keeping the cell-wise highest confidence score. 2) Assign a negative weight (−1) to all other cell types for each cell. 3) The combined confidence score matrix is the sum of all negatively weighted confidence score matrices of each individual method. 4) The NWCS cell type deterministic assignment is the cell type with the maximum confidence score for each cell in the combined matrix.
Geometric Median Combining Strategy (GMCS)
Given the above combining strategy weighing certain matchings over others, we also introduce an independently-developed combining strategy using a geometric median approach that considers each matching equally. Given m matchings, each matching c cells to a probability distribution over n potential cell types, we create a m-gon (polygon with m vertices) with vertices in the n-dimensional space (Rn). For each of these polygons, we then find the geometric median, i.e., the point p ∈ Rn at which the sum of the L2 norms from p to each vertex in the polygon is minimized. Intuitively, such a point considers each of the individual matchings equally, as having a point p closer to one individual matching’s vertex than another would not minimize the sum of the L2 norms. The confidence with which this matching assigns cell types is consequently a function of how similar or disparate constituent matchings are. Accordingly, certain data modalities for which the individual matching results largely disagree with one another, e.g., BaristaSeq, resulted in not-as-well-classified cells, whereas data modalities in which each cell’s corresponding polygon is of relatively small area, e.g., MERFISH, yielded very well-defined consensus matching (Results).
Spot-based cell type analysis method
SSAM (Spot-based Spatial cell-type Analysis by Multidimensional mRNA density estimation) [19] analysis is a method that uses the guided mode to generate segmentation-free cell type assignments of the NWCS and GMCS consensus cell types. For all datasets (MERFISH, smFISH, BaristaSeq, and ExSeq), the kernel density estimation (KDE) was performed with the location of mRNAs of each gene with the bandwidth 2.5μm. The resulting vector field was normalized by a library size of 10, and then log-transformed. The mRNA count of each cell type cluster was normalized to a library size of 10 per cell, and then log-transformed. The gene expression signature of each consensus cell type was computed by taking the mean of all normalized cells in the same cluster. The resulting signatures were then mapped to the vector field, by computing Pearson’s correlations between each consensus signature to all pixels in the vector field. The resulting cell types were filtered with the minimum correlation threshold 0.6.