to enable cross - dataset gene - level analysis, harmonization of gene names from different datasets ( using different reference genome builds and genome annotations; supplementary table 1 ) was necessary. both annotation sources ( for example, ensembl or refseq ) and annotation versions ( for example, ensembl release 84 or ensembl release 91 ) contribute to the variation between different gene naming schemes. therefore, both annotation sources and versions, including outdated ones, need to be taken into account to enable the mapping of all gene names to a single naming scheme. for the harmonization of gene names, we aimed to map all original gene names to the target scheme hugo gene nomenclature committee gene name, corresponding to the ensembl release 107 publication. to find the most likely match between each original gene name and a target gene name, we first downloaded ensembl releases 79 to 107, which included for each release: ( 1 ) all ensembl gene ids from the downloaded release ( for example, ensg00000081237. 21 ); ( 2 ) corresponding ensembl transcript and protein ids ( for example, enst00000442510. 8 and ensp00000411355. 3 ); ( 3 ) matching ensembl ids from the previous release; ( 4 ) matching gene ids from other genome annotation sources ( for example, refseq ); and ( 5 ) matching gene, transcript and protein identifiers from various external resources, such as uniprot, the hugo gene nomenclature committee and the consensus coding sequence project. we then constructed a graph, with each ensembl id, other genome annotation id and external resource identifier represented by a single node per release. nodes were then connected based on the matching ( points 2 – 5 ) provided by ensembl, weighing edges based on ensembl similarity scores where available. for each original gene name from the hlca datasets, the path with the lowest mean edge weight from that gene name to a gene name from the target names ( ensembl release 107 ) was selected to find the most likely matching gene name from the target ( supplementary table 17 ). genes for which no target could be found were excluded from downstream analysis. when multiple genes were matched with the same target gene name, counts from the original genes were summed. to identify the genes most commonly exhibiting batch - specific expression, the hlca was split by cell type and a differential expression analysis was performed ( based on a wilcoxon rank - sum test ) in each cell type, comparing cells from one dataset ( batch ) with those from all other datasets and repeating this for all datasets. datasets that had fewer than ten cells of the cell type or fewer than three samples with cells of the cell type were excluded from the test. for each test, genes were filtered such that only genes that were significantly upregulated were retained. next, the fraction of included datasets in which a gene was significantly upregulated in the cell type ( affected dataset fraction ) was calculated for all genes. to find genes that were often batch effect associated across many cell types, the mean of the affected dataset fractions was calculated across cell types for each gene. to perform label transfer from the hlca core to the mapped datasets from the extended hlca, we used the scarches k nearest neighbor - based label transfer algorithm. briefly, a k nearest neighbor graph was generated from the joint embedding of the hlca core and the new, mapped dataset, setting the number of neighbors to k = 50. based on the abundance and proximity in a cell ’ s neighborhood of reference cells of different types, the most likely cell type label for that cell was selected. furthermore, a matching uncertainty score was calculated based on the consistency of reference annotations among the k nearest neighbors of the cell of interest [ 12pt ] $ $ u _ } _ c } = 1 - p ( } _ } \ ! . $ $ u c, y, n c = 1 − p y = y ∣ x = c, n c where u c, y, nc is the uncertainty score for a query cell c with transferred label y; n c is its set of k nearest neighbors; and p ( y = y | x = c, n c ) is the weighted ( by edge weights ) proportion of n c with label y, as previously described. thus, high consistency in hlca core annotations leads to low uncertainty scores and low consistency ( that is, mixing of distinc t reference annotations ) leads to high uncertainty scores. for label transfer to lung cancer and healthy, spatially annotate d projected data ( fig. 5b and extended data fig. 7g ), cells with an uncertainty score above 0. 3 were set to unknown. disagreement between original labels and transferred annotations ( that is, transferred annotations with high certainty but not matching the original label ) in the data from ref. highlighted three different cases: annotations not included in the mapped data ( for example, preterminal bronchiole secretory cells, which were labeled as club and goblet in the mapped data; these may not be incorrect label transfers but cannot be verified by label comparison alone ); cell types that are part of a continuum, with cutoffs between cell types chosen differently in the reference than in the projected data ( for example, macrophage subtypes ); and cell types missing in the hlca core that have high transcriptional similarity to other cell types that are present in the hlca, which was observed for several finely annotate d immune cell identities. for example, γδ t cells, ilcs, megakaryocytes, natural killer t cells and regulatory t cells were not annotate d in the hlca core, as these cell types could not be disting uished with confidence in the integrated object and were often lacking in the constituent datasets. indeed, cell types from the t cell / ilc / natural killer lineages are known to be particularly difficult to annotate using transcriptomic data only. therefore, cells annotate d with these labels in the projected dataset were largely incorrectly annotate d as cd4 t cells, cd8 t cells and natural killer cells through label transfer ( fig. 5b and extended data fig. 6e ) source paper: pmc10287567 for the extended atlas, we calibrated the uncertainty score cutoff by determining which uncertainty levels indicate possible failure of label transfer. to determine the uncertainty score at which technical variability from residual batch effects impairs correct label transfer, we evaluated how label transfer performed at the level of datasets, as these predominantly differ in experimental design. to determine an uncertainty threshold indicative of possible failure of label transfer, we harmonized original labels for 12 projected datasets ( one unpublished: duong _ lungmap _ unpubl ) and assessed the correspondence between original labels with the transferred annotations. only cells with level 3 or 4 original annotations were considered, as these levels represent informative annotations while not representing the finest detail. level 5 annotations will often display high uncertainty levels due to high annotation granularity rather than remaining batch effects. to assess the optimal uncertainty cutoff for labeling a new cell as unknown, we used these results to generate a receiver operating characteristic curve. we chose a cutoff around the elbow point, keeping the false positive rate below 0. 5 ( uncertainty cutoff = 0. 2; true positive rate = 0. 879; false positive rate = 0. 495 ) to best disting uish correct from incorrect label transfers ( supplementary fig. 10a ). false positives were either due to incorrect label transfer or incorrect annotations in the original datasets. cells with an uncertainty higher than 0. 2 were set to unknown. study of healthy lung included cell type annotations based on matched spatial transcriptomic data. many of these annotations were not present in the hlca core. to determine whether these spatial cell types could still be recovered after mapping to the hlca core, we looked for clusters specifically grouping these cells.