Skip to main content
NPJ Precision Oncology logoLink to NPJ Precision Oncology
. 2025 Dec 16;10:39. doi: 10.1038/s41698-025-01223-x

Quantitative profiling of intratumor immune heterogeneity identifies loss of immune diversity as a hallmark of cancer progression

Qiqi Lu 1,#, Jiangti Luo 1,#, Chia-Hao Tung 1, Xiaosheng Wang 1,✉, Zhongming Zhao 1,2,✉
PMCID: PMC12820210  PMID: 41402579

Abstract

Immunological intratumor heterogeneity (ImTH) describes the variability in the types, spatial distribution, and functional states of immune cells within tumors. While evidence suggests that ImTH influences tumor progression and therapeutic response, few studies have provided a quantitative characterization of ImTH. Here, we present Scoring Immunological Intratumor Heterogeneity (ScImTH), a novel algorithm that quantifies ImTH by calculating the Shannon entropy of immune cell type proportions within the tumor microenvironment. Using bulk, single-cell, and spatial transcriptomic datasets, we show that reduced ScImTH scores are associated with unfavorable survival outcomes, tumor progression-related molecular and phenotypic features, immunosuppressive states, and resistance to immunotherapy across multiple cancer types. Compared with existing measures of tumor immunity, such as immune score and B-cell receptor diversity, the ScImTH score demonstrated stronger and more consistent associations with clinicopathological features. Notably, the ScImTH score outperformed established biomarkers, including tumor mutational burden and PD-L1 expression, in predicting immunotherapy response. These findings highlight the clinical potential of the ScImTH score as a biomarker for cancer prognosis and immunotherapy stratification. More broadly, our results support the hypothesis that loss of immune diversity is a hallmark of tumor progression.

Subject terms: Biomarkers, Cancer, Computational biology and bioinformatics, Immunology, Oncology

Introduction

The tumor immune microenvironment (TIME) comprises diverse immune cells, soluble immune factors (e.g., cytokines and chemokines), and stromal cells that interact dynamically with tumor cells. This ecosystem plays crucial roles in both tumor inhibition and progression1. Evidence now supports that tumors with high levels of immune cell infiltration (“hot” tumors) are more likely to exhibit favorable clinical outcomes and respond more effectively to immunotherapy compared with tumors with low infiltration (“cold” tumors)2. Accordingly, the abundance of tumor-infiltrating lymphocytes (TILs) has been investigated as a prognostic and predictive biomarker in cancer3. For instance, elevated TIL levels have been associated with improved survival and enhanced immunotherapy response in certain cancers, including triple-negative breast cancer (TNBC), non-small cell lung cancer (NSCLC), and melanoma4–8. However, the predictive value of TILs in cancer prognosis and immunotherapy responses remains limited. Paradoxically, high TIL abundance has been linked to worse survival in some cancers, such as glioma, kidney cancer, and prostate cancer9–11. These discrepant associations highlight the complexity of the TIME and underscore the need to move beyond simple measures of TIL abundance to capture the heterogeneity of tumor-immune interactions.

Immune cell compositions in TIME include T lymphocytes, natural killer (NK) cells, B cells, macrophages, dendritic cells, neutrophils, mast cells, monocytes, and myeloid-derived suppressor cells (MDSCs)12. The varied proportions and spatial distribution of these immune cells constitute a defining feature of tumor malignancy, namely the heterogeneity of the TIME. Unlike tumor heterogeneity, which primarily reflects genetic and phenotypic variability within tumor cells, TIME heterogeneity (also referred to as tumor immune heterogeneity) specifically describes the variability in immune cell composition, distribution, and functional states within and across tumors. Mounting evidence indicates that tumor immune heterogeneity profoundly influences tumor evolution, progression, and therapeutic response13–16. For instance, Nguyen et al. reported marked intratumor immune heterogeneity in hepatocellular carcinoma (HCC), with high heterogeneity correlating with poorer prognosis in HCC patients13. Similarly, Jiménez-Sánchez et al. identified intrinsic TIME heterogeneity in advanced high-grade serous ovarian cancer and observed that chemotherapy could induce localized immune activation14. More recently, Nabet et al. demonstrated that the degree of immune heterogeneity in immune-infiltrated small-cell lung cancer critically shaped responses to immune checkpoint blockade15.

Like tumor heterogeneity, tumor immune heterogeneity can be classified into intratumor immune heterogeneity [also referred to as immunological intratumor heterogeneity (ImTH)] and intertumor immune heterogeneity. Tumor heterogeneity, particularly intratumor heterogeneity (ITH), has been strongly associated with tumor evolution, therapeutic resistance, immune evasion, and poor clinical outcomes17. Consequently, accurately measuring the level of ITH is essential for predicting cancer prognosis and therapeutic responses. Over the past decade, several computational approaches have been developed to quantify ITH, including PhyloWGS18, EXPANDS19, MATH20, and DEPTH21. These methods primarily assess heterogeneity by capturing DNA copy number alterations (CNAs), somatic mutations, or transcriptomic perturbations among tumor cells. However, to date, no algorithm has been established that can effectively quantify intratumor immune heterogeneity across cancer types. While certain approaches, such as gene set enrichment analysis (GSEA)22, can evaluate the enrichment levels of specific immune cell populations within the tumor microenvironment, they are not designed to measure the degree of intratumor immune heterogeneity itself.

Here, we introduce a novel algorithm, Scoring Immunological Intratumor Heterogeneity (ScImTH), which quantifies ImTH based on the composition of diverse immune cell types within the tumor microenvironment using transcriptomic data. We systematically evaluated ScImTH across bulk, single-cell, and spatial transcriptomics in both pan-cancer and individual cancer types, and investigated its associations with a wide range of clinical, phenotypic, and molecular features. Our results demonstrate that the ImTH score generated by ScImTH functions as a robust and consistent positive prognostic factor across multiple cancer types, in contrast to TIL levels, which exhibit cancer type-dependent prognostic value. Moreover, the ImTH score shows strong predictive power for both cancer prognosis and treatment response.

Results

The ScImTH algorithm quantifies ImTH from gene expression matrices derived from bulk, single-cell, or spatial transcriptomics data (Fig. 1). For bulk transcriptomics, ScImTH evaluates a tumor’s ImTH level based on the relative proportions of 14 immune cell types: B cells, CD8⁺ T cells, CD4⁺ T cells, NK cells, macrophages, dendritic cells, mast cells, plasma cells, follicular helper T cells, regulatory T cells, γδ T cells, monocytes, eosinophils, and neutrophils. For single-cell transcriptomics, ScImTH calculates each tumor’s ImTH score using the abundance of annotated immune cell types. For spatial transcriptomics, ScImTH estimates the ImTH level of each spot or region within a tumor according to the proportions of immune cell types identified. We validated the ScImTH algorithm across bulk, single-cell, and spatial datasets in both pan-cancer and individual cancer types. Unless otherwise specified, the term ImTH score hereafter refers to the ImTH level quantified by ScImTH.

Fig. 1. Illustration of the ScImTH algorithm to quantify intratumor immune heterogeneity.

Fig. 1

The figure was created with BioGDP.com.

Elevated ImTH scores association with favorable clinical outcomes in cancer

We applied the ScImTH algorithm to the Cancer Genome Atlas (TCGA) cohorts and derived an ImTH score for each cancer specimen. The TCGA dataset includes 33 cancer types, with full names and abbreviations listed in the Datasets subsection of Methods. We then performed survival analyses using ImTH scores across pan-cancer (n = 9914). Strikingly, tumors with high ImTH scores (top third) exhibited significantly better prognosis than those with low ImTH scores (bottom third), regardless of whether survival was measured by overall survival (OS), disease-specific survival (DSS), disease-free survival (DFS), or progression-free interval (PFI) (P < 3.8 × 10−10) (Fig. 2A). Among the 33 individual cancer types, elevated ImTH scores were significantly associated with improved OS in seven cancer types (BLCA, CESC, HNSC, LIHC, MESO, READ, and SKCM) (P < 0.05) (Supplementary Fig. 1A). In addition, ImTH scores showed marginally significant positive correlations with OS (P < 0.1) in four cancer types (GBM, KIRC, SARC, and THCA) (Supplementary Fig. 1A). Higher ImTH scores were also correlated with better DSS in six cancer types (BLCA, BRCA, GBM, SKCM, READ, and HNSC) (Supplementary Fig. 1B), improved PFI in six cancer types (BLCA, BRCA, ESCA, GBM, MESO, and UVM) (Supplementary Fig. 1C), and better DFS in three cancer types (BLCA, BRCA, and SARC) (Supplementary Fig. 1D). Taken together, these findings demonstrate that the ImTH score serves as a positive prognostic factor not only across pan-cancer but also within multiple individual cancer types.

Fig. 2. Increased ImTH scores are associated with favorable clinical outcomes in cancer.

