Introduction

Thyroid cancer (THCA) is the most common endocrine malignant tumor1, and its incidence rate has been rising steadily over the past few decades2,3. According to the data released by the National Cancer Center, the incidence rate of THCA in China ranks first, with the overall incidence rate accounting for seventh place among malignant tumors and fourth place among women4. The most common pathological type of thyroid cancer is papillary thyroid carcinoma (PTC), accounting for approximately 85–90% of the total incidence5,6. Most PTC patients exhibit a clinical process similar to that of benign tumors, with a low risk of death and recurrence and long-term survival. Therefore, scholars increasingly recommend adopting relatively conservative treatment measures for these low-risk PTC patients to avoid iatrogenically induced adverse reactions caused by excessive procedures, as well as creating unnecessary medical and psychological burdens on patients. However, there is currently no consensus as to how to more accurately determine low-risk PTC7,8.

As for high-risk PTC, traditional treatment methods do not fully improve the prognosis of patients, which requires finding highly sensitive therapies such as immunotherapy9. Immunotherapy is a treatment modality that enhances the function of immune cells in the tumor microenvironment (TME) to achieve the goal of eliminating tumors. Compared with traditional treatments, tumor immunotherapy manifests advantages such as immune memory and no side effects. Our understanding of the TME has gradually increased in recent years. There are infiltrating immune cells in a variety of solid tumor tissues such as lung and breast cancer, and the type of infiltrating immune cells shows a strong correlation with the clinical characteristics of these solid tumors10,11. Immune cells are widely distributed in the microenvironment of thyroid cancer, forming different TMEs at different stages of tumor development that promote or inhibit tumor occurrence and development. Previous studies have shown that Tregs, neutrophils, dendritic cells, and tumor-associated macrophages (TAMs) play a tumorigenic role in the PTC microenvironment, while CD8+ T cells, B cells, and NK cells portray a protective role12,13,14. Similarly, immune genes can also be used to predict the prognosis of PTC patients and may serve as therapeutic targets15,16. Therefore, understanding the positions of immune cells and immune genes in the PTC microenvironment is particularly important. However, the roles of some major immune cells and immune genes in PTC remain controversial, and further systematic research on the TME of PTC is needed. Thus, accurately evaluating the specific patterns of immune cells in PTC—including not only their phenotype but also their function—is crucial for the subsequent development of immune research and novel diagnostic and therapeutic strategies.

In this investigation, we downloaded transcriptomic RNA-seq data and clinically related data from the cancer genome atlas (TCGA) database for papillary thyroid carcinoma. Through a series of bioinformatics analyses, we identified some immune cells and immune genes that appeared critical to the clinical progression of PTC. Using these data, we identified several key features of high- and low-risk PTC and attempted to identify factors that affected high-risk PTC, potentially facilitating future immunotherapy.

Results

Infiltration of immune cells in the PTC microenvironment

We used the CIBERSORT algorithm to analyze the infiltration of 22 immune cell types in the TCGA papillary thyroid carcinoma dataset. Total T cells constituted the highest proportion among various infiltrating immune cells, accounting for over 35% (Fig. 1A). Of these, resting CD4+ memory T cells accounted for the greatest proportion, approximately 14.8% (Fig. 1B). The proportion of total macrophages in various infiltrating immune cells was also high, exceeding 34% (Fig. 1A), with M0 macrophages accounting for the highest proportion, approximately 18.1% (Fig. 1C). In addition, M0 macrophages exhibited the highest infiltration rate among the 22 types of immune cells. Among other immune cells, naive B cells, resting dendritic cells, resting mast cells, plasma cells, and activated NK cells also occupied greater proportions of infiltrating cells (Fig. 1D, E).

Figure 1
figure 1

The proportions of infiltrating cells by 22 immune cell types in PTC tissues. (A) The composite pie chart shows the percentages of infiltrating cells by total T cells, total macrophages, total B cells, total NK cells, and other cells in PTC. (B) The percentages of various infiltrating T cells in PTC. (C) The percentages of infiltration by M0, M1, and M2 macrophages in PTC. (D) The percentages of infiltration by activated B cells, resting B cells, activated NK cells, and resting NK cells in PTC. (E) The percentages of infiltration by various other cell types in PTC.

The percentage bar chart and heatmap show that there was a significant difference in the proportion of immune cells between tumor tissues and normal tissues in the dataset (Fig. 2A, B). The percentage bar chart depicts the infiltration rate of B cells in the tumor tissues on the right as significantly lower than that in the normal tissues on the left, while the infiltration rate of macrophages was more significant in the tumor tissues; the heatmap readily conveys that it was easier to detect differences in the infiltration of various immune cells. Compared with normal tissues, the infiltrating proportions of M0 macrophages, M2 macrophages, resting dendritic cells, and resting mast cells in tumor tissues were significantly augmented, while the infiltrating proportions of naive B cells and CD8+ T cells in tumor tissues were significantly attenuated.

Figure 2
figure 2

Differential distribution of 22 types of immune cells in PTC tissues and normal tissues. (A) Percentage bar chart shows the proportions of 22 types of immune cells. (B) Heatmap shows the infiltration by 22 types of immune cells in PTC tissues and normal tissues; green represents low infiltration, black represents moderate infiltration, and red represents high infiltration. (C) The violin diagram shows the differences in the infiltration ratios of 22 types of immune cells in PTC tissues and normal tissues, with blue indicating normal tissues and red indicating PTC tissues.

Our violin plot shows that compared with normal tissues, tumor tissues contained more M0 macrophages, M2 macrophages, resting dendritic cells, activated dendritic cells, and resting mast cells (Fig. 2C). However, proportions of naive B cells, memory B cells, CD8+ T cells, follicular helper T cells, M1 macrophages, activated mast cells, and eosinophils were relatively lower in tumor tissue (Fig. 2C) (Table 1 depicts detailed results).

Table 1 Differential distribution of 22 types of immune cells in PTC tissues and normal tissues.

We subsequently explored the correlation between infiltrating immune cells, and our correlation heatmap showed a weak-to-strong correlation between the infiltration ratios of 22 immune cell types in tumor tissues (Fig. 3). Naive CD4+ T cells and activated mast cells showed the strongest positive correlation (Pearson correlation = 0.41), whereas CD8+ T cells and M0 macrophages showed the strongest negative correlation (Pearson correlation =  − 0.57).

Figure 3
figure 3

Correlation analysis of 22 types of immune cells in PTC tissues. The correlation heatmap depicts the correlation between immune cells, with red representing a positive correlation and blue representing a negative correlation.

In summary, these results indicated differences in the proportions of various immune cells infiltrating the PTC microenvironment, with a close relationship existing between them.

The role of immune cells in the progression and prognosis of PTC

To clarify the role of the infiltration of different immune cells in the progression of PTC and their relationship with prognosis, we analyzed the samples in the dataset to investigate whether there was a correlation between specific immune cells and overall survival (OS) or other clinical characteristics of PTC patients. Via our analysis, we revealed for the first time ever a relationship between different immune cells and TNM staging (Fig. 4), demonstrating that the proportions of monocytes and neutrophils diminished with the increase in T staging. The proportions of activated dendritic cells, resting dendritic cells, neutrophils, and resting CD4+ memory T cells increased with the increase in N staging, while the proportion of CD8+ T cells fell with the increase in N staging. Neutrophils were the only immune cell class closely related to M staging, and we noted that the proportion of infiltrating neutrophils in the metastasized PTC tissue was significantly elevated. The combination of the three indicators of T, N, and M is designated TNM staging, and in PTC, the proportions of activated dendritic cells, resting dendritic cells, M0 macrophages, M2 macrophages, resting mast cells, and monocytes rose with the increase in TNM staging. By contrast, the proportions of M1 macrophages, plasma cells, CD8+ T cells, and follicular helper T cells fell with increasing TNM staging. After limiting the CIBERSORT screening to p < 0.05, we were able to retrieve OS data from 233 patients and discerned that activated NK cells and γδT cells constituted an independent prognostic factor for PTC patients (Fig. 5A, B). Activated NK cells were associated with a better prognosis, while γδT cells were associated with a poorer prognosis.

Figure 4
figure 4

Correlation analysis between immune cells and TNM staging. (A,B) The correlation analysis of monocytes and neutrophils with T staging, respectively (T1 & T2 shows that the tumor was limited to the thyroid gland and that its diameter was not greater than 4 cm; T3 & T4 depict tumor growth in the thyroid gland with a diameter greater than 4 cm or infiltration outside the thyroid gland). (CG) The correlation analysis between activated dendritic cells, resting dendritic cells, neutrophils, resting CD4+ memory T cells, and CD8+ T cells with N staging, respectively (N0 represents no lymph node metastasis, and N1 represents lymph node metastasis). (H) illustrates the correlation analysis between neutrophils and M staging (M0 represents no distant metastasis, M1 represents distant metastasis). (IR) The correlation analysis of activated dendritic cells, resting dendritic cells, M0 macrophages, M2 macrophages, resting mast cells, monocytes, M1 macrophages, plasma cells, CD8+ T cells, and follicular helper T cells with TNM staging, respectively.

Figure 5
figure 5

Correlation analysis between immune cells and prognosis of PTC patients, as well as screening and enrichment analysis of immune-related DEGs. (A,B) The correlation analysis of activated NK cells and γδT cells with prognosis, respectively. (C) Volcano map showing the distribution of DEGs, with red indicating upregulated genes and green indicating downregulated genes. (D) KEGG-enrichment analysis. (E) Volcano map showing the distribution of immune-related DEGs, with red indicating upregulated genes and green indicating downregulated genes. (F) GO-enrichment analysis.

From the above data, we concluded that the infiltration of multiple immune cells was closely related to the clinical progress of PTC patients and that the infiltration of activated NK cells and γδT cells affected the prognosis of patients.

Functional enrichment analysis of immune-related differentially expressed genes

To further confirm the role of immune cell infiltration in the onset and development of PTC, we conducted differential expression analysis on the dataset and obtained differentially expressed genes (DEGs). We screened 2691 DEGs from the dataset, including 1467 upregulated genes and 1224 downregulated genes (Fig. 5C). We then intersected the obtained DEGs with immune genes to obtain immune-related DEGs and screened 271 immune-related DEGs from the dataset, including 155 upregulated genes and 116 downregulated genes (Fig. 5E). GO- and KEGG-enrichment analyses were conducted on immune-related DEGs, and our results showed that GO enrichment mainly involved pathways such as “cell surface receptor signaling pathway,” “receptor binding,” “defense response,” “immune response,” and “cytokine receptor binding” (Fig. 5D). KEGG-enrichment analysis revealed that these genes mainly participated in “interactions between cytokines and cytokine receptors,” “T cell receptor signaling pathway,” “MAPK signaling pathway,” and “Jak-STAT signaling pathway”17 (Fig. 5F).

To examine the interactions between immune-related DEGs, we constructed a protein–protein interaction (PPI) network with 231 nodes and 1672 edges using the STRING database and Cytoscape software. In addition, MCODE analysis was conducted, and we found that there was only one module with more than 20 nodes; this module contained 23 nodes and 237 edges (Fig. 6A). Using the PPI network, we identified that 10 key genes (CXCL5, CD40LG, CXCL12, CD8A, IL6, PTPRC, ICAM1, CSF2, CCL19, and CCL17) were highly correlated with other nodes, and we considered these for further analysis (Fig. 6B).

Figure 6
figure 6

Screening of key genes and correlation analysis between TNM staging and prognosis. (A) The major module in the PPI network. (B) The 10 key genes in the major module. (CF) The correlation analysis between CD40LG and TNM staging. (G) The correlation analysis between CD40LG and prognosis of PTC patients. (H) Using the TIMER database to analyze the expression of CD40LG in tumors, THCA represents thyroid cancer, red represents tumor tissue, and blue represents normal tissue (statistical significance: *p < 0.05, **p < 0.01, ***p < 0.001).

The relationship between immune-related DEGs and the progression and prognosis of PTC

To further clarify the role of key genes in the PTC microenvironment, we conducted a joint analysis with TNM staging. Our results showed that the expression levels of CCL17 (Supplementary Fig. 1A), CSF2 (Supplementary Fig. 1D), CXCL5 (Supplementary Fig. 1E), and ICAM1 (Supplementary Fig. 1G) increased with the increase in T staging, while the expression levels of CXCL12 (Supplementary Fig. 1F) decreased. CCL17 (Supplementary Fig. 2A), CCL19 (Supplementary Fig. 2B), CSF2 (Supplementary Fig. 2D), CXCL5 (Supplementary Fig. 2E), ICAM1 (Supplementary Fig. 2G), IL6 (Supplementary Fig. 2H), PTPRC (Supplementary Fig. 2I), and CD40LG (Fig. 6D) were closely related to N staging, and their expression levels all rose with the increase in N staging, while the expression levels of CCL19 (Supplementary Fig. 3B) and CXCL5 (Supplementary Fig. 3E) fell with the increase in M staging. We found CCL17 (Supplementary Fig. 4A), CCL19 (Supplementary Fig. 4B), CSF2 (Supplementary Fig. 4D), CXCL5 (Supplementary Fig. 4E), and ICAM1 (Supplementary Fig. 4G) to be closely related to TNM staging, and their expression levels all increased concomitantly with the increase in TNM staging. However, we found no statistically significant correlation between CD40LG and T staging (Fig. 6C), M staging (Fig. 6E), and TNM staging (Fig. 6F) in our analysis. Finally, we conducted survival analysis on key genes and demonstrated that the CD40LG gene was closely related to the prognosis of PTC patients and that its expression was positively correlated with patient survival (Fig. 6G). Subsequently, we analyzed CD40LG using the TIMER database and found that it was expressed in various tumors and that the expression of CD40LG was significantly lower in THCA tissues than in normal tissues—indicating that CD40LG may be an inhibitory gene with respect to THCA (Fig. 6H).

Discussion

The TME is composed of tumor cells and their surrounding immune cells, inflammatory cytokines, fibroblasts, glial cells, intercellular matrix, and tumor microvasculature within nearby areas18. An increasing number of studies have shown that the TME is important in tumor development, proliferation, invasion, and other processes19. Of these, the infiltration of immune cells in the TME is closely related to the development and prognosis of tumors, and these cells are important participants in tumor immune editing. Immune cells provide monitoring and exert anti-tumor effects in the early stages of tumor formation, as well as assist tumor cells in immune escape during tumor progression. When we analyzed the infiltration of 22 immune cell types in the TME and their relationship to clinical characteristics and the OS of PTC patients using the TCGA dataset, we found that among all infiltrating immune cells, M0 macrophages accounted for 18.1%, M2 macrophages for 11.6%, resting CD4+ memory T cells for 14.8%, and CD8+ T cells for 11.3%.

The most common immune cells in the TME are the macrophages, and they are classified into M0, M1, and M2 types based on their phenotype and function. Among them, the M0 macrophages are immature macrophages in an inactive state, and when activated by M1- or M2-specific signals, they become activated M1 or M2 macrophages. M1 macrophages exert pro-inflammatory effects that can activate immune responses and prevent tumor progression, while M2 macrophages exhibit completely opposite pro-tumor functions; both macrophage types thus affect the development of tumors20. Behnes et al. found that M2 macrophages exhibit high infiltration in renal papillary carcinoma and are closely related to tumor progression and metastasis21. Zhang et al. also showed that stimulating the differentiation of M0 macrophages into M2 macrophages in ovarian cancer cells promoted tumor proliferation and migration22. In previous studies, macrophages that infiltrated into PTC were shown to be principally of the M2 type and primarily involved in the dedifferentiation of thyroid tumor cells and the process of tumor immune escape13,23—similar to some of the results of the present study. In our study, the ratio of infiltrating M0 to M2 macrophages in tumor tissue was significantly higher than that in normal tissue and was positively correlated with TNM staging; by contrast, the infiltration rate of M1 macrophages in tumor tissue was lower than that in normal tissue and was negatively correlated with TNM staging. We infer that patients with a high proportion of infiltrating M1 macrophages are likely to be designated with low-risk PTC, while patients with a high proportion of M0 and M2 macrophages are more likely to be high-risk PTC. Intriguingly, we also ascertained that macrophages in the PTC microenvironment were closely related to other immune cells. M1 macrophages were significantly positively correlated with the infiltration of CD8+ T cells and follicular helper T cells, while M2 macrophages were significantly negatively correlated with the infiltration of CD8+ T cells and follicular helper T cells. We may therefore be able to influence the infiltration ratio of M1 and M2 macrophages in PTC by regulating the infiltration ratio of CD8+ T cells and follicular helper T cells, providing novel approaches for further exploring immunotherapeutic modes for PTC patients.

Lymphocytes are important members of immune cells in the TME. CD4+ memory T cells are a subset of antigen-specific CD4+ T cells that persist after the expansion, contraction, and memory stages of primary T cell responses24,25,26. Upon heightened memory after secondary antigen stimulation, CD4+ T cells multiply and develop into specialized CD4+ T cell subsets that are specific to pathogens27,28. For example, the infiltration of activated CD4+ memory T cells in colorectal cancer tissue is significantly higher than in normal tissue29. The tumor antigens presented by MHC I molecules can be effectively recognized by CD8+ T cells, promoting CD8+ T cell infiltration of tumor tissue and their participation in the tumor immune cycle, thus exerting anti-tumor effects30,31,32. Chatzopoulos et al. demonstrated that high levels of CD8+ T cells augured for a good prognosis in laryngeal squamous cell carcinoma33. CD8+ T cell expression was also uncovered in breast cancer as an independent factor that affected clinical stage and prognosis34. In the present study, we observed that the infiltration ratio of CD4+ memory T cells to CD8+ T cells in tumor tissue was lower than that in normal tissue, and that the infiltration of resting CD4+ memory T cells was positively correlated with lymph node metastasis, while the infiltration of CD8+ T cells was negatively correlated with lymph node metastasis and TNM staging. Our analysis additionally showed that the infiltration of γδT cells predicted a poor prognosis in patients. These studies may indicate that the higher infiltration ratio of CD4+ memory T cells to CD8+ T cells in tumor tissue reflected low-risk PTC, while a ratio with higher γδT cell infiltration denoted high-risk PTC. Therefore, therapy targeting γδT cells has the potential to become a novel approach for refractory thyroid cancer. Immune cell correlation analysis showed a positive correlation between T cells and anti-tumor immune cells (e.g., M1 macrophages) and a negative correlation with tumor-promoting immune cells (e.g., M2 macrophages and dendritic cells). B cells are also an important component of the infiltrating lymphocytes in the TME. The function of B cells is not only to induce humoral immune responses but also to recognize antigens, regulate antigen processing and presentation, and regulate T cells and innate immune responses35. The infiltration of B cells in the TME is particularly associated with the survival rate of different malignant tumors, such as oropharyngeal cancer and ovarian cancer36. The proportion of infiltrating B cells in our study was lower in tumor tissue relative to normal tissue and negatively correlated with the infiltration of M2 macrophages; thus, the proportion may occupy some tumor-suppression role, but we found no statistically significant correlation with prognosis.

Natural killer (NK) cells comprise the first step in the body’s innate immune defense by responding rapidly to infection and malignant transformation, and they modulate adaptive immune responses37. NKs are therefore crucial to the immune surveillance of spontaneous tumors and the prevention of tumor metastasis38. It was shown that NK cells possessed a robust anti-tumor effect in head and neck squamous cell carcinoma (HNSCC) and were closely related to a favorable prognosis39, and our study similarly showed that activated NK cells were closely associated with an improved prognosis of patients.

Dendritic cells are the strongest antigen-presenting cells in the body, can effectively activate CD4+ T cells and CD8+ T cells, and are the central link in the initiation, regulation, and maintenance of the immune response. An increasing number of studies have in recent years revealed that within the THCA microenvironment, resting dendritic cells can inhibit the onset of the immune response via the secretion of TGF-6 and IL-10, and that they enhance the invasion and metastasis of THCA23. In the present study, we likewise demonstrated that both resting and activated dendritic cells infiltrated at high proportions into tumor tissue and that both were positively correlated with lymph node metastasis and TNM staging. These data indicate that high-risk PTC is associated with a higher proportion of infiltrating quiescent and activated dendritic cells.

Mast cell-derived mediators such as chemokines CXCL1, CXCL10, and CXCL8 are able to promote tumor growth and metastasis. In THCA tissues, CXCL1 and CXCL10 are able to engender cellular proliferation, and CXCL8 can induce the stem cell properties of tumors or enhance epithelial stromal transformation40. We herein demonstrated that the infiltration of resting mast cells was positively correlated with TNM staging.

Further research on resting CD4+ memory T cells, CD8+ T cells, M2 macrophages, γδT cells, and activated NK cells can facilitate our understanding of the role of immune cells in the TME and assist in determining the risk grade of PTC patients and the development of corresponding immunotherapeutic strategies. From the aforementioned studies, we inferred that the higher proportions of M1 macrophages, NK cells, CD4+ memory T cells, and CD8+ T cells in the TME constituted low-risk PTC, while supernumerary M0 macrophages, M2 macrophages, γδT cells, resting mast cells, resting dendritic cells, and activated dendritic cells reflected high-risk PTC. Subsequently, we found through cell-correlation analysis that there were complex connections between immune cells. There was a strong positive correlation between tumor-suppressor immune cells and other tumor-suppressor immune cells, while there was a strong negative correlation between tumor-suppressor immune cells and tumor-promoting immune cells. Enhancing or weakening a certain immune cell can affect the majority of cells in the TME, and understanding their relationships can expedite more comprehensive diagnosis, treatment, and other aspects. We also uncovered some intriguing results in the course of our study. Due to the low absolute numbers of some immune cells (e.g., naive CD4+ T cells, resting NK cells, eosinophils, and neutrophils), it was impossible to intuitively ascertain the difference in the infiltration of immune cells between tumor and normal tissues from our heatmap. We discerned that neutrophils were particularly closely related to clinical pathological factors such as T, N, and M staging. However, due to the low absolute numbers of infiltrating neutrophils, we postulate that neutrophils do not wield a significant impact on the microenvironment of PTC.

To explore the possible molecular mechanisms underlying differential immune infiltration, we undertook differential expression analysis of PTC tissues and normal tissues in the TCGA dataset, resulting in 2691 DEGs. The obtained DEGs were then crossed with the immune genes in the ImmPort database, resulting in 271 immune-related DEGs. Subsequently, GO- and KEGG-enrichment analyses of these immune-related DEGs showed that they were mainly enriched in pathways related to cellular proliferation and immunity, with abnormal cellular proliferation as the chief cause of tumor formation. Enrichment analyses indicated that these genes were mainly enriched in “interactions between cytokines and cytokine receptors,” “T cell receptor signaling pathway,” “MAPK signaling pathway,” and “Jak-STAT signaling pathway.” It was reported that interactions between cytokines and cytokine receptors are strongly associated with the risk of multiple cancers and that the progression of breast cancer can be inhibited by regulating interactions between cytokines and cytokine receptors41. T cell receptor signaling recognizes different ligands with broad affinities involved in the activation of diverse physiological processes. Considering the importance of T cells, the complexity of their developmental processes, and the diversity of cell subtypes, the associated regulation of this signaling pathway is extremely complex and diverse. Due to the rise in cell therapies and immunotherapy, the T cell receptor-signaling pathway has become the most-studied pathway in the field of cancer therapy42,43. The MAPK pathway is the major pathway from extracellular to intracellular transmission, regulating cell growth, differentiation, stress adaptation to the environment, and inflammatory responses, and the MAPK pathway plays a particularly important role in the TME44. A multitude of researchers have over the past few years found various signaling pathways to be related to the initiation and progression of inflammation, and showed that MAPK constitutes a classic inflammatory pathway and that it is involved in the immune process45. JAK-STAT signaling is the cornerstone of cancer progression, both as a tumor-intrinsic driver of cancer growth/metastasis and as a modulator of immune surveillance46,47. These pathways serve specific roles in PTC and are associated with inflammation and immune regulation.

We subsequently established a PPI network to examine the interactions between these immune-related DEGs and screened the major modules with high connectivity values and determined that genes in the major modules were strongly related to immune processes. Most of the key genes in the major module—including CXCL5, CD40LG, and CXCL12—are implicated in tumor immune escape and can recruit immune cells to the TME, thereby affecting tumor immunity and angiogenesis48,49. We also performed a combined analysis of key genes and TNM staging and showed that nine key genes were closely associated with TNM staging, of which CSF2, CXCL5, CCL17, ICAM1, CCL19 and CD40LG appeared to be closely associated with high-risk PTC. Colony-stimulating factor 2 (CSF2) is a cytokine that stimulates stem cells to produce granulocytes and monocytes50, and CSF2 has been shown to be closely associated with a poor prognosis in some tumors51,52. Moreover, CSF2 is closely related to dendritic cells and macrophages in the TME, which further affects the prognosis of tumors52. ICAM1 is a transmembrane glycoprotein that belongs to the immunoglobulin superfamily and is important in cell adhesion, leukocyte interactions across endothelial migration to inflammatory sites, and the activation of lymphocytes, and thus affects tumor cell invasion and metastasis53. CXCL5, CCL19, and CCL17 all belong to the chemokine family, and chemokines are closely associated with angiogenesis in tumor tissue. When combined with their ligands, these factors exert a promoting effect on tumor progression. Researchers have previously reported that CXCL5, CCL19, and CCL17 are all significant actors in the progression of various malignant tumors54,55,56,57,58,59,60,61. In addition, our survival analysis revealed that only the key gene CD40LG was significantly associated with the prognosis of PTC, while analysis of the TCGA dataset indicated that CD40LG may be an inhibitory gene for PTC. Previous studies have failed to explore the relationship between CD40LG and immunity, with only a few studies indicating that these genes were associated with the occurrence of certain tumors. CD40LG is a cytokine that binds to CD40 and belongs to the tumor necrosis factor (TNF) gene superfamily62, and their interaction directly inhibits the growth of CD40-positive cancer cells, potentially indirectly inhibiting tumor growth by coordinating immune responses63,64. Leukemia cells harboring CD40L-sequence transduction can promote antigen presentation and the production of their own T cell reactions, leading to the formation of cytotoxic T cells that target leukemia cells. In addition, CD40LG is mainly enriched in immune-related signaling pathways, and its application in the treatment of gastric cancer, breast cancer, and prostate cancer has been confirmed65,66. However, few authors have explored the role of CD40LG in the progression of PTC, and thus further exploration is necessitated in future analyses.

In conclusion, we herein demonstrated that 12 immune cells and nine immune-related DEGs were closely correlated with TNM staging and identified two immune cells (activated NK cells and γδT cells) and one immune-related DEG (CD40LG) that were associated with prognosis. After evaluation, we determined that four immune cell types (M1 macrophages, NK cells, CD4+ memory T cells, and CD8+ T cells) could be used to determine low-risk PTC, and that six immune cell types (M0 macrophages, M2 macrophages, γδT cells, resting mast cells, resting dendritic cells, and activated dendritic cells) and six immune-related genes (CSF2, CXCL5, CCL17, ICAM1, CCL19 and CD40LG) were closely associated with high-risk PTC. We postulate that these cells and genes can be applied as biomarkers for predicting prognosis—as well as biomarkers for determining high- and low-risk PTC—which will assist clinicians in determining prognosis early and further develop individualized immunotherapy programs. This study is based on the analysis of transcriptional and clinical data from a large sample of patients in the TCGA database, and the results reflect high confidence. However, as with other similar studies in bioinformatics, the evidence from this study remains indirect and requires further experimental validation. Through the intensive investigation of these immune cells and immune-related genes, we expect to elucidate the potential relationship between the tumor microenvironment and PTC immunotherapy and prognosis and to provide a theoretical basis for developing improved immunotherapeutic strategies.

Methods

Gene-expression datasets

On 18 March 2022, a total of 567 cases of THCA gene-transcript data (FPKM) were downloaded from the public database TCGA (https://portal.gdc.cancer.gov/), comprising 509 cases of PTC tissues and 58 cases of normal thyroid tissues. We downloaded clinical data related to THCA samples, including sex, survival time, survival status, and TNM staging. Subsequently, we organized each sample and its corresponding clinical data for further analysis.

Estimation of immune cell-type fractions

Using a custom Perl script (Perl version 5.38.0) to extract and organize the FPKM expression data obtained, a mRNA data matrix was obtained and the data was standardized. CIBERSORT is a deconvolution algorithm that infers the proportion of cell types in data from tumor samples using support vector regression based on a set of reference gene-expression values67. Using the CIBERSORT algorithm, standardized gene expression data were employed to estimate the relative proportions of 22 immune cell types. The 22 cell types estimated by CIBERSORT included B cells, T cells, natural killer cells, macrophages, dendritic cells, eosinophils, and neutrophils. We performed 1,000 permutations and retained samples with a p < 0.05 to ensure the reliability of the results, and the sum of the various immune cells was 1. Finally, 233 transcript data were included in the study (206 cases of PTC tissues and 27 cases of normal thyroid tissues). Summarize and collate immune cell data using Excel, and draw composite pie chart. We constructed percentage bar charts, immune cell-expression heatmaps, and violin plots using the barplot R package, pheatmap R package, and vioplot R package, respectively. We exploited the corrplot R package to detect correlations between different immune cells.

Analysis of immune-related DEGs

We performed differential gene analysis on the TCGA dataset using the R package edgeR (|log (fold-change)|> 1 and a false discovery rate of < 0.05) and obtained DEGs. Subsequently, the data was intersected the data with the immune gene list obtained from the ImmPort database (https://www.immport.org/home) and thereby obtained immune-related DEGs. At the same time, we used the ggplot2 R package to draw volcano maps to display the distribution of DEGs and immune-related DEGs.

The DAVID online website (https://david.ncifcrf.gov) was subsequently used to conduct Kyoto Encyclopedia of Genes and Genomes (KEGG)68- and Gene Ontology (GO)-enrichment analyses on the immune-related DEGs (p < 0.05). We visualized the KEGG and GO enrichment analysis results separately using the ggplot2 R package and Excel.

All immune-related DEGs were entered into STRING (https://string-db.org) to predict protein–protein interactions, and the obtained PPI network data were processed using Cytoscape; we extracted important modules (with an MCODE score > 10 and number of nodes > 10) and isolated their genes as key genes for further analysis. The key genes were then inputted into the TIMER database (https://cistrome.shinyapps.io/timer/) to obtain their expression in various tumors to gain a deeper understanding of the genes.

Clinical pathology and survival analysis

Based on the patient clinical information downloaded from TCGA, use Perl script to organize the clinical information (gender, age, TNM staging, recurrence status, follow-up time). Use Wilcoxon test to calculate the differences in the infiltration levels of the immune cells/expression levels of immune-related genes among different clinical pathological features. And use the clinicalCor R package to draw a box line diagram. Patients were assigned to high- and low-infiltration groups based on their median levels of immune cells, and the correlation between immune cells and survival was analyzed by exploiting univariate Cox analysis. We used the Survival R package to plot survival curves based on the calculated results, to illustrate the relationship between the infiltration levels of the immune cells/expression levels of immune-related genes and the prognosis of PTC patients.

Statistical analysis

Each dataset was processed using the weighted-average method to compare the differences in tumor infiltration-related immune cell compositions among PTC patients of different TNM stagings. We defined OS as the time interval from the date of diagnosis to the date of death. We adopted univariate Cox analysis to investigate the correlation between immune-cell infiltration and the corresponding clinical follow-up. Wilcox test was applied to evaluate the differences in immune-related DEGs between tumor tissues and normal tissues. All analyses were conducted using R software (version 3.6.3), and p < 0.05 represented a significant difference for all statistical analyses.