dataesr/scientific-paragraphs-categorization huggingface dataset:
A further limitation lies in the nature of machine learning-based models that, without a prebuilt cell type hierarchy, neglect the relationships among cell types both within and across datasets and usually lead to "flat" classifiers. Furthermore, current efforts for single-cell data integration largely focus on correcting batch effects across datasets  9, [14] [15] [16] [17] [18]. Information relating to cell types annotated by individual studies is not fully utilized in batch effect regression owing to naming inconsistencies. Once cell types are successfully harmonized across datasets, data integration can be supervised in an annotation-aware manner. Although deep learning-based methods such as scANVI  19  and scGen  20  are able to include cell type information in the integration pipeline, further efforts are needed to control for the degree of intervention from cell annotations, as well as to incorporate cell type relationships and cell hierarchy into the data integration process.
To meet these challenges, we develop an automated workflow for cell type harmonization connected with cross-dataset integration. Building on the infrastructure in CellTypist v1. 0  8  , we develop a predictive clustering tree (PCT)-based tool in CellTypist v2. 0 to efficiently align multiple datasets by assessing their cell-cell similarities and harmonizing cell annotations. Based on this, CellTypist defines semantic relationships among cell types and captures their underlying biological hierarchies, which are further leveraged to guide the downstream data integration at different levels of annotation granularities. We have applied this pipeline to 43 datasets, confirmed its effectiveness in data harmonization and integration, and provided a collection of organ atlases and machine learning models to the wider community for automatic cell annotation.
An automated workflow for cell type harmonization and integration To infer cell type relationships across datasets, we use PCT, a multi-target regression tree algorithm. Different from classical multi-output decision trees, with PCT the dependency among cell types in the reference datasets is considered, and dissimilarities between query cells and reference cell types are predicted to be the prototypes of the matched tree leaves (Figure  1 ). To reduce runtime and avoid overfitting, during the top-down induction of PCT in each dataset, the clustering tree is pruned at the cell taxonomy (i. e. , node) where further splitting will result in two homogeneous cell states based on an F-test. By iteratively building such a tree using each dataset as a reference and further extrapolating it to cells from the remaining datasets, CellTypist derives a global matrix representing the inferred relationships between all cells and cell types.
In other words, once a PCT is built for the reference dataset, each query cell will fall into a given leaf of the reference tree, and this information is used to predict its dissimilarity profile across reference cell types, thereby effectively scaling the query datasets to the reference. Since this algorithm has no assumption about gene expression distribution and cell-cell distances are predicted within the span of the clustering trees, CellTypist is able to produce batch-insensitive dissimilarity measures, enabling a robust cross-dataset meta-analysis. The resulting relationships between cells and cell types are integrated into a harmonization graph by considering all possible pairs of reference-to-query predictions (Figure  1 ). Specifically, we define a dataset core which summarizes original cell types into semantically connected ones including matched and divisible cell types.
Through iterative addition of a new dataset, this core is gradually enlarged to re-define an expanded cell type repertoire, namely, the CellTypist harmonization table (Figure  1 ; Methods). The advantage of this procedure is that the order of datasets added has a minimal impact on the structure of the harmonization graph. As a result, cell types in the graph can be reorganized to approximate the underlying biological hierarchies including the high-and low-hierarchies (Figure  1 ). This also represents an avenue to integrate knowledge across studies by connecting their manual (and biologically meaningful) groupings. Moreover, to improve sensitivity in discovering datasetspecific cell types, CellTypist defines two levels of novelties for cell types in a given dataset: unmatched cell types ("NONE") which cannot align with any cell type from the other datasets, and unharmonized cell types ("UNRESOLVED") which fail to integrate into the harmonization graph after the final iteration.
CellTypist further utilizes the cell type relationships to supervise the single-cell data integration (Figure  1 ). Given the harmonized cell types across datasets, the neighborhood graph is built by searching the neighbors of each cell in a restricted manner within the same cell type group which is determined by combining the cell type hierarchy with the inferred transcriptomic similarities (Methods). By controlling the size of cell type groups, CellTypist can adjust the extent of supervision from cell annotations. Data scalability and efficiency are also anticipated to be improved as the neighborhood search space is dramatically narrowed down.
CellTypist harmonization recapitulates expert-curated annotations To validate the harmonization pipeline in CellTypist, we selected five immune datasets which were initially included in the CellTypist v1. 0 database and deeply curated by experts into consistent cell types  8. These datasets had varying cell type compositions, developmental stages, tissue coverages, and transcriptome sparsities, presenting a real-world scenario for cell type harmonization (Figure  S1A ). As expected, we observed substantial batch effects when visualizing the 417,866 cells onto the uniform manifold approximation and projection (UMAP)  21  (Figure  S1B ). We thus asked whether CellTypist can harmonize the cell types of the datasets to recapitulate the ground-truth annotations (Figure  S1C ). Despite the various confounding factors present in the five datasets, CellTypist was able to reconstruct their cell type relationships from two complementary angles.
Firstly, CellTypist predicted the transcriptomic distances among the 129 original cell types, and based on this, revealed a high degree of cross-dataset cell type replicability (Figure  S2 ). Specifically, unsupervised hierarchical clustering using the inferred distances not only grouped the same cell types from different datasets regardless of their batch confounders, but also demonstrated a biological structure comprising compartments of hematopoietic progenitors, myeloid, and lymphoid cells. This meta-analysis also uncovered finer structures underlying these datasets such as the innate lymphoid cells and T cells, the latter of which were further subdivided into CD4+ αβ, CD8+ αβ, and γδ T cells (Figure  S2 ). Secondly, CellTypist harmonized the 129 cell types into 66 at the low-hierarchy level, identifying both dataset-shared and -specific cell types (Figures  2A  and S3A ).
Similarly, for natural killer (NK) cells, CellTypist harmonized seven NK annotations into two subtypes as supported by their respective gene signatures, that is, the CD16+ ("NK_FCGR3Apos", "NK_CD16+", and "mature NK") and CD16-("NK_CD160pos", "NK_CD56bright_CD16-", "NK", and "CD56 bright NK") NK cells (Figure  S4A ). A number of cell types were hierarchically harmonized, leading to the identification of cell subtypes not annotated as such in the original publications (Figures  2A  and S3A ). In one of the datasets, we previously described a specialized and rare memory B cell population, ageassociated B cells (ABCs), and extrapolated its presence to other datasets by means of manual inspection  8. Using the automated harmonization algorithm in CellTypist, we reproduced these findings by corroborating the existence of ABCs in two other datasets profiling the adult spleen and bone marrow, respectively  22  (Figure  2D ).
The other example was the "B cell" population identified in the fetal liver  23  , which we demonstrated to consist of a spectrum of transitional subpopulations from immature to naive B cells (Figure  S4B ). Moreover, the harmonization module in CellTypist is able to detect homogeneous subtypes which may not readily be separated using clustering-based approaches. In line with our manually curated results, we found three transcriptionally similar myeloid populations ("monocyte-DC", "CD14 monocyte", and "CD16 monocyte") collectively forming the "Macrophage" annotated in the gut dataset  24  (Figure  2E ), as well as three distinct CD4+ T cell populations ("Tnaive/CM_CD4", "Tfh", and "Teffector/EM_CD4") constituting a single heterogeneous "T_CD4_fh" cell type in a spleen dataset  22  (Figure  S4C ).
Interestingly, CellTypist discovered new cell types that were previously overlooked. For instance, the γδ T cells ("gd T") initially annotated in the gut dataset  24  were revealed by CellTypist to contain a hidden population of epithelium-resident CD8+ αβ T cells ("Trm_gut_CD8") which closely resembled the γδ T cells (Figure  S4D ). This was also the case for plasma cells defined in two datasets  8, 22  where CellTypist hierarchically divided them into the IgA ("B cell IgA Plasma") and IgG ("B cell IgG Plasma") plasma subpopulations based on another dataset  24  (Figure  S4E ). To further test the stability of our algorithm in multi-dataset alignment, we permuted the order of datasets incorporated during harmonization and confirmed the robustness of the aforementioned observations (Figure  S5 ).
CellTypist disentangles disease-enriched cell states Cell diversity is often increased in pathological conditions due to the emergence of novel cell types or molecular reorganization of the same cell types  25, 26. Resolving the cell state complexity in disease and ascertaining its association with the underlying molecular alterations are important for understanding pathogenesis. To test the utility of CellTypist in these contexts, we applied it to four single-cell datasets  [27] [28] [29] [30]  profiling the adult human lung, collectively covering 479,135 cells from 130 individuals in health plus eight diseases resulting in pulmonary fibrosis: idiopathic pulmonary fibrosis (IPF), chronic obstructive pulmonary disease (COPD), nonspecific interstitial pneumonia (NSIP), chronic hypersensitivity pneumonitis (cHP), interstitial lung disease (ILD), sarcoidosis (SA), systemic sclerosis (SSc), and polymyositis (PM) (Figure  S6A ).
Prominent technical batch effects existed across these datasets, making the discovery of disease patterns challenging (Figures  S6B-S6D ). Despite these batch effects, with CellTypist, epithelial and stromal cell types in the four datasets were consistently harmonized, in a manner that discriminated the transcriptomic differences not only among cell subtypes but also among disease statuses (Figures  3A, 3B,  and S7 ). For example, the basal, ciliated, and alveolar epithelial cell types were clearly separated into healthy and diseased cell states, with most of the disease statuses further distinguishable in the harmonization graph. Conversely, in the immune cell compartment, many cell types were harmonized irrespective of their disease contexts, such as the partial alignment between normal and COPD mast cells, as well as among NK cells in normal, COPD, NSIP and IPF conditions (Figure  S8 ).
This was further corroborated by an independent analysis using logistic regression-based label transfer. In addition, the harmonization graph indicated mixing of this population into the "AT1" cell type of a third dataset  30. In silico, we were able to resolve these populations and verified their presence by combinatorial expression of multiple marker genes (Figure  4A ). Similarly, goblet cells in the diseased state from two of the datasets  27, 28  were demonstrated to be heterogeneous, divisible into MUC5B+ and SCGB3A2+SCGB1A1+ populations (Figure  4B ). CellTypist can further refine the original cell annotations to match their underlying biology. For instance, the IPF "Fibroblast" in Adams et al  27  was shown to align with the lipofibroblast-like subpopulation, as supported by its overexpression of HAS1 and PLIN2 (Figure  S9A ).
These included diseased club cells that aligned across four datasets, and IPF-related goblet cells, in particular the MUC5B+ subtype harmonized by CellTypist in three of the datasets (Figure  S10A ). Among the collagen-producing stromal cells, an excessive accumulation of extracellular matrix (ECM) was detected in pathological fibroblasts and myofibroblasts (Figure  3D ). Between them, myofibroblasts in five diseases (ILD, SA, cHP, NSIP, and IPF) had activation signatures, and showed a much stronger enrichment of ECM genes than healthy and diseased fibroblasts, including the IPF "Fibroblast" in Morse et al  28  which was harmonized into the myofibroblast population (Figure  4C ). In the lung endothelium, we located a match between the peribronchial endothelial cells from Adams et al  27  , and all IPF endothelial cells in the other three datasets that were COL15A1+, a marker suggestive of a widespread bronchiolization occurring in endothelial cells of the distal lung in IPF (Figure  S10B ).
We also observed a partial loss of the AT1 cell identity specifically in PM, illustrated by the deficiency in expression of AT1 markers AGER and RTKN2, as well as a gain of expression in known pulmonary fibrosis marker MMP7 40. Further extending this analysis to the secretory cells (Figure  S11A ) and fibroblasts (Figure  S11B ), we characterized both disease-shared andspecific alterations in transcriptomes of multiple cell types and subtypes as harmonized by CellTypist. In summary, application of CellTypist to four diseased lung datasets successfully harmonized the cell types in different compartments, disentangled the aberrant cell states in multiple diseases, revealed their underlying pathological signatures, and facilitated a comprehensive investigation of transcriptomic changes.
Cell re-annotation and data integration by CellTypist Given the harmonized cell types across datasets, CellTypist can further refine the identity of each cell by reannotating it within the context of multiple datasets. Specifically, on the basis of cell harmonization information, including cell identities annotated in the dataset of origin and inferred from the other datasets, each cell can be reannotated to one of the harmonized cell types in the graph corresponding to a given row in the harmonization table (Figure  1 ). CellTypist reannotated the cells from the five immune datasets into 66 low-hierarchy and 52 high-hierarchy cell types, providing precise classifications with different granularities for individual cells (Figure  5A ). For instance, the previously annotated γδ T cells were grouped as a single cell type at the high hierarchy and were further classified into two low-hierarchy cell types: 88% as γδ T cells ("NONE = Trm_Tgd ∈ gd T = NONE = NONE") and 12% as epithelium-resident CD8+ T cells ("NONE = Trm_gut_CD8 ∈ gd T = NONE = NONE").
Through reannotation, all cells were placed into a common naming schema, allowing data integration to be supervised by annotations. In particular, the cell hierarchies built under this schema, in combination with the transcriptional distances, offered an accurate and efficient approach to construct the neighborhood graph. This confined neighbor search to cells from the same branches or similar cell types, thereby purifying cell neighbors at a minimal search cost. Notably, the extent to which the cell hierarchies guide data integration can be adjusted through controlling the number of neighboring cell types (i. e. , meta neighbors) that are incorporated into the search space. This approach also applies to partially annotated datasets where local transcriptomic structures can be tuned using annotated cells only.
We employed this strategy to integrate cells from the five immune datasets, and based on this, revealed the expected transcriptomic organization of immune cells (Figures  5B  and S12 ). To benchmark CellTypist against widely used data integration methods, we compared the performance of CellTypist on the five immune datasets with that of other methods, including six unsupervised (FastMNN, Harmony, Seurat v4, BBKNN, Scanorama, and scVI) and two supervised (scANVI and scGen) ones 9,14-20 (Figure  S13 ). A set of integration metrics were used to assess the performance of these tools (Methods). With respect to the biological conservation, annotation-aware methods (scANVI, scGen, and CellTypist) showed better preservation of cell types across datasets than unsupervised ones, regardless of use of low-or high-hierarchy annotations (Figure  5C ).
The degrees of batch removal, on the other hand, were comparable across most methods, with the top performers being Seurat v4, BBKNN, and CellTypist. The performance of CellTypist was further confirmed by benchmarking on the four diseased lung datasets (Figures  S14  and S15 ). Since only part of the dataset is exploited when anchoring neighbors to query cells, we also expect an improved efficiency of data integration by using CellTypist. To test this, we benchmarked the runtime of all nine methods based on different subsets of the five immune datasets generated by downsampling cells from 10,000 to 400,000 (Figure  5D ). Five methods were able to integrate these cells within 15 minutes: scVI and scGen (using graphics processing unit [GPU]), Scanorama, CellTypist, and BBKNN. Among them, CellTypist and BBKNN were the only two methods that integrated more than 400,000 cells in two minutes.
A multi-organ reference map for cell harmonization, integration, and classification Integrating single-cell resources across the community, a current focus of the HCA consortium, is often laborious. Taking advantage of its highly automated workflow from harmonization to integration, we anticipate that CellTypist could accelerate this process. We thus employed CellTypist to build multi-organ reference maps following three steps: i) manual collection of public organ-focused datasets and their associated meta-data, ii) automatic cell type harmonization and integration by CellTypist, iii) curation and finalization of the derived cell atlases (Figure  6A ). We compiled a total of 38 single-cell and single-nucleus transcriptomics datasets profiling 3,694,864 cells from 369 adult human donors in 12 tissues and organs, including the blood, bone marrow, heart, hippocampus, intestine, kidney, liver, lung, lymph node, pancreas, skeletal muscle, and spleen (Table  S1 ).
After applying the automated pipeline in CellTypist, we generated 12 standardized organ reference atlases, available at https://www. celltypist. org/organs. All cells in these atlases were reannotated into the harmonized groups inferred by CellTypist, which after further manual inspection and categorization were finally curated into biologically meaningful cell type labels. Based on this resource, we offered three complementary functionalities for the single-cell community (Figure  6B ). Firstly, we provided a two-dimensional space (UMAP) onto which cells integrated across datasets were projected, enabling inspection of cell types and gene expression. Secondly, to demonstrate how cell types were harmonized and transcriptomic connections were established across datasets, we visualized the cell type alignments in the form of a harmonization graph or cell type hierarchy, referred to as the "tree plot" in CellTypist.
Discussion Although the single-cell community has been using different batch correction methods to integrate cells, information about independently annotated cell types across datasets, a valuable part of single-cell transcriptomics, has not been fully exploited. To benefit from annotations for cross-dataset integration, we developed workflows for cell type harmonization and integration, combined them into the CellTypist infrastructure, and employed this pipeline to address challenges in developing cell type standards. Combining with the cell type classification module offered by CellTypist v1. 0, CellTypist v2. 0 is now a harmonizationintegration-classification triad contributing to assembling HCA reference data in health and disease. The PCT algorithm endows CellTypist with scalability, speed, and accuracy.
We examined the performance of CellTypist on five heterogeneous immune datasets, and found consistency between cell types harmonized by CellTypist and those curated manually. In CellTypist, we adopt the harmonization graph to iteratively redefine and reannotate cell types without losing relationships between any pairs of datasets. This approach overcomes the challenge in multi-dataset alignment and dataset order instability, and generates consistent cell type hierarchies. Due to constraints on representation in two dimensions, cell types with complex one-to-one and one-to-many alignments may be overlaid in the resulting tree plot (see one example from the blood atlas at https://www. celltypist. org/organs/tree/Blood). Though these cross-connections are partially resolvable through visualization with a different order of datasets, three-dimensional tree plot or other forms of visualizations may be further avenues to pursue.
Reconstructing cell type hierarchies is a long-standing theme in cell biology. Whereas cell type relationships are imprinted in their molecular traits, transcriptome-based cell groupings (e. g. , via unsupervised hierarchical clustering) do not necessarily mirror developmental history or biology. Expert knowledge is needed to group or segregate cell types regardless of their transcriptomic similarities. We speculate that this hard-earned legacy knowledge is often already incorporated into manual annotations, and our approach now allows this information to be integrated across multiple datasets to approximate the underlying biological hierarchies. CellTypist represents an effort towards this direction and lays the foundation for future work aiming to achieve a data-and knowledge-driven cell type hierarchy.
Application of CellTypist to additional datasets further demonstrates its potential to unveil molecular and cellular variations in both physiology and pathology. Since cells from independent laboratories are harmonized, the resulting information can be exploited to put each cell into different contexts beyond its original study. This leads to consolidation of well-defined cell types and identification of novel cell states, as well as alignment of the underlying gene expression signatures and their altered characteristics in disease. For instance, CellTypist was able to uncover pathological cell types and states that could only be identified when multiple datasets were harmonized and greater resolution was achieved. Of note, detecting rare cell types and reflecting subtle molecular changes poses a challenge in many single-cell studies  41- 43.
CellTypist defines two levels of novelties to capture these signals: cells either unmatched or unharmonized across datasets, which are identified during the workflow. A limitation of this approach is that when ambient RNAs are highly abundant in a given dataset, not all cell types belonging to the same category can be well matched across datasets (Figure  S4F ). How to distinguish these artifacts from real transcriptomic deviations is a topic of interest for further developing CellTypist. For data integration, CellTypist uses an annotation-aware algorithm to supervise the construction of neighborhood graphs. Influence of cell annotation on the data structure can range from forcibly merging the same cell types to a more lenient cell grouping. Adjusting the stringency of cell type annotations provides an effective way of integrating the cell type hierarchy into the integration.