dataesr/scientific-paragraphs-categorization huggingface dataset:
In our experiments, we ran 100 replicates of kBET with 1,000 random samples, and used the median of average acceptance rates as the output. The neighbourhood size was chosen following the default setting in kBET's official code. PCR batch. PCR batch quantifies the removal of batch effects by comparing the variance contributions of the batch effects to datasets before integration (V C before ) and after integration (V C after ), respectively. In our experiments, we concatenated datasets by batches to obtain the dataset before integration. PCR batch score was calculated as V C before -V C after V C before. We clamped PCR batch score to [0, 1], where a higher score means that the impact of batch effects is eliminated after integration. Batch ASW. Batch ASW calculates the silhouette width of cells with respect to batch labels.
If batch effects are corrected in cell embeddings, the evaluated ASW (with respect to batches) should be close to -1, indicating the good mixing of cells across batches. We rescaled the score Isolated label F1. Isolated label F1 is developed to measure the ability of integration methods to preserve dataset-specific cell types. We adopted the Seurat pipeline to cluster cells in the integrated dataset, and evaluated the cluster assignment of dataset-specific cell types based on the F1 score  [79]. Isolated label F1 ranges between 0 and 1, where 1 shows that all cells of dataset-specific cell types are captured in seperate clusters. Isolated label silhouette. Isolated label silhouette, which is similar to Isolated label F1, also measures the conservation of dataset-specific cell types. Instead of using the F1 score, it evaluates ASW of dataset-specific cell types.
For example, the preprocessing of Portal took 63. 4 minutes, requiring 22. 0 GB peak running memory on the two mouse brain atlases datasets with 1,100,167 cells. The preprocessing time could be reduced to 37. 7 minutes when the chunk size was increased to 200,000, with 36. 4 GB peak running memory. Some other methods may not be able to adopt a mini-batch implementation. For the two mouse brain atlases datasets, Harmony took 17. 6 minutes to finish preprocessing, but required 127. 1 GB memory usage. Online iNMF performed preprocessing with mini-batches. Its default preprocessing procedure on the two mouse brain atlases datasets took 15. 9 hours, with 0. 6 GB memory usage. For a fair comparison, the time and memory usages of data preprocessing procedures were not included in our benchmarking.
Integration of multiple datasets. For multiple datasets, Portal integrates them in an incremental manner, by transferring all other datasets into the domain constructed by the first dataset. Here we used the integration of two scRNA-seq datasets (profiled by Drop-seq and 10X)  [8, 9]  and one snRNA-seq dataset (profiled by SPLiT-seq)  [49]  to illustrate this procedure. In this example, Portal ran in two steps: Step 1. Portal trained domain translation networks between the 10X dataset (160,678 cells) and the Drop-seq dataset (319,359 cells), which took 45. 48s. Then Portal used the trained networks to map 10X cells to the Drop-seq dataset domain, which took 0. 08s. Step 2. Portal trained domain translation networks between the SPLiT-seq dataset (74,159 cells) and the integrated 10X and Drop-seq dataset, which took 41.
36s. Then Portal mapped SPLiT-seq cells to the integrated 10X and Drop-seq dataset domain, which took 0. 06s. • Mouse spermatogenesis cells from Ernst et al. [59]  (https://www. ebi. ac. uk/arrayexpress/ experiments/E-MTAB-6946/). • Human spermatogenesis cells from Shami et al. [16]  (GSE142585). • Macaque spermatogenesis cells from Shami et al. [16]  (GSE142585). • Hematopoietic stem cells from Paul et al. [82]  (GSE72857). • Hematopoietic stem cells from Nestorowa et al. [83]  (GSE81682). • Reprogramming of induced pluripotent stem cells from Schiebinger et al. [84]  (GSE122662). • Human brain cells from Fullard et al. [51]  (GSE164485). • Human brain cells from Tran et al. [52]  (https://github. com/LieberInstitute/ 10xPilot_snRNAseq-human#work-with-the-data).
We solve the above optimization problem via alternating updates by stochastic gradient descent. The algorithm is extremely computationally efficient with the support of stochastic optimization accelerated by GPUs. After the training process, Portal learns a harmonized representation of different domains in shared latent space Z. Samples from X and Y can be transferred into latent space Z to form an integrated dataset {E 1 (x)} x∈X ∪ {E 2 (y)} y∈Y using encoders E 1 (•) and E 2 (•), facilitating the downstream integrative analysis of cross-domain single-cell datasets.
Figure5: Comparison of Portal and other cross-omics integration methods on the alignment of scRNA-seq and scATAC-seq data. We applied Portal, scJoint, Seurat, online iNMF, and VIPCCA to align the scRNA-seq dataset (profiled by CITE-seq) and the scATACseq dataset (profiled by ASAP-seq) of peripheral blood mononuclear cells (PBMCs) [54]. UMAP plots were colored by profiling methods and cell types, respectively.
Expression measurements of cells from two different studies are viewed as datasets originated from two different domains X and Y. After standard data preprocessing of the expression data, Portal performs joint principle component analysis (PCA) across datasets and adopts the first p principal components of cells as the low-dimensional representation of cells, namely, cell embeddings. Portal takes the cell embeddings as the input to achieve data alignment between X and Y. To learn a harmonized representation of cells, Portal introduces a q-dimensional latent space Z to connect X and Y, where the latent codes of cells in Z are not affected by domain-specific effects but capture biological variation. Portal achieves the integration of datasets through training a unified framework of adversarial domain translation.
ASW(batch)   Graph iLISI. The original iLISI is defined as the effective number of datasets in a neighborhood, where 1 means poor mixing, and 2 indicates good mixing of two datasets. Graph iLISI extends iLISI by enabling the calculation on graphs. The values were rescaled to [0, 1] by subtracting Graph connectivity. Graph connectivity assesses whether the graph correctly connects cells of same cell type labels among batches. We used the Scanpy pipeline to derive graph representation of integrated cell embeddings. The neighborhood size was set to be 15 (default setting in Scanpy). ARI. ARI measures the degree to which the two clustering results match. It ranges from 0 to 1, where 0 indicates that the two clustering labels are independent to each other, and 1 means that the two clustering labels are the same up to a permutation.
Acknowledgements The authors would like to thank  Camille Sophie Ezran  ( Stanford University ),  Dr. Angela Oliveira Pisco  ( CZ Biohub ), and  Dr. Hosu Sin  ( Stanford University ) for valuable discussions. This work is supported in part by  Hong Kong Research Grant Council  [ 16101118 ,  24301419 ,  14301120 ,  16307818 ,  16301419 ,  16308120 ], the  Hong Kong University of Science and Technology 's startup grant [ R9405 , R9364 ], the  Hong Kong University of Science and Technology Big Data for Bio Intelligence Laboratory (BDBI) , the  Lo Ka Chung Foundation  through the  Hong Kong Epigenomics Project , the  Chau Hoi Shuen Foundation , the  Chinese University of Hong Kong.
In total, Portal took 86. 98s to integrate all three datasets. The integration of multiple datasets is implemented in one function in Portal package. The code for reproducing the experiment is available as a Jupyter Notebook at https://github. com/YangLabHKUST/Portal, serving as an example for the integration of multiple datasets. Visualization. We used the UMAP algorithm  [39]  for visualization of cell representations in a two-dimensional space. In all analyses, the UMAP algorithm was run with 30-nearest neighbors, minimum distance 0. 3, and correlation metric.
• Mouse brain cells from Rosenberg et al. [49] (GSE110823). • Mouse cell atlas from the Tabula Muris Consortium  [7]  (https://figshare. com/projects/ Tabula_Muris_Transcriptomic_characterization_of_20_organs_and_tissues_from_ Mus_musculus_at_single_cell_resolution/27733). • Mouse lemur cell atlas from Tabula Microcebus Consortium (https://figshare. com/ projects/Tabula_Microcebus/112227). • Human peripheral blood mononuclear cells from Mimitou et al. [54]  (GSE156478). • Human peripheral blood mononuclear cells from Ding et al. [81]  (GSE132044). • Human peripheral blood mononuclear cells from 10X Genomics. [81]  (https://support. 10xgenomics. com/single-cell-gene-expression/datasets/1. 1. 0/pbmc3k).
by 1 - 2. 1. 2. 1212 ASW(batch)   Graph iLISI. The original iLISI is defined as the effective number of datasets in a neighborhood, where 1 means poor mixing, and 2 indicates good mixing of two datasets. Graph iLISI extends iLISI by enabling the calculation on graphs. The values were rescaled to [0, 1] by subtracting Graph connectivity. Graph connectivity assesses whether the graph correctly connects cells of same cell type labels among batches. We used the Scanpy pipeline to derive graph representation of integrated cell embeddings. The neighborhood size was set to be 15 (default setting in Scanpy). ARI. ARI measures the degree to which the two clustering results match. It ranges from 0 to 1, where 0 indicates that the two clustering labels are independent to each other, and 1 means that the two clustering labels are the same up to a permutation.
The rapidly developing spatial omics generated datasets with diverse scales and modalities. However, most existing methods focus on modeling dynamics of single cells while ignore microenvironments (MEs). Here we present SOTIP (Spatial Omics mulTIPle-task analysis), a versatile method incorporating MEs and their interrelationships into a unified graph. Based on this graph, spatial heterogeneity quantification, spatial domain identification, differential microenvironment analysis, and other downstream tasks can be performed. We validate each module's accuracy, robustness, scalability and interpretability on various spatial omics datasets. In two independent mouse cerebral cortex spatial transcriptomics datasets, we reveal a gradient spatial heterogeneity pattern strongly correlated with the cortical depth.
In human triplenegative breast cancer spatial proteomics datasets, we identify molecular polarizations and MEs associated with different patient survivals. Overall, by modeling biologically explainable MEs, SOTIP outperforms state-of-art methods and provides some perspectives for spatial omics data exploration and interpretation. Tissue and cell state are jointly modulated by the intracellular gene regulatory network and extracellular ecosystem (i. e. , the microenvironment). Recent studies highlighted the importance of such microenvironment in tissue homeostasis  [1] [2] [3] [4]  , disease occurrence  [5] [6] [7]  , and tumor progression  [8] [9] [10]. For instance, in healthy vertebrate liver, the zonation patterns of hepatocytes perform mutual effect on the microenvironment within liver lobules  4.
1f ), differential microenvironment (DME) analysis (Fig. 1g ), and other downstream spatial omics tasks (Fig. 1h ) within a unified and biologically interpretable framework. With SOTIP, we propose to use MECN (molecular-expression-aware cellular neighborhood) as an agent to abstract and mathematically represent the microenvironment (Fig. 1b ). SOTIP's algorithm modules perform these tasks based on an MECN graph (MEG, Fig. 1d ), in which each node represents an MECN and the edge weight between two nodes was the function of cell states discrepancy (Fig. 1c ) and cell state composition (Fig. 1b ) within MEs. In Supported spatial data i Fig. 1  | Schematic overview. a-h Overview of SOTIP. SOTIP takes 2D/3D spatial omics data (spatially resolved gene expression, protein or metabolic profiles) as input (a).
We demonstrate all SOTIP modules with various types of spatial omics data  [42] [43] [44] [45]  (Fig. 1i , Supplementary Table  3 ), including FISH-based  46, 47  and sequencing-based  48  spatial transcriptomics, mass-spectrometry-based and fluorescence-based spatial proteomics  12, 49  , and secondary ion mass spectrometry (SIMS) based spatial metabolomics  7. We summarize the datasets in Supplementary Table  8  and the demonstration logic in Supplementary Figs. 13 14 15.
Model rational To smooth the reading, we describe SOTIP's rational in this section (see "Methods" for more technical description). In the following, we use "cells" to denote the measurement units in spatial omics data for ease of explanation, which can be freely replaced to"spots" in technologies like 10X Visium or ST. For any data with N cells and P features (e. g. , gene expression vector with length P), traditional (non-spatial) clustering methods  32  directly construct a graph for the N cells, by computing distances on the P feature vectors. Then Leiden 50 algorithm is performed on this graph to get the clustering result. Such traditional clustering methods only take into account the gene expression profile of each cell, without considering the neighborhood information of each cell. On the contrary, SOTIP considers both gene expression profiles of cells, and the neighborhood information of cells.
SOTIP framework demonstration with in silico spatial transcriptomics data To demonstrate SOTIP's utility and to conduct adequate comparisons with other methods, we generated three sets of in silico spatial transcriptomics data by simulating scRNA-seq data, followed by arranging cell spatial coordinates (see "Methods" and Supplementary Fig. 1 ). It is worth noting that since each MECN is generated by searching the spatially nearest neighbors of each cell, in the following sections, every MECN (consisted with multiple cells within the neighborhood of a center cell) is associated with its center cell. In the first simulation, we aimed to compare SOTIP with other methods in SHN quantification. Other methods include NUCC  16, 33  and IGD (see Methods "NUCC and IGD"). To achieve this goal, we simulated three clusters of single cells with inter-cluster discrepancy (Fig.
3f ). It turned out that SOTIPidentified structure aligned well with ribosomal protein S6 (RPS6) (Fig. 3f ), which is reported as a marker of endoplasmic reticulum (ER)  60. To test whether SOTIP can quantify SHN values on tissue samples, we used a spatial transcriptomics dataset containing sections from BRAF V600E melanoma zebrafish model  61. We firstly applied NUCC, IGD and SOTIP on the sample containing a clear tumor-muscle interface (Fig. 3g ). The results showed that SOTIP-computed SHN values delineated the tumor-muscle interface, which was expected to be the most heterogeneous region  61  , in accordance with histological annotation (Fig. 3g , h white arrow) with high specificity. On the contrary, both NUCC-computed and IGD-computed SHN values exhibited indistinguishable pattern within tissue bulk and the tumor-muscle interface (Supplementary Fig.
SOTIP reveals gradient spatial heterogeneity along cerebral cortical layer axis The laminar structure (Fig. 3j ) of mammalian cerebral cortex is reported to exhibit layer-specific properties on gene expression, morphology and connectivity in single cell level  [62] [63] [64]. One study  33  of the recent BRAIN Initiative Cell Census Network (BICCN) program  64  proposed an observation that the composition complexity of cell neighborhoods increased towards deeper layers. They counted the number of different cell clusters within cell neighborhood to define the spatial heterogeneity (like NUCC does). As our aforementioned analysis, the reliability of their statement could be compromised on different clustering resolutions (Fig. 3i ). To confirm and refine their conclusion, we applied SOTIP, which was proved robust and accurate in SHN quantification, on other mouse cortex datasets of independent experiment protocols.
To this end, we firstly adopted a single-cell spatial transcriptomics dataset (cyclic-ouroboros single-molecule fluorescence in situ hybridization, osmFISH  46  ) which covered the main layers of mouse somatosensory cortex with layer annotation  46. This dataset contains 5328 single cells across cell-wise annotated cortical layers (Fig. 3k ) ranging from pia layer 1 (n = 159), layer 2-3 medial (n = 549), layer 2-3 lateral (n = 254), layer 3-4 (n = 131), layer 4 (n = 1002), layer 5 (n = 295), layer 6 (n = 1015), and other regions. We applied SOTIP on this dataset to quantify each ME's SHN value and plotted the distribution of SHN values as violin-plots to display the trends along the cortical depth axis (Fig. 3m ). Specifically, each violin-plot is a distribution of SOTIPcomputed SHN values within a specific cortical layer (x-axis), and the xaxis conforms to the order of the cortex from shallow (viz.
pia layer 1) to deep (viz. Layer 6) layer. The result visually showed a gradient pattern of SHN values from shallow layers to deep (Fig. 3m ). To further quantify the ordinal agreement between the SHN values and layer depth, we used both ME-wise and layer-wise Spearman's rank correlation coefficients (Spearman's ⍴) between them (see "Methods"). The results showed a strong correlation between the SHN value and the cortical depth, in both manner of ME-wise (Spearman's ⍴ = 0. 674, p < 1 × 10 -15 ) and layer-wise (Spearman's ⍴ = 0. 847, p = 0. 016). To strengthen our conclusion, we additionally applied SOTIP on another independent single-cell spatial transcriptomics dataset (evolution of sequential fluorescence in situ hybridization, seqFISH+  17  ) of mouse cortex covering different layers  17.
This dataset contains 913 single cells from five spatially continuous field of views (FOVs) ranging from layer 2 to layer 6 (Fig. 3l ). We conducted the same SOTIP analysis as with osmFISH dataset, the result also confirmed a continuous gradient pattern of SHN values along the cortical axis (Fig. 3n ), and a strong and positive correlation between the SHN value and the layer depth (ME-wise Spearman's ⍴ = 0. 719, p < 1 × 10 -15 and layer-wise Spearman's ⍴ = 1, p < 1 × 10 -15 ). For osmFISH and seqFISH+, the performance of SOTIP were not disrupted by neither different overclustering levels, nor different neighborhood sizes, being more robust than other methods, e. g. , NUCC, IGD (Supplementary Fig. 2a-d ).
SOTIP stratifies known layers in brain tissues To test the capability of SOTIP in the task of spatial domain identification, we took the SpatialLIBD dataset, which provided 10x Visium (Fig. 4a  for illustration) spatial transcriptomics data on 12 tissue sections of human dorsolateral prefrontal cortex (DLPFC)  48. For each tissue section, the original research  48  also provided spot-level annotations of cortical layers as well as white matter regions, which can be used as ground truth to numerally evaluate performance. Since other methods  [36] [37] [38]  have already demonstrated the improved performance of integrating spatial information by comparing with nonspatial clustering algorithms, e. g. , k-means, Louvain  50  , and SC3  65  , on this dataset, we compared SOTIP only with the spatial methods, including stLearn  38  , BayesSpace  36  , and SpaGCN 37 , Giotto 66 , SEDR  39  , STAGATE  40  , and SpatialPCA 41 (Supplementary Table  1 ).
4d , n = 12) in terms of mean and median. Specifically, SpaGCN (mean/median: 0. 43/0. 45) and BayesSpace (mean/median: 0. 43/0. 42) are two best peer-reviewed methods, have higher ARI than older methods, e. g. , stLearn (mean/median: 0. 36/0. 36), and Giotto (mean/ median: 0. 36/0. 37), while lower than STAGATE (mean/median: 0. 49/ 0. 51) and SpatialPCA (mean/median: 0. 52/0. 55), the two best preprinted methods. SOTIP (mean/median: 0. 58/0. 57) performed best than all of them. For the compatibility, BayesSpace was restricted to the latticeshaped spatial data like 10x Visium (Fig. 4a ), while SOTIP and SpaGCN does not rely on the spatial arrangement of spots/cells. To demonstrate whether SOTIP surpass other methods on non-lattice-shaped spatial transcriptomics data (Fig. 4e ), we examined the two algorithms on a single-cell spatial transcriptomics dataset (osmFISH  46  ) of the mouse brain somatosensory cortex.
SOTIP characterizes spatial and molecular tumor-immune organization After demonstrating the superior performance of SOTIP on various spatial transcriptomics datasets, we next ask whether SOTIP is also compatible with spatial proteomics datasets. Since there are currently few methods that was explicitly applied to perform spatial domain identification on spatial proteomics data, we only compared SpaGCN with SOTIP. We found two spatial proteomics datasets, of which the first was produced by MIBI-TOF technique on 41 triple negative breast cancer (TNBC) patients  12  , and the second was produced by scMEP technique on two colorectal carcinoma (CRC) patients and two healthy controls  49. With these datasets, we attempted to identify the tumorimmune interplay (Fig. 5a  for illustration), which has been widely regarded as a prognostic indicator in tumor progression  [67] [68] [69].
As the original papers provided tumor/immune partition annotations for 2 samples in CRC (Fig. 5d ), and two samples in TNBC (Fig. 5g ), we used these four samples to evaluate the performance of different methods on stratifying tumor and immune regions. For better visualization and qualitative comparison  29  , we plotted the detected spatial domains using Voronoi diagrams (Fig. 5b  for illustration). The results (Fig. 5e, h ) showed that in all datasets, SOTIP achieved better results in terms of visual coherence compared with SpaGCN, and almost perfectly matched with the originally reported region annotations (Fig. 5d, g ). Tumor and immune cells are reported to perform mutual modulation by frequent cross-talk within the tumor-immune ecosystem  70. Their intercellular communications and intracellular regulation networks generate patterned phenotypic cell identities and molecular distribution  71.
Molecular polarization (a form of spatial molecular distribution pattern that certain molecule tends to differentially enriched distal/proximal to a tissue landmark) was recently reported to appear nearby pathological tissue boundaries  7, 12, 61  (Fig. 5c  for illustration). To show that SOTIP-detected tumor/immune regions better fit for downstream analysis, we next inspected the relationship between molecular polarization and tissue architecture. To be clear, in the following statements, when we say that a protein is polarized to/away a region, we mean that the protein tends to distributed proximally/distally to that region. In the CRC datasets, we first classified immune cells as distal and proximal to tumor-immune boundary (see "Methods", Supplementary Fig. 4a, b ) using SOTIP and SpaGCN results, respectively.
Next, Wilcoxon rank sum test was adopted to estimate the protein enrichment/depletion with respect to the boundary, and polarized proteins with statistical significance were detected. We measured the detection power on the basis of false-discovery rate (FDR) in both datasets to conduct a fair comparison across methods. The results showed that SOTIP was more powerful than SpaGCN across a range of FDR cutoffs (Fig. 5f left ). We also performed similar analysis on TNBC datasets (see "Methods", Supplementary Fig. 4c, d ), to identify molecular polarization to/away tumor (Fig. 5i left ) and immune regions (Supplementary Fig. 4e-g ), confirming the superior detection power of SOTIP. Last, we showed representative (see Methods) polarized proteins detected by SOTIP in CRC (Fig. 5f  right), and in TNBC (Fig.