Fig. 2

A Kaplan-Meier curves to compare the survival rates between the high-ImTH-score (top third) and low-ImTH-score (bottom third) patients in TCGA pan-cancer. The log-rank test P-values are shown. OS, overall survival; DFS, disease-free survival; DSS, disease-specific survival; PFI, progression-free interval. B Kaplan-Meier curves to compare the survival rates between high- and low-immune score patients and between high- and low-BCR diversity (BCR Shannon entropy) patients in pan-cancer. BCR, B-cell receptor. The numbers of cancer types in which the ImTH score, immune score, and BCR diversity score have significant associations with survival outcomes (bottom panel). C Multivariate survival analysis by the Cox proportional hazards model shows that the ImTH score remains a favorable prognostic factor in pan-cancer after adjusting for confounders.

As noted above, the relationship between tumor-infiltrating immune cell levels and clinical outcomes is inconsistent across cancer types. Here, we used the immune score estimated by the ESTIMATE algorithm23 to quantify the abundance of tumor-infiltrating immune cells. Tumors with high immune scores (top third) had significantly better OS than those with low immune scores (bottom third) in five cancer types (ACC, LUAD, SARC, SKCM, and UCEC) (P < 0.05). However, the opposite trend was observed in four cancer types (KIRC, LAML, LGG, and UVM), where higher immune scores were associated with worse OS (P < 0.05) (Fig. 2B). Moreover, elevated immune scores correlated with less favorable DSS, DFS, and/or PFI in four cancer types (KIRC, GBM, LGG, and UVM). Surprisingly, in the pan-cancer analysis, immune scores showed a significant negative correlation with OS (P = 2.17 × 10−8), while no significant associations were found for DSS, DFS, or PFI (Fig. 2B). By contrast, higher ImTH scores were associated with worse OS and DSS in only a single cancer type: kidney renal papillary cell carcinoma (KIRP), a relatively rare kidney cancer (P < 0.05). We further examined B-cell receptor (BCR) richness and BCR Shannon entropy scores, obtained from a previous study24, as measures of BCR repertoire diversity, which has been linked to enhanced antitumor immune responses and favorable prognosis25. Similar to immune scores, however, BCR diversity scores displayed discordant correlations with survival across TCGA cancer types (Fig. 2B and Supplementary Fig. 2). Collectively, these findings indicate that, in contrast to immune infiltration levels and BCR diversity measures, the ImTH score emerges as a more consistent and broadly positive predictive biomarker for cancer prognosis.

To evaluate whether the observed associations between ImTH scores and survival outcomes were influenced by potential confounders, we performed multivariate survival analyses using the Cox proportional hazards model, with predictors including age, tumor stage/grade, immune score, and ImTH score. The results confirmed that the ImTH score remained an independent favorable prognostic factor in pan-cancer as well as in six individual cancer types (BLCA, BRCA, HNSC, LUSC, OV, and SKCM) for OS and/or DFS after adjustment (Fig. 2C and Supplementary Fig. 3). Consistent with earlier findings, multivariate analysis also showed that the ImTH score acted as an adverse prognostic factor only in KIRP.

Decreased ImTH scores associate with tumor progression phenotypes

ImTH scores were significantly lower in tumors with metastasis than those without metastasis in TCGA pan-cancer and in four cancer types (ACC, BLCA, PRAD, and UVM) among the 12 cancer types with available metastasis-related clinical information (P < 0.05) (Fig. 3A). Likewise, ImTH scores were significantly reduced in high-grade (G3-4) versus low-grade (G1-2) tumors in four cancer types (BLCA, CESC, KIRC, and UCEC) (P < 0.05) (Fig. 3A). In addition, patients with tumor presence had significantly lower ImTH scores compared with those tumor-free in pan-cancer and in seven cancer types (BLCA, BRCA, HNSC, PRAD, READ, SKCM, and UVM) (P < 0.05) (Fig. 3A). Similarly, patients who did not benefit from treatment exhibited lower ImTH scores than those who benefited from treatment in pan-cancer and in multiple individual cancer types, including BLCA, LGG, PAAD, and PRAD (P < 0.05) (Fig. 3A). Interestingly, among 24 cancer types with transcriptomics data available for matched normal samples, ImTH scores were significantly lower in tumor than in normal samples in pan-cancer and in 11 individual cancer types (BLCA, BRCA, COAD, GBM, HNSC, KIRC, KIRP, LUSC, READ, STAD, and UCEC) (P < 0.05) (Fig. 3B). Notably, pancreatic adenocarcinoma (PAAD) was the only exception, where tumors had significantly higher ImTH scores than normal tissue (P = 0.03). A plausible explanation for this exception lies in the distinctive TIME of pancreatic cancer, which is dominated by a dense, fibrotic stroma that enforces strong immunosuppression26. The desmoplastic matrix physically excludes cytotoxic T cells from tumor islets, generating an immune infiltrate that is abundant yet functionally suppressed and spatially confined. Accordingly, the elevated ImTH score observed in PAAD may reflect this immunologically rich but functionally inert and spatially restricted immune landscape.

Fig. 3. ImTH scores decrease with tumor progression and correlate with unfavorable tumor molecular signatures.

Fig. 3

A ImTH scores were significantly lower in the tumors with metastasis than those without metastasis, in high-grade (G3-4/High Grade) than low-grade (G1-2/Low Grade) tumors, in the patients with tumors than those tumor-free, in the patients not benefiting from treatment than those benefiting from treatment in TCGA pan-cancer and multiple individual cancer types. B ImTH scores were significantly lower in tumor than in normal samples. C ImTH scores displaying negative associations with unfavorable tumor molecular signatures: stemness, angiogenesis, EMT, proliferation, invasion, and metastasis signatures, in pan-cancer and numerous cancer types. The Spearman correlation coefficients (ρ) and P-values are shown. D ImTH scores decreased in aggressive cancer subtypes: TNBC versus non-TNBC, KRAS-mutated versus KRAS-wildtype, TP53-mutated versus TP53-wildtype, smokers versus non-smokers, and varied among the immune subtypes of TCGA pan-cancer. TNBC, triple-negative breast cancer; SKCM, skin cutaneous melanoma. One-tailed Mann-Whitney U test P-values are shown in (A, B, D). * P < 0.05, ** P < 0.01, *** P < 0.001; they also apply to following figures.

Decreased ImTH scores are associated with unfavorable tumor molecular features

We investigated the associations between ImTH scores and the enrichment of key hallmarks of cancer, including cancer stemness, angiogenesis, epithelial-mesenchymal transition (EMT), proliferation, invasion, and metastasis27. Cancer stemness reflects the stem cell-like properties of continuous self-renewal and proliferation in a small subset of cancer cells28. ImTH scores correlated negatively with stemness scores in pan-cancer and in 17 cancer types (P < 0.05) (Fig. 3C). Angiogenesis, which plays a critical role in tumor progression29, also showed significant negative correlations with ImTH scores in pan-cancer and 22 cancer types (P < 0.05) (Fig. 3C). Similarly, the EMT signature, a key driver of metastasis30, was inversely correlated with ImTH scores in pan-cancer and 23 cancer types (P < 0.05) (Fig. 3C). Furthermore, ImTH scores displayed significant negative correlations with proliferation, invasion, and metastasis signatures in 18, 28, and 21 cancer types, respectively (Fig. 3C). Collectively, these results indicate that reduced ImTH scores are associated with the upregulation of molecular programs promoting tumor progression, highlighting the link between low immune heterogeneity and unfavorable tumor features.

ImTH scores are reduced in aggressive cancer subtypes

TNBC is the most aggressive breast cancer subtype31. We compared ImTH scores between TNBC and non-TNBC in two large breast cancer transcriptome datasets: TCGA-BRCA32 and Metabric-BRCA33. ImTH scores were remarkably lower in TNBC than in non-TNBC in both datasets (P = 5.6 × 10−4 and 0.042 for TCGA-BRCA and Metabric-BRCA, respectively) (Fig. 3D), despite TNBC exhibiting higher immune cell enrichment34. KRAS, one of the most frequently mutated oncogenes, drives uncontrolled cell proliferation and cancer progression35. Among 27 TCGA cancer types with reported KRAS mutations, KRAS-mutated tumors had significantly lower ImTH scores than KRAS-wildtype tumors in seven cancer types, including BLCA, BRCA, DLBC, LGG, LUSC, PAAD, and PRAD (P < 0.05) (Fig. 3D). In addition, the KRAS-mutated subtype tended to have lower ImTH scores than the KRAS-wildtype subtype in four cancer types: CHOL, MESO, SARC, and STAD (P < 0.1). Only in two gynecological cancer types (CESC and UCEC) were ImTH scores lower in KRAS-wildtype than KRAS-mutated subtypes (P < 0.05). TP53, a key tumor suppressor gene, is associated with poor prognosis when mutated36. ImTH scores were noticeably lower in TP53-mutated than in TP53-wildtype subtypes in pan-cancer and in seven cancer types (Fig. 3D). These cancer types, including BLCA, BRCA, DLBC, HNSC, LUAD, and PAAD, are highly prevalent. No cancer type showed higher ImTH scores in TP53-mutated versus wildtype subtypes. Smoking, a major cancer risk factor37, was associated with lower ImTH scores in pan-cancer (P = 0.01; median: 2.52 vs. 2.56) (Fig. 3D).

Previously, Thorsson et al.38 defined six immune subtypes in TCGA pan-cancer: Wound Healing (C1), IFN-γ Dominant (C2), Inflammatory (C3), Lymphocyte Depleted (C4), Immunologically Quiet (C5), and TGF-β Dominant (C6). These subtypes demonstrated distinct survival prognosis, with C3 having the most favorable prognosis, followed by C1 and C2, while C4 and C6 had the poorest outcomes. ImTH scores differed significantly across these subtypes (Kruskal-Wallis test, P < 0.001), following the pattern: C3 > C2 > C5 > C1 > C4 > C6 (Fig. 3D). This finding reinforces that lower ImTH scores are associated with tumor subtypes exhibiting poor prognosis.

ImTH scores reflect anti-tumor immune activity but show weak and inconsistent associations with tumor immune infiltration

To investigate whether ImTH scores are strongly associated with tumor immune infiltration, we calculated Spearman correlations between ImTH scores and immune scores across TCGA pan-cancer and 33 individual cancer types. In pan-cancer analyses, the correlation was weakly negative (ρ = −0.169; P = 3.4 × 10−64). Across individual cancer types, significant positive correlations were observed in 12 types and negative correlations in 8 types (P < 0.05), but most correlations were weak (|ρ | < 0.4) (Fig. 4A). These results suggest that ImTH scores and TIL levels are neither strongly nor consistently associated. Similarly, BCR diversity showed weak and inconsistent correlations with ImTH scores across cancer cohorts (Supplementary Fig. 4).

Fig. 4. Association between ImTH scores and tumor immune infiltration levels.

Fig. 4

A Spearman correlations between ImTH scores and immune scores in TCGA pan-cancer and 33 individual cancer types. B Kaplan-Meier curves showing that the combination of ImTH and immune scores differentiates patients with distinct prognoses, while immune scores failed to separate them with prognostic differences in two squamous cell cancers (HNSC and LUSC). HNSC, head and neck squamous cell carcinoma; LUSC, lung squamous cell carcinoma. C Kaplan-Meier curves showing that the ImTH score can further stratify MSI-high and MSI-low/MSS groups into subgroups with significant overall survival differences. MSI, microsatellite instability; MSS, microsatellite stability. D Spearman correlations between ImTH scores and proportions of 14 immune cell types in TCGA pan-cancer and in 33 individual cancer types. E ImTH scores show significant, positive correlations with the ratios of CD8+ T cell enrichment scores over PD-L1 expression levels in 15 cancer types and significant, negative correlations in 2 cancer types. The Spearman correlation coefficients (ρ) and P-values are shown in (A, D, E), and the log-rank test P-values are shown in (B, C).

Next, we evaluated whether incorporating ImTH scores could improve the prognostic value of immune infiltration. Patients were first stratified by median immune score, then further divided by median ImTH score. In certain cancers, such as HNSC and LUSC, the combined stratification distinguished patients with distinct prognoses, whereas immune scores alone did not (Fig. 4B). Similarly, based on the microsatellite instability (MSI) status, we divided the TCGA pan-cancer cohort into two groups: MSI-high and MSI-low/microsatellite stability (MSS), and further stratified each group into two subgroups based on the median ImTH score. Survival analysis showed that within the MSI-high group and within the MSI-low/MSS group, both subgroups exhibited significant OS differences (Fig. 4C).

We further examined associations between ImTH scores and the abundance of individual immune cell types, namely the fraction of individual immune cell types over all immune cells inferred by CIBERSORT39. Remarkably, the fractions of macrophages had strong negative correlations with ImTH scores in pan-cancer (ρ = −0.70; P = 0) and in 30 out of 33 cancer types (ρ ≤ −0.50; P < 0.001) (Fig. 4D). Analysis of macrophage subtypes revealed that M0 and M2 macrophages correlated inversely with ImTH scores in pan-cancer and in most cancer types, while M1 macrophages showed inconsistent correlations (Supplementary Fig. 5A). In contrast, dendritic cells displayed significant positive correlations with ImTH scores in pan-cancer (ρ = 0.35; P = 1.17 × 10−276) and in 29 cancer types, monocytes in pan-cancer (ρ = 0.29; P = 2.77 × 10−185) and in 28 cancer types, B cells in pan-cancer (ρ = 0.27; P = 2.58 × 10−161) and in 27 cancer types (Fig. 4D). CD8+ T cells were also positively correlated with ImTH scores in pan-cancer and most individual cancers (Fig. 4D). Interestingly, ImTH scores correlated positively with the ratios of CD8+ T cell enrichment to PD-L1 expression in 15 cancer types, and negatively in only 2 (Fig. 4E). Furthermore, we assessed correlations between ImTH scores and enrichment of T cell exhaustion and activation signatures. Higher ImTH scores were associated with decreased T cell exhaustion and increased T cell activation across most cancer types (P < 0.05) (Supplementary Fig. 5B). This underscores that the ImTH score reflects the activity of anti-tumor immune response, capturing both effector T cell presence and the balance with tumor immunosuppressive signals.

ImTH scores outperform established biomarkers in predicting immunotherapy response

We next examined the association between ImTH scores and clinical response to checkpoint blockade immunotherapy using the TCGA pan-cancer dataset and five additional immunotherapy-treated cohorts. Across all cohorts, ImTH scores were significantly higher in responders compared with non-responders (P < 0.05) (Fig. 5A). Consistently, tumors with high ImTH scores (>median) demonstrated greater response rates than those with low scores (<median): TCGA pan-cancer (41.7% vs. 31.7%), Gide (SKCM; 77.8% vs. 33.3%), Mariathasan (UC; 29.1% vs. 16.3%), Snyder (BLCA; 38.5% vs. 22.2%), Braun (KIRC; 17.0% vs. 13.7%), and Fernandez (BLCA; 80.0% vs. 20.0%) (Fig. 5B). These findings highlight a robust positive relationship between ImTH and immunotherapy efficacy. Tumor mutational burden (TMB)40 and PD-L1 expression41 are widely used biomarkers of immunotherapy response. However, TMB did not significantly differ between responders and non-responders in two cohorts with TMB information available: TCGA pan-cancer (P = 0.105) or Braun (KIRC) (P = 0.153) (Supplementary Fig. 6A). Similarly, PD-L1 expression showed no significant differences between responsive and non-responsive groups in four of the six cohorts analyzed (Supplementary Fig. 6B).

Fig. 5. ImTH score represents a positive biomarker for immunotherapy response.

Fig. 5

A ImTH scores were significantly higher in the tumors responding to checkpoint blockade immunotherapy than those resistant to immunotherapy. The one-tailed Mann-Whitney U test P-values are indicated. B The immunotherapy response rate was higher in high-ImTH-score (> median) than in low-ImTH-score (<median) tumors. C Logistic regression analysis indicates that the ImTH score is a significant, positive predictor for the response to immunotherapy, while TMB and PD-L1 expression are not significant predictors. TMB, tumor mutational burden.

To directly compare predictive value, we performed logistic regression modeling of immunotherapy response (response vs. non-response) in TCGA pan-cancer using TMB, PD-L1 expression, and ImTH score as predictors. Strikingly, while TMB and PD-L1 expression were not significant predictors (P > 0.1), ImTH scores emerged as an independent and statistically significant predictor of immunotherapy response (standardized regression coefficient: β = 1.114; P = 0.044) (Fig. 5C).

Together, these results demonstrate that ImTH scores provide stronger and more consistent predictive power for immunotherapy response than established biomarkers, supporting their potential clinical utility.

ImTH scores vary across and within cancer types

We assessed ImTH scores across 33 TCGA cancer types and observed substantial intertumor variability. CESC, PRAD, UCEC, THCA, and KICH exhibited the highest median ImTH scores, whereas SARC, DLBC, UCS, GBM, and UVM displayed the lowest (Fig. 6A). Notably, several cancers with high median ImTH scores, including PRAD, THCA, and KICH, are also among the cancer types with more favorable prognoses across TCGA cancer cohorts, suggesting a link between elevated immune heterogeneity and improved survival outcomes. LGG (lower-grade glioma) and GBM (the highest-grade glioma) are two subtypes of gliomas, with GBM characterized by a more unfavorable prognosis and stronger immune infiltration than LGG42. Our analysis revealed that GBM had significantly lower ImTH scores than LGG (P = 2.42 × 10−12; median ImTH score: 2.22 vs. 2.45) (Fig. 6B). This finding supports the role of ImTH as a positive prognostic factor, independent of overall immune infiltration levels, in glioma and potentially in other cancers. Cancers originating in the same tissue but derived from distinct cell types or anatomical regions also showed divergent ImTH profiles. For example, LUAD displayed higher ImTH scores than LUSC; among kidney cancers, scores followed the pattern KICH > KIRC > KIRP; and UCEC had significantly higher ImTH scores than UCS, despite both being uterine cancers (Fig. 6C).

Fig. 6. ImTH scores varied among and within individual cancer types.

Fig. 6

A Comparing ImTH scores across 33 TCGA cancer types. B ImTH scores were significantly lower in GBM (the highest-grade glioma) than in LGG (lower-grade glioma). C The cancers originating in the same tissue or organ but from distinct cells or parts show noticeably distinct ImTH scores. D Spearman correlations of the rank of 33 TCGA cancer types based on the median ImTH score with the ranks based on the median ITH score, immune score, and BCR Shannon entropy. ITH, intratumor heterogeneity. E Comparison of the median absolute deviation (MAD) of ImTH scores across 33 TCGA cancer types.

We previously developed the DITHER algorithm to assess ITH based on somatic mutation and CNA profiles43. When ranking 33 TCGA cancer types by their median ITH scores, we found no significant correlation with the ranking by median ImTH scores (ρ = −0.262; P = 0.140) (Fig. 6D). This result suggests that ImTH captures distinct biological information compared to genetic ITH. Similarly, no significant correlations were observed between ImTH rankings and those based on immune score or BCR Shannon entropy (Fig. 6D).

To evaluate intra-cancer variability, we calculated the median absolute deviation (MAD) of ImTH scores for each cancer type. THYM displayed the lowest MAD, followed by PRAD (Fig. 6E). Among the five cancer types with the lowest MADs, most (THYM, PRAD, LGG, and THCA) are associated with relatively favorable prognoses, suggesting stable ImTH profiles may align with better clinical outcomes. In contrast, HNSC, MESO, SARC, LUSC, and BLCA exhibited the highest MADs, reflecting marked variability in ImTH. Notably, HNSC and LUSC are both squamous cell carcinomas, and SARC, despite having the third-highest MAD, also had the lowest median ImTH score.

Together, these findings highlight the heterogeneity of ImTH both across and within cancer types and reinforce that ImTH captures dimensions of tumor biology not reflected by genomic or conventional immune metrics.

Verification of ImTH scores in the CPTAC cohort

To test the reproducibility of our findings beyond TCGA, we analyzed an independent pan-cancer cohort from the Clinical Proteomic Tumor Analysis Consortium (CPTAC)44. Consistent with our earlier results, patients with high ImTH scores (top third) had significantly better OS and progression-free survival (PFS) compared to those with low scores (bottom third) across pan-cancer (Supplementary Fig. 7A). Moreover, ImTH scores were significantly higher in well-differentiated (G1) tumors than in moderately (G2) or poorly differentiated (G3) tumors, both pan-cancer and within individual cancer types such as KIRC, HNSC, and LUAD (P < 0.05) (Supplementary Fig. 7B).

We next compared protein expression profiles between high- and low-ImTH tumors in CPTAC pan-cancer. At a false discovery rate (FDR) < 0.05 and mean expression fold-change > 2, we identified 176 and 735 proteins upregulated in the high- and low-ImTH groups, respectively (Supplementary Fig. 7C and Supplementary Table 1). By inputting these proteins into clusterProfiler45, we identified overrepresented gene ontology biological process (GOBP) in each group (P < 0.05) (Supplementary Table 1). The pathways overrepresented in the high-ImTH group were mainly related to immune activation, spanning both innate (e.g., leukocyte degranulation) and adaptive immunity (e.g., lymphocyte-mediated immunity), alongside cytokine regulation and effector processes. In contrast, proteins enriched in the low-ImTH group were predominantly linked to neuronal signal transduction (Supplementary Fig. 7D).

These findings not only validate the robustness of the ImTH score in an independent cohort but also reinforce its biological relevance, demonstrating that high ImTH is associated with active antitumor immunity and favorable clinical outcomes.

ImTH score is a positive prognostic factor in cancer: single-cell data analysis

Unlike bulk RNA-seq, which requires computational deconvolution to infer immune cell composition, single-cell RNA sequencing (scRNA-seq) directly measures gene expression at single-cell resolution, enabling precise identification of immune cell subsets. Therefore, the ScImTH algorithm can calculate each tumor’s ImTH score based on the counts of annotated immune cell subsets. We analyzed six single-cell datasets covering five common cancer types: lung cancer, colorectal cancer (CRC), breast cancer (BRCA), kidney renal clear cell carcinoma (KIRC), and melanoma. In the lung cancer cohort46, metastatic tumors had significantly lower ImTH scores than primary tumors (P = 5.0 × 10−4), as exemplified by LT_S66 versus LT_S21 (Fig. 7A). Moreover, tumors responsive to targeted therapy exhibited higher ImTH scores than non-responsive tumors (P = 2.5 × 10−3) (Fig. 7A). These trends were corroborated in an independent lung cancer dataset (GSE13190747): (1) late-stage (stage III-IV) tumors exhibited significantly reduced ImTH scores than early-stage (stage I-II) tumors (P = 0.029); (2) metastatic deposits showed reduced ImTH scores compared to primary lesions (P = 6.5 × 10−4); and (3) poorly differentiated tumors demonstrated lower ImTH levels than moderately differentiated tumors (P = 7.0 × 10−3) (Fig. 7B).

Fig. 7. Single-cell data analysis supporting the ImTH score as a positive prognostic factor in cancer.

Fig. 7

A Analysis of the lung cancer single-cell dataset from Maynard et al. indicated that ImTH scores were remarkably lower in metastatic than in primary tumors, and in targeted-therapy-resistant than in targeted-therapy-responsive tumors. B Using lung cancer single-cell dataset GSE131907, ImTH scores were significantly lower in late-stage (stage III and IV) than in early-stage (stage I and II) tumors, in metastatic than in primary tumors, and in poorly-differentiated (PD) than in moderately-differentiated (MD) tumors. C Using colorectal cancer single-cell dataset (GSE178341), ImTH scores were significantly decreased in high-grade versus low-grade tumors, in large (size 3&4) versus small tumors (sizes 1 & 2), and in mismatch repair-deficient (MMRd) versus mismatch repair-proficient (MMRp) tumors. D Using BRCA single-cell cohort dataset (GSE114727), ImTH scores were lower in larger (>2 cm) than in smaller tumors (≤2 cm), and in metastatic than in primary tumors. E In the KIRC single-cell dataset from Krishna et al., proximal (Center, Near, Medial, and Lower Medial) tumors had significantly lower ImTH scores than distal (Far, Lateral, Lower, Lower Lateral, Supra Lateral, and Upper) tumors, which had lower ImTH scores than normal tissues. F In the melanoma single-cell cohort (GSE115978), metastatic tumors had lower ImTH scores than primary tumors, and immunotherapy-resistant tumors had lower ImTH scores than untreated tumors. The one-tailed Mann-Whitney U test P-values are presented.

In the CRC single-cell cohort (GSE17834148), we confirmed that the ImTH score is a positive prognostic factor. First, high-grade tumors exhibited reduced ImTH scores relative to low-grade tumors (P = 5.86 × 10−4) (Fig. 7C). Second, larger tumors (sizes 3 & 4) demonstrated markedly lower ImTH scores versus smaller tumors (size 1&2) (P = 7.12 × 10−3) (Fig. 7C). Finally, mismatch repair-proficient tumors exhibited higher ImTH scores than mismatch repair-deficient tumors (P = 3.50 × 10−4) (Fig. 7C).

For BRCA (GSE11472749), we observed significant associations between ImTH scores and clinicopathological features as well. Larger tumors (>2 cm) had significantly lower ImTH scores than smaller tumors (≤2 cm) (P = 1.68 × 10−3) (Fig. 7D). Metastatic lesions showed reduced ImTH scores versus primary tumors (P = 0.020) (Fig. 7D). In the KIRC single-cell dataset50, proximal tumors displayed lower ImTH scores than distal tumors (P = 0.02), which in turn showed lower ImTH scores than normal samples (P = 0.019) (Fig. 7E). Overall, tumor samples had significantly lower ImTH scores than normal counterparts (P = 6.32 × 10−5). In the melanoma cohort (GSE11597851), metastatic tumors again had reduced ImTH scores relative to primary tumors (P = 0.020), and immunotherapy-resistant tumors displayed significantly lower scores than untreated tumors (P = 0.011) (Fig. 7F).

Collectively, these single-cell analyses consistently demonstrate that reduced ImTH scores are associated with more aggressive clinical features, therapy resistance, and poorer prognosis across multiple cancer types, reinforcing the role of ImTH as a robust positive prognostic factor in cancer.

Spatial transcriptomics data analysis shows reduced ImTH scores in invasive cancer regions

Previous studies have demonstrated that the spatial organization of tumor microenvironment components contributes to intratumor heterogeneity and provides prognostic information46. To assess whether ImTH levels vary with spatial distribution, we analyzed a 10x Genomics Visium BRCA spatial transcriptomic dataset52 alongside a paired scRNA-seq dataset53. Using the CARD algorithm54, we deconvoluted the spatial transcriptomic profiles to infer cell type composition for each spot, followed by ScImTH to compute spot-specific ImTH scores (Fig. 8A). Pathologists annotated tissue regions based on H&E morphology into six categories: adipose tissue (cyan), breast glands (green), in situ cancer (orange), connective tissue (blue), immune infiltrate (yellow), and invasive cancer (red) (Fig. 8A). ImTH scores varied significantly across these segments (Kruskal-Wallis test, P = 3.46 × 10−6) (Fig. 8A). Strikingly, invasive cancer regions exhibited significantly lower ImTH scores than all other regions (Mann-Whitney U test, P < 0.01). The mean ImTH score followed the pattern: breast glands > immune infiltrate > cancer in situ > connective tissue > adipose tissue > invasive cancer (Fig. 8A). We validated this finding in an independent 10x Genomics Xenium BRCA dataset55, where invasive tumor regions again showed significantly lower ImTH scores than non-invasive ductal carcinoma in situ (DCIS1) regions (P = 6.0 × 10−4) (Fig. 8B).

Fig. 8. Spatial transcriptomics data demonstrate ImTH scores to be reduced in the invasive cancer location.

Fig. 8

A Deconvolution analysis of the 10x Genomics Visium BRCA spatial transcriptomic dataset to determine the immune cell type composition of each spot (left). Heatmap visualized ImTH scores for spots that varied across the six annotated segments in tissue sections, which were annotated based on hematoxylin and eosin (H&E) staining morphology (center); ImTH scores were noticeably lower in the invasive cancer versus the other segments (right). B Using the 10x Genomics Xenium BRCA spatial transcriptomic dataset (GSE243168), 19 cell types were annotated across tissue sections (left); spatial localization of eight immune cell subsets within the tissue (center); violin plots comparing ImTH scores of 150 µm² quadrats between DCIS1 (n = 147) and invasive tumor regions (n = 168) (right). The Kruskal-Wallis test P-value (P = 3.46 × 10−6) is shown in (A), and one-tailed Mann-Whitney U test P-values are presented in (A, B).

Together, these results demonstrate that ImTH levels are consistently downregulated in invasive tumor regions, suggesting that loss of immune diversity is spatially associated with tumor invasiveness.

Discussion

We developed ScImTH, an algorithm to quantify intratumor immune heterogeneity. ScImTH defines a tumor’s ImTH level as the Shannon entropy of the immune cell composition within the tumor microenvironment, thereby capturing both the diversity and evenness of immune cell distribution. Importantly, this measure is conceptually distinct from the canonical definition of tumor immune infiltration, which reflects the abundance of immune cells but not their heterogeneity. Compared with infiltration-based metrics such as the immune score, ScImTH demonstrated more consistent and stronger associations with clinicopathological features across both pan-cancer and individual tumor types. Our analyses revealed that reduced ImTH scores were consistently linked to unfavorable outcomes, including poor survival, tumor progression–related molecular and phenotypic characteristics, anti-tumor immunosuppression, and resistance to immunotherapy. Even within the same cancer type, aggressive subtypes (e.g., TNBC versus non-TNBC, KRAS-mutated versus KRAS-wildtype, TP53-mutated versus TP53-wildtype) showed significantly lower ImTH scores. Moreover, when compared with established immunotherapy biomarkers such as tumor mutational burden (TMB) and PD-L1 expression, the ImTH score exhibited a stronger association with treatment response and provided superior predictive capability.

PRAD and THCA, which have an overall more favorable prognosis than other TCGA cancer types, showed relatively high ImTH scores among 33 TCGA cancer types. However, previous studies18,19,21,43 have reported that PRAD and THCA display comparatively low ITH scores across cancers. In contrast, cancer types with relatively low ImTH scores, such as SARC, UCS, and SKCM, show high ITH scores43. These findings highlight the distinction between ImTH and ITH: ImTH captures intratumor heterogeneity among immune cells, whereas ITH reflects heterogeneity among tumor cells. Our analysis also suggests that ImTH levels are not strongly associated with overall tumor immune infiltration. For instance, SKCM (or melanoma), characterized by high TMB and elevated tumor immune infiltration, exhibits low ImTH levels but high ITH levels21.

Although previous studies have explored tumor immune heterogeneity and its association with tumor progression and therapeutic response13–16, few have provided a quantificational characterization of ImTH. Through comprehensive analyses of bulk, single-cell, and spatial transcriptomic data, our findings indicate that the ImTH score defined by our algorithm shows promise as a predictive biomarker for cancer prognosis and immunotherapy response. The data suggest that it may offer complementary value to, or potentially hold advantages over, established biomarkers such as TILs, MSI, TMB, and PD-L1 in certain contexts. However, further validation in larger prospective cohorts is warranted to confirm its relative clinical utility.

The ImTH score outperformed traditional immune infiltration metrics, including the immune score, in prognostic performance. Our analyses suggest that simple measures of immune cell abundance are insufficient to predict cancer prognosis or immunotherapy response. Instead, the heterogeneity of immune cells, capturing both the diversity and evenness of immune cell distribution within the tumor microenvironment, provides more powerful predictive insight. Importantly, our algorithm integrates information from all immune components without requiring prior knowledge of their functional roles, offering a holistic perspective particularly valuable given the complexity and context-dependence of immune cell functions in tumors. Spatial transcriptome analysis further revealed a progressive decline in ImTH scores from normal tissue to invasive cancer, suggesting that loss of immune diversity may be a hallmark of tumor progression. These findings are consistent with emerging evidence that immune exclusion and spatial compartmentalization critically influence therapeutic response56,57.

The clinical significance of ImTH scores lies in their ability to capture fundamental biological processes governing tumor-immune interactions. The marked decrease in ImTH scores in advanced tumors reflects a loss of immune diversity during tumor progression, a consequence of tumor cells “educating” the immune system to facilitate immune evasion and survival58. From an ecological perspective, higher immune diversity, indicated by elevated ImTH scores, likely corresponds to a more stable and therapeutically vulnerable tumor microenvironment59. This notion is further supported by the significantly lower ImTH observed in TP53-mutated tumors, which are characterized by genomic instability and a disrupted tumor microenvironment60.

Across multiple independent cohorts, high ImTH scores were consistently associated with improved immunotherapy outcomes, even surpassing established biomarkers such as TMB and PD-L1. The superior predictive value of ImTH for immunotherapy response may reflect that tumors with diverse immune infiltrates harbor broader T cell receptor repertoires and higher neoantigen burdens, both of which facilitate immune recognition61–63. Additionally, the enrichment of immune-activating pathways in high-ImTH tumors supports this interpretation, linking the score to the underlying biological mechanisms of immune recognition and tumor control.

The biological relevance of ImTH scores is further highlighted by their distinct associations with specific immune cell subsets. Low-ImTH tumors were characterized by myeloid-dominated, immune-restricted states, with elevated immunosuppressive macrophages (M0/M2), whereas high-ImTH tumors were enriched for immunologically active populations, including monocytes, dendritic cells, B cells, and CD8⁺ T cells. The co-occurrence of dendritic cells with CD8⁺ T cells in high-ImTH tumors suggests effective antigen presentation and T cell activation. Notably, elevated CD8⁺/PD-L1 ratios in high-ImTH tumors indicate that the ImTH score captures the critical balance between effector and regulatory immunity.

Our algorithm evaluates ImTH using transcriptomic data and is expected to have broad applicability given the growing availability of bulk, single-cell, and spatial datasets in cancer research. It is also computationally efficient, with low time and memory requirements, facilitating straightforward implementation. Nevertheless, this study has several limitations. First, the bulk analyses rely on immune deconvolution methods such as CIBERSORT, which, while informative, can vary depending on the algorithm, reference matrix, and parameter settings. These differences may affect absolute estimates of immune cell proportions and ImTH scores. However, because all bulk analyses were conducted using a consistent deconvolution framework, the comparative trends and conclusions are expected to be robust. Furthermore, the validation of these findings with single-cell and spatial transcriptomic data, which are not subject to deconvolution constraints, strengthens our confidence in the insights. Second, our immunotherapy cohort analysis provides preliminary observations, but the limited sample size necessitates cautious interpretation. Larger, independent cohorts will be needed to validate these findings and to fully assess the relationship between ImTH scores and therapeutic response across diverse patient populations. Lastly, additional experimental and clinical studies will be required to further validate the robustness and translational applicability of our method.

In conclusion, ScImTH provides an effective and computationally efficient method for quantifying intratumor immune heterogeneity, demonstrating significant clinical potential in predicting cancer prognosis and immunotherapy response. The ImTH score is poised to become a robust tool for capturing the dynamic evolution of tumor-immune ecosystems and a promising biomarker for immune surveillance in precision oncology. Moreover, our study supports a novel hypothesis that loss of immune diversity is a hallmark of cancer, warranting further mechanistic investigation. Future research should prioritize multimodal integration with emerging biomarkers to optimize models for cancer prognosis prediction and immunotherapy stratification.

Methods

The ScImTH algorithm for evaluating ImTH

For a given tumor sample, ScImTH first utilizes the CIBERSORT algorithm39 to deconvolute bulk transcriptome data and estimate the relative proportions of tumor-infiltrating immune cells. CIBERSORT was originally developed to profile 22 immune cell subtypes using a deconvolution approach39. To simplify analysis and improve interpretability and analytical robustness, ScImTH merges some of these 22 subtypes, resulting in 14 aggregated functionally coherent categories of immune subtypes: B cells (naive and memory B cells), CD8+ T cells, CD4+ T cells (naive, memory resting, and memory activated CD4+ T cells), NK cells (resting and activated NK cells), macrophages (M0, M1, and M2 macrophages), dendritic cells (resting and activated dendritic cells), mast cells (resting and activated mast cells), plasma cells, follicular helper T cells, regulatory T cells, gamma delta T cells, monocytes, eosinophils, and neutrophils. Using the proportions of these 14 immune cell types, ScImTH then calculates the tumor’s ImTH score as follows:

ImTH_score=−∑i=1npilog2pi 1

where n = 14 and pi denotes the proportion of the ith immune cell type, with the sum of all 14 immune cell proportions equal to 1. ScImTH can also be applied to single-cell and spatial transcriptomic data. For single-cell data, the proportion of each immune cell type is calculated as the number of cells of that type divided by the total number of immune cells in the tumor. For spatial transcriptomic data, ScImTH uses the proportions of immune cell types in each spot or segment as input. An overview of the ScImTH algorithm is shown in Fig. 1. The algorithm is implemented as an R package, which is publicly available at https://github.com/WangX-Lab/ScImTH and https://bioinfo.uth.edu/ScImTH.

Datasets

We obtained gene expression profiles (RSEM normalized) and clinical data for 33 TCGA cancer types from the UCSC Xena platform (https://xenabrowser.net/datapages/). These cancer types included adrenocortical carcinoma (ACC), bladder urothelial carcinoma (BLCA), breast invasive carcinoma (BRCA), cervical squamous cell carcinoma and endocervical adenocarcinoma (CESC), cholangiocarcinoma (CHOL), colon adenocarcinoma (COAD), lymphoid neoplasm diffuse large B-cell lymphoma (DLBC), esophageal carcinoma (ESCA), glioblastoma multiforme (GBM), head and neck squamous cell carcinoma (HNSC), kidney chromophobe (KICH), kidney renal clear cell carcinoma (KIRC), kidney renal papillary cell carcinoma (KIRP), acute myeloid leukemia (LAML), brain lower grade glioma (LGG), liver hepatocellular carcinoma (LIHC), lung adenocarcinoma (LUAD), lung squamous cell carcinoma (LUSC), mesothelioma (MESO), ovarian serous cystadenocarcinoma (OV), pancreatic adenocarcinoma (PAAD), pheochromocytoma and paraganglioma (PCPG), prostate adenocarcinoma (PRAD), rectum adenocarcinoma (READ), sarcoma (SARC), skin cutaneous melanoma (SKCM), stomach adenocarcinoma (STAD), testicular germ cell tumors (TGCT), thyroid carcinoma (THCA), thymoma (THYM), uterine corpus endometrial carcinoma (UCEC), uterine carcinosarcoma (UCS), and uveal melanoma (UVM). We also downloaded a large-scale breast cancer transcriptomic dataset (Metabric-BRCA33) from cBioPortal (www.cbioportal.org/). From CPTAC (https://pdc.cancer.gov/pdc/cptac-pancancer), we obtained normalized mRNA and protein expression data with clinical metadata for 10 cancer types: LUSC, OV, LUAD, PDAC (pancreatic ductal adenocarcinoma), UCEC, HNSC, COAD, BRCA, KIRC, and GBM. In addition, we downloaded four scRNA-seq datasets from NCBI GEO (https://www.ncbi.nlm.nih.gov/geo/), including GSE131907 (lung cancer)47, GSE114727 (breast cancer)49, GSE115978 (melanoma)51, and GSE178341 (CRC)48, all as gene expression (count) matrices. A lung cancer scRNA-seq dataset46 and a KIRC scRNA-seq dataset50 were also obtained from respective publications. We collected six immunotherapy-related datasets, including the TCGA pan-cancer cohort from Genomic Data Commons (https://portal.gdc.cancer.gov/) and four individual cancer cohorts (KIRC, BLCA, SKCM, and urothelial cancer) from GEO or published studies64–67. These datasets contained gene expression and clinical data for patients treated with immune checkpoint inhibitors. Finally, two processed spatial transcriptomics datasets for BRCA were obtained: a 10x Genomics Visium dataset52 with a matched scRNA-seq dataset53, and a 10x Genomics Xenium dataset (GSE24316855). A full summary of all datasets is provided in Supplementary Table 2.

Survival analysis

We used the Kaplan-Meier (KM) method68 to compare survival differences among patient groups, with KM curves plotted to visualize outcomes. The log-rank test was employed to assess the significance of survival differences. We implemented survival analysis using the survfit function from the survival R package. For multivariate survival analysis, we applied the Cox proportional hazards model to examine associations between ImTH scores and survival, adjusting for potential confounders such as tumor stage or grade (if stage information was unavailable), age, and immune score. Immune scores, representing the level of tumor-infiltrating immune cells, were estimated using the ESTIMATE algorithm23. We conducted multivariate survival analysis using the coxph function in the survival R package.

Evaluation of the variability of ImTH scores within individual cancer types

We assessed the variation of ImTH scores across tumors within each cancer type using the median absolute deviation (MAD). For a given cancer type, the MAD of ImTH scores was calculated as:

median(|ImTH_scorei-median(ImTH_scorei)|) 2

where ImTH_scorei represents the ImTH score of the ith tumor.

Logistic regression analysis

We used the logistic regression model with three predictors (TMB, PD-L1 expression, and ImTH score) to predict immunotherapy response (response versus non-response). All three predictors were continuous variables. We performed the logistic regression analysis with the glm R function in the R package stats.

scRNA-seq data analysis

We analyzed scRNA-seq data using Seurat (version 5.3.0)69, including data normalization, dimensionality reduction, and visualization. To be specific, we first normalized the count data using the NormalizeData and ScaleData functions, and then utilized functions RunPCA (npcs = 30) and RunTSNE for dimensionality reduction. The results were visualized using the DimPlot function with the parameter dims = 1:15.

Deconvolution of spatial transcriptomics data

We deconvolved a 10x Genomics Visium spatial transcriptomics dataset using the CARD algorithm54 to estimate cell-type proportions in each spot with a matched scRNA-seq dataset serving as the reference. We implemented the CARD algorithm using the R package CARD.

Xenium spatial transcriptomics data analysis

We analyzed one 10x Genomics Xenium spatial transcriptomics dataset (GSE24316855). The gene expression matrix was normalized using the SCTransform function in Seurat (version 5.3.0)69. Principal component analysis was performed on the normalized data, and the top 30 principal components were used for downstream analyses, including dimensionality reduction with UMAP and construction of the neighbor graph. Cell type identities were assigned according to the supervised annotation protocol described in the original publication55. In total, 19 cell types were identified, including DCIS1 cells, invasive tumor cells, and eight immune cell subsets: B cells, CD4+ T cells, CD8+ T cells, IRF7+ dendritic cells, LAMP3+ dendritic cells, two macrophage subtypes (M1 and M2), and mast cells. To calculate ImTH scores, we manually annotated DCIS1 and invasive tumor regions on the tissue map and randomly generated quadrats of 150 µm² within these regions, each containing approximately 100-200 cells.

Manual annotation workflow: Cell identities (Idents(xenium.obj)) in our Seurat object were assigned based on the original cell-type annotations from Janesick et al.55. Spots corresponding to clusters labeled “DCIS1” and “Invasive_Tumour” were extracted using the WhichCells() function, and their spatial coordinates were retrieved via GetTissueCoordinates(). These coordinates were converted into an sf object (st_as_sf(inv_coords, coords = c(“x”,“y”))). Using the selectFeatures(pts_sf, mode = “draw”) function, we manually delineated two polygonal regions: one corresponding to the DCIS1 tumor-cell compartment (purple, Fig. 8B) and the other to the invasive tumor compartment (ochre, Fig. 8B). No additional morphological or histopathological criteria were applied; region boundaries were defined solely by the spatial distribution of the selected spot coordinates. Polygons were constructed using the concaveman algorithm to enclose the selected spots, and each region was defined independently to ensure clear spatial separation between DCIS1 and invasive compartments.

Quadrat-level ImTH computation

For each quadrat, we calculated the proportions of eight immune cell subsets and applied the ScImTH algorithm to compute the ImTH score based on these proportions.

Rationale for quadrat size selection

The 150 µm² quadrat size was chosen to balance statistical robustness and spatial resolution. We aimed to generate approximately 100 quadrats per region to ensure adequate sampling given the available number of spots (DCIS1: n = 147; invasive tumor: n = 168). Smaller quadrats would yield many tiles with too few cells to compute stable ImTH scores, whereas larger quadrats would reduce spatial granularity. Additionally, because manually drawn tumor polygons often have irregular, non-rectangular shapes, excessively large quadrats would result in incomplete or partial tiling. The selected moderate size (150 µm²) allowed near-complete coverage of each annotated region with minimal gaps, providing a faithful representation of spatial heterogeneity across the tumor compartments.

Identification of differentially expressed proteins

To identify differentially expressed proteins between two classes of samples, we used two-tailed Student’s t tests with a threshold of adjusted P-value < 0.05 and fold change of mean expression levels > 2. The differentially expressed proteins consisted of upregulated and downregulated proteins in a class relative to another class.

Gene set enrichment analysis

We utilized the single-sample gene-set enrichment analysis (ssGSEA) algorithm22 to calculate the enrichment scores of gene modules in tumors based on their gene expression profiles. Gene modules represent specific pathways or biological processes, as listed in Supplementary Table 3. We implemented the ssGSEA algorithm with the R package GSVA. In addition, we used the clusterProfiler R package45 to identify significantly enriched GOBP70 from upregulated gene sets in specific tumor groups.

Statistical analysis

For non-normally distributed data, we used the one-tailed Mann-Whitney U test to compare two classes of samples and the Kruskal-Wallis test for more than two classes. For normally distributed data, we utilized two-tailed Student’s t tests for two classes and ANOVA for more than two classes. In addition, we utilized the Fisher’s exact test contingency table analyses. When evaluating correlations between ImTH scores and other variables, we adopted the Spearman method and reported correlation coefficients (ρ) and P-values. To adjust for multiple tests, we calculated the FDR using the Benjamini-Hochberg method71.

Supplementary information

Acknowledgements

Z.Z. was partially supported by National Institutes of Health grant R01LM012806. We thanked the technical support from the Cancer Prevention and Research Institute of Texas (CPRIT RP240610). The funders had no role in the study design, data collection and analysis, decision to publish, or preparation of the manuscript.

Author contributions

Q.L.: Software, Data curation, Formal analysis, Investigation, Visualization, Writing - original draft. J.L.: Software, Data curation, Formal analysis, Investigation, Visualization. C.H.T.: Formal analysis, Investigation, Visualization. X.W.: Conceptualization, Methodology, Formal analysis, Investigation, Visualization, Writing - original draft, Supervision, Project administration. Z.Z.: Conceptualization, Methodology, Writing - review & editing, Funding acquisition.

Data availability

All data associated with this study are available within the paper and its Supplementary data. The ImTH R package is publicly available for download and installation in the GitHub repository (https://github.com/WangX-Lab/ScImTH) and the website: https://bioinfo.uth.edu/ScImTH.

Competing interests

The authors declare no competing interests.

Footnotes

Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

These authors contributed equally: Qiqi Lu, Jiangti Luo.

Contributor Information

Xiaosheng Wang, Email: xiaosheng.wang@uth.tmc.edu.

Zhongming Zhao, Email: zhongming.zhao@uth.tmc.edu.

Supplementary information

The online version contains supplementary material available at 10.1038/s41698-025-01223-x.

References

  • 1.Fridman, W. H. et al. The immune contexture in cancer prognosis and treatment. Nat. Rev. Clin. Oncol.14, 717–734 (2017). [DOI] [PubMed] [Google Scholar]
  • 2.Wu, B. et al. Cold and hot tumors: from molecular mechanisms to targeted therapy. Signal Transduct. Target Ther.9, 274 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 3.Brummel, K. et al. Tumour-infiltrating lymphocytes: from prognosis to treatment selection. Br. J. Cancer128, 451–458 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 4.Leon-Ferre, R. A. et al. Tumor-infiltrating lymphocytes in triple-negative breast cancer. JAMA331, 1135–1144 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 5.Rosa, M. L. et al. Implications of tumor-infiltrating lymphocytes in early-stage triple-negative breast cancer: clinical oncologist perspectives. Transl. Breast Cancer Res5, 4 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 6.Fu, Q. et al. Prognostic value of tumor-infiltrating lymphocytes in melanoma: a systematic review and meta-analysis. Oncoimmunology8, 1593806 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 7.Bida, M. et al. Tumor-infiltrating lymphocytes in melanoma: from prognostic assessment to therapeutic applications. Front Immunol.15, 1497522 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 8.Gataa, I. et al. Tumour-infiltrating lymphocyte density is associated with favourable outcome in patients with advanced non-small cell lung cancer treated with immunotherapy. Eur. J. Cancer145, 221–229 (2021). [DOI] [PubMed] [Google Scholar]
  • 9.Feng, Q. et al. Immunological classification of gliomas based on immunogenomic profiling. J. Neuroinflamm.17, 360 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 10.Braun, D. A. et al. Progressive immune dysfunction with advancing disease stage in renal cell carcinoma. Cancer Cell39, 632–648.e8 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 11.Chen, C., Luo, J. & Wang, X. Identification of prostate cancer subtypes based on immune signature scores in bulk and single-cell transcriptomes. Med Oncol.39, 123 (2022). [DOI] [PubMed] [Google Scholar]
  • 12.Lei, X. et al. Immune cells within the tumor microenvironment: Biological functions and roles in cancer immunotherapy. Cancer Lett.470, 126–133 (2020). [DOI] [PubMed] [Google Scholar]
  • 13.Nguyen, P. H. D. et al. Intratumoural immune heterogeneity as a hallmark of tumour evolution and progression in hepatocellular carcinoma. Nat. Commun.12, 227 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 14.Jimenez-Sanchez, A. et al. Unraveling tumor-immune heterogeneity in advanced ovarian cancer uncovers immunogenic effect of chemotherapy. Nat. Genet52, 582–593 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 15.Nabet, B. Y. et al. Immune heterogeneity in small-cell lung cancer and vulnerability to immune checkpoint blockade. Cancer Cell42, 429–443.e4 (2024). [DOI] [PubMed] [Google Scholar]
  • 16.Francisco-Cruz, A. et al. Analysis of Immune Intratumor Heterogeneity Highlights Immunoregulatory and Coinhibitory Lymphocytes as Hallmarks of Recurrence in Stage I Non-Small Cell Lung Cancer. Mod. Pathol.36, 100028 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 17.Caswell, D. R. & Swanton, C. The role of tumour heterogeneity and clonal cooperativity in metastasis, immune evasion and clinical outcome. BMC Med15, 133 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 18.Deshwar, A.G. et al. PhyloWGS: Reconstructing subclonal composition and evolution from whole-genome sequencing of tumors. Genome Biol.16, 35 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 19.Andor, N. et al. EXPANDS: expanding ploidy and allele frequency on nested subpopulations. Bioinformatics30, 50–60 (2014). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 20.Mroz, E. A. & Rocco, J. W. MATH, a novel measure of intratumor genetic heterogeneity, is high in poor-outcome classes of head and neck squamous cell carcinoma. Oral. Oncol.49, 211–215 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 21.Li, M. et al. An algorithm to quantify intratumor heterogeneity based on alterations of gene expression profiles. Commun. Biol.3, 505 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 22.Hanzelmann, S., Castelo, R. & Guinney, J. GSVA: gene set variation analysis for microarray and RNA-seq data. BMC Bioinforma.14, 7 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 23.Yoshihara, K. et al. Inferring tumour purity and stromal and immune cell admixture from expression data. Nat. Commun.4, 2612 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 24.Sayaman, R. W. et al. Germline genetic contribution to the immune landscape of cancer. Immunity54, 367–386.e8 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 25.Zhang, L. et al. Long-term Sculpting of the B-cell Repertoire following Cancer Immunotherapy in Patients Treated with Sipuleucel-T. Cancer Immunol. Res8, 1496–1507 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 26.Ho, W. J., Jaffee, E. M. & Zheng, L. The tumour microenvironment in pancreatic cancer - clinical challenges and opportunities. Nat. Rev. Clin. Oncol.17, 527–540 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 27.Hanahan, D. & Weinberg, R. A. Hallmarks of cancer: the next generation. Cell144, 646–674 (2011). [DOI] [PubMed] [Google Scholar]
  • 28.Miranda, A. et al. Cancer stemness, intratumoral heterogeneity, and immune response across cancers. Proc. Natl. Acad. Sci. USA116, 9020–9029 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 29.Liu, Z. L. et al. Angiogenic signaling pathways and anti-angiogenic therapy for cancer. Signal Transduct. Target Ther.8, 198 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 30.Dongre, A. & Weinberg, R. A. New insights into the mechanisms of epithelial-mesenchymal transition and implications for cancer. Nat. Rev. Mol. Cell Biol.20, 69–84 (2019). [DOI] [PubMed] [Google Scholar]
  • 31.Afifi, N. & Barrero, C. A. Understanding breast cancer aggressiveness and its implications in diagnosis and treatment. J. Clin. Med.12, 1375 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 32.Cancer Genome Atlas, N. Comprehensive molecular portraits of human breast tumours. Nature490, 61–70 (2012). [DOI] [PMC free article] [PubMed]
  • 33.Curtis, C. et al. The genomic and transcriptomic architecture of 2000 breast tumours reveals novel subgroups. Nature486, 346–352 (2012). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 34.Liu, Z. et al. A Comprehensive Immunologic Portrait of Triple-Negative Breast Cancer. Transl. Oncol.11, 311–329 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 35.Johnson, C., Burkhart, D. L. & Haigis, K. M. Classification of KRAS-Activating Mutations and the Implications for Therapeutic Intervention. Cancer Discov.12, 913–923 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 36.Wang, X. & Sun, Q. TP53 mutations, expression and interaction networks in human cancers. Oncotarget8, 624–643 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 37.Ostroff, J. S. et al. Current Practices, Perceived Barriers, and Promising Implementation Strategies for Improving Quality of Smoking Cessation Support in Accredited Cancer Programs of the American College of Surgeons. JCO Oncol. Pr.20, 212–219 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 38.Thorsson, V. et al. The Immune Landscape of Cancer. Immunity48, 812–830.e14 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 39.Newman, A. M. et al. Robust enumeration of cell subsets from tissue expression profiles. Nat. Methods12, 453–457 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 40.Goodman, A. M. et al. Tumor Mutational Burden as an Independent Predictor of Response to Immunotherapy in Diverse Cancers. Mol. Cancer Ther.16, 2598–2608 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 41.Patel, S. P. & Kurzrock, R. PD-L1 Expression as a Predictive Biomarker in Cancer Immunotherapy. Mol. Cancer Ther.14, 847–856 (2015). [DOI] [PubMed] [Google Scholar]
  • 42.Feng, Q. S. et al. Immunological classification of gliomas based on immunogenomic profiling. J. Neuroinflamm.17, 360 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 43.Li, L., Chen, C. P. & Wang, X. S. DITHER: an algorithm for Defining IntraTumor Heterogeneity based on EntRopy. Brief. Bioinform.22, bbab202 (2021). [DOI] [PubMed] [Google Scholar]
  • 44.Edwards, N. J. et al. The CPTAC Data Portal: A Resource for Cancer Proteomics Research. J. Proteome Res14, 2707–2713 (2015). [DOI] [PubMed] [Google Scholar]
  • 45.Yu, G. C. et al. clusterProfiler: an R Package for Comparing Biological Themes Among Gene Clusters. Omics-a J. Integr. Biol.16, 284–287 (2012). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 46.Maynard, A. et al. Therapy-Induced Evolution of Human Lung Cancer Revealed by Single-Cell RNA Sequencing. Cell182, 1232–1251.e22 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 47.Kim, N. et al. Single-cell RNA sequencing demonstrates the molecular and cellular reprogramming of metastatic lung adenocarcinoma. Nat. Commun.11, 2285 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 48.Pelka, K. et al. Spatially organized multicellular immune hubs in human colorectal cancer. Cell184, 4734–4752.e20 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 49.Azizi, E. et al. Single-Cell Map of Diverse Immune Phenotypes in the Breast Tumor Microenvironment. Cell174, 1293–1308.e36 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 50.Krishna, C. et al. Single-cell sequencing links multiregional immune landscapes and tissue-resident T cells in ccRCC to tumor topology and therapy efficacy. Cancer Cell39, 662–677.e6 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 51.Jerby-Arnon, L. et al. A Cancer Cell Program Promotes T Cell Exclusion and Resistance to Checkpoint Blockade. Cell175, 984 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 52.Andersson, A. et al. Spatial deconvolution of HER2-positive breast cancer delineates tumor-associated cell type interactions. Nat. Commun.12, 6021 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 53.Wu, S. Z. et al. A single-cell and spatially resolved atlas of human breast cancers. Nat. Genet.53, 1334–1347 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 54.Ma, Y. & Zhou, X. Spatially informed cell-type deconvolution for spatial transcriptomics. Nat. Biotechnol.40, 1349–1359 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 55.Janesick, A. et al. High resolution mapping of the tumor microenvironment using integrated single-cell, spatial and in situ analysis. Nat. Commun.14, 8353 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 56.Di Mauro, F. & Arbore, G. Spatial Dissection of the Immune Landscape of Solid Tumors to Advance Precision Medicine. Cancer Immunol. Res.12, 800–813 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 57.Hammerl, D. et al. Spatial immunophenotypes predict response to anti-PD1 treatment and capture distinct paths of T cell evasion in triple negative breast cancer. Nat. Commun.12, 5668 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 58.Gonzalez, H., Hagerling, C. & Werb, Z. Roles of the immune system in cancer: from tumor initiation to metastatic progression. Genes Dev.32, 1267–1284 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 59.Tanaka, M. et al. Tumor cell heterogeneity drives spatial organization of the intratumoral immune response. J. Exp. Med.222, e20242282 (2025). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 60.Wang, H. et al. Targeting p53 pathways: mechanisms, structures, and advances in therapy. Signal Transduct. Target Ther.8, 92 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 61.Altan, M. et al. High peripheral T cell diversity is associated with lower risk of toxicity and superior response to dual immune checkpoint inhibitor therapy in patients with metastatic NSCLC. J. Immunother. Cancer12, e008950 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 62.Öjlert, ÅK. et al. Dynamic changes in the T cell receptor repertoire during treatment with radiotherapy combined with an immune checkpoint inhibitor. Mol. Oncol.15, 2958–2968 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 63.Pilard, C. et al. Cancer immunotherapy: it’s time to better predict patients’ response. Br. J. Cancer125, 927–938 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 64.Braun, D. A. et al. Interplay of somatic alterations and immune infiltration modulates response to PD-1 blockade in advanced clear cell renal cell carcinoma. Nat. Med26, 909–918 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 65.Snyder, A. et al. Contribution of systemic and somatic factors to clinical response and resistance to PD-L1 blockade in urothelial cancer: An exploratory multi-omic analysis. PLoS Med14, e1002309 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 66.Gide, T. N. et al. Distinct Immune Cell Populations Define Response to Anti-PD-1 Monotherapy and Anti-PD-1/Anti-CTLA-4 Combined Therapy. Cancer Cell35, 238–255.e6 (2019). [DOI] [PubMed] [Google Scholar]
  • 67.Mariathasan, S. et al. TGFbeta attenuates tumour response to PD-L1 blockade by contributing to exclusion of T cells. Nature554, 544–548 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 68.Bland, J. M. & Altman, D. G. Statistics notes - Survival probabilities (the Kaplan-Meier method). Br. Med. J.317, 1572–1572 (1998). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 69.Hao, Y. H. et al. Dictionary learning for integrative, multimodal and scalable single-cell analysis. Nat. Biotechnol.42, 293–304 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 70.Ashburner, M. et al. Gene Ontology: tool for the unification of biology. Nat. Genet.25, 25–29 (2000). [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 71.Benjamini, Y. & Hochberg, Y. Controlling the false discovery rate: a practical and powerful approach to multiple testing. J. R. Stat. Soc. B57, 289–300 (1995). [Google Scholar]

Associated Data

This section collects any data citations, data availability statements, or supplementary materials included in this article.

Supplementary Materials

Data Availability Statement

All data associated with this study are available within the paper and its Supplementary data. The ImTH R package is publicly available for download and installation in the GitHub repository (https://github.com/WangX-Lab/ScImTH) and the website: https://bioinfo.uth.edu/ScImTH.


Articles from NPJ Precision Oncology are provided here courtesy of Nature Publishing Group

RESOURCES