Skip to main content

37  Evidence-guided biological interpretation

Statistical enrichment results are evidence to inspect, not biological conclusions by themselves. This chapter describes how to move from enriched terms, core genes, networks, expression trends, and prior knowledge to a transparent interpretation. AI assistance is presented as an optional evidence-synthesis layer after those checks, not as a replacement for the enrichment analysis or literature review.

Enrichment results identify terms and genes associated with the input, but they do not by themselves establish a mechanism. Interpretation therefore starts with the result object, core genes, background, database provenance, and any supporting expression or network evidence.

37.1 The interpret function

interpret() accepts enrichResult, gseaResult, or compareClusterResult objects and asks an LLM to organize the supplied evidence into a structured report. The report is a draft for evidence review, not a replacement for the enrichment test or literature validation.

The function requires an API key for a provider supported by aisdk. If model is not supplied, it uses the current model from aisdk::get_model() / aisdk::set_model(); an explicit model argument overrides that default for one call. The examples below use DeepSeek through DEEPSEEK_API_KEY, but other aisdk providers can be used.

library(aisdk)

# Credentials come from the environment; a local .env file works too
if (file.exists(".env") && requireNamespace("dotenv", quietly = TRUE)) {
    dotenv::load_dot_env()
}

# Set a session-wide default model. Any provider supported by aisdk works here;
# in CI the key is supplied as the DEEPSEEK_API_KEY repository secret.
set_model("deepseek:deepseek-v4-flash")

# Check the current default model
get_model()
[1] "deepseek:deepseek-v4-flash"
library(clusterProfiler)
library(DOSE)

# A self-contained enrichment result: `edo` is built offline from the demo gene
# list shipped with DOSE, so the example depends neither on a previous chapter
# (`edo` is defined in the enrichplot chapter) nor on a network service.
data(geneList, package = "DOSE")
de <- names(geneList)[abs(geneList) > 1.5]
edo <- enrichDO(de)

# Basic usage
# 'edo' is your enrichment result object
res <- interpret(edo)

if (interpret_failed(res)) {
    stop("interpret() returned no report -- check the API key and quota:\n",
         res$overview)
}
cat(render_interpretation_blocks(res), sep = "\n")
Interpretation — cluster Default (Not returned)

Overview:

The enrichment results are Disease Ontology terms dominated by three shared gene modules: (i) cell-cycle/pre-replication and mitotic genes, led by Meier-Gorlin syndrome (CDC45/CDT1/MCM5/CDC6/ORC6/ORC1) and multiple carcinomas with CDK1/AURKA/AURKB/PLK1/CCNB1/CCNE1/BIRC5/MKI67, plus microcephaly genes CENPE/NCAPH/ASPM/MAD2L1/LMNB1/KIF14; (ii) chemokine/antigen-presentation inflammation, seen in myocarditis, viral infectious disease, COVID-19/SARS, asthma, interstitial lung disease, sarcoidosis, and autoimmune thyroiditis; and (iii) ECM/vascular/metabolic remodeling, seen in aortic aneurysm, Marfan syndrome, heart valve disease, cardiomyopathy, type 2 diabetes mellitus, coronary artery disease, and stroke. The strongest terms include breast cancer (35/279), cardiomyopathy (35/279), type 2 diabetes mellitus (32/279), large intestine cancer (31/279), and stomach cancer (25/279), supporting a combined proliferative-inflammatory-stromal signature.

Regulatory drivers:

  • No upstream transcription-factor enrichment was supplied, so candidate master regulators are inferred from genes embedded in the enriched disease lists. Key candidates include EZH2 (breast cancer, stomach cancer, urinary bladder cancer, pancreatic cancer, lymphoma, hepatocellular carcinoma), FOXM1 (stomach cancer, type 2 diabetes mellitus, pancreatic cancer, hepatocellular carcinoma), FOSL1 (stomach cancer, female reproductive organ cancer, in situ carcinoma, head and neck cancer), ZEB1 (viral infectious disease, heart valve disease, corneal disease, coronary artery disease), FOXA1 (stomach cancer, breast cancer, esophageal cancer, lung non-small cell carcinoma, hepatocellular carcinoma), AR (breast cancer, female reproductive organ cancer, in situ carcinoma, endometriosis, prostate carcinoma, type 2 diabetes mellitus), PGR (in situ carcinoma, ductal carcinoma in situ, endometriosis), GATA3 (autoimmune thyroiditis, proteinuria, asthma), TBX3 (stomach cancer, female reproductive organ cancer, large intestine cancer, hepatocellular carcinoma, coronary artery disease), and PAX6 (open-angle glaucoma, corneal disease, type 2 diabetes mellitus, pancreatic cancer). These regulators are positioned to drive proliferation and epigenomic programs (EZH2/FOXM1), EMT/ECM programs (FOSL1/ZEB1), and lineage/hormone programs (FOXA1/AR/PGR/GATA3).

Key mechanisms:

Cell-cycle and replication: Meier-Gorlin syndrome genes CDC45/CDT1/MCM5/CDC6/ORC6/ORC1 and mitotic genes CDK1/AURKA/AURKB/PLK1/CCNB1/CCNE1/BIRC5/MKI67/RRM2/CDC25A recur across breast cancer, stomach cancer, urinary bladder cancer, cervical cancer, and hepatocellular carcinoma; microcephaly and primary microcephaly add CENPE/NCAPH/ASPM/MAD2L1/LMNB1/KIF14. ECM/vascular remodeling: MMP1/MMP9/MMP12, ELN, FBN1, COL14A1, COL16A1, COL4A5, LAMB2, ITGA7, TGFB3, AGTR1, and PDGFD appear in aortic aneurysm, abdominal aortic aneurysm, thoracic aortic aneurysm, Marfan syndrome, heart valve disease, open-angle glaucoma, and proteinuria. Chemokine/immune activation: CXCL9/CXCL10/CXCL11, CXCL8, CXCL3, CCL5, CCL8, CCL20, S100A8/S100A9, TAP1, HLA-DQA1, CTLA4, IDO1, GZMB, ICOS, and TNFRSF11A/TNFRSF11B appear in myocarditis, viral infectious disease, COVID-19, severe acute respiratory syndrome, asthma, interstitial lung disease, sarcoidosis, autoimmune thyroiditis, and rheumatic disease. Metabolic/endocrine-vascular: ADIPOQ, IRS1, PCK1, PPP1R3C, ADRA2A, CACNA1D, PLA2G7, F3, PLAT, and AGTR1 appear in type 2 diabetes mellitus, coronary artery disease, stroke, congestive heart failure, cardiomyopathy, and familial partial lipodystrophy.

Crosstalk and interactions:

MMPs (MMP1/MMP9/MMP12) are shared by cancer, aortic aneurysm, heart valve disease, glaucoma, and inflammatory lung disease, linking chemokine/immune activation to matrix degradation. AGTR1 and TGFB3 co-occur in cardiomyopathy, while AGTR1/PLA2G7/F3/PLAT/ADIPOQ/IRS1 co-occur in type 2 diabetes mellitus, coronary artery disease, and stroke, connecting renin-angiotensin, coagulation, and metabolic signaling. Chemokines CXCL9/CXCL10/CXCL11, CXCL8, CCL5, and CCL20 co-occur with CTLA4/IDO1/TAP1/HLA-DQA1 in viral infectious disease, COVID-19/SARS, asthma, sarcoidosis, and interstitial lung disease, indicating a coupled chemokine/antigen-presentation axis. EZH2/FOXM1/FOSL1/ZEB1 co-occur with cell-cycle genes and MMPs across carcinomas and cardiovascular terms, suggesting proliferation and EMT/ECM programs are coupled.

Hypothesis:

The shared signature suggests a coupled proliferation-inflammation-matrix remodeling program: EZH2/FOXM1/FOSL1/ZEB1 and lineage/hormone regulators (FOXA1/AR/PGR/GATA3) promote cell-cycle entry, EMT, and lineage-specific programs; chemokines (CXCL9/CXCL10/CXCL11, CXCL8, CCL5, CCL20) with antigen-presentation/checkpoint genes (TAP1/HLA-DQA1/CTLA4/IDO1) recruit and regulate immune cells; and MMPs/ELN/FBN1/AGTR1/TGFB3/PDGFD remodel ECM and vasculature. Metabolic genes ADIPOQ/IRS1/PLA2G7 and coagulation genes F3/PLAT further link systemic metabolic and vascular stress. Thus the enriched disease terms are not independent but reflect a common proliferative-inflammatory-stromal state that may be targetable by combining cell-cycle/epigenetic inhibition with chemokine/ECM-axis modulation.

Narrative draft:

Disease Ontology enrichment of the input gene set was dominated by neoplastic, immune-inflammatory, and cardiovascular/metabolic terms. The cell-cycle theme was anchored by Meier-Gorlin syndrome genes CDC45/CDT1/MCM5/CDC6/ORC6/ORC1 and by mitotic genes such as CDK1, AURKA, AURKB, PLK1, CCNB1, CCNE1, BIRC5, MKI67, RRM2, and CDC25A in breast cancer, stomach cancer, urinary bladder cancer, cervical cancer, and hepatocellular carcinoma; microcephaly terms contributed CENPE/NCAPH/ASPM/MAD2L1/LMNB1/KIF14. An inflammatory theme was supported by CXCL9/CXCL10/CXCL11, CXCL8, CXCL3, CCL5, CCL8, CCL20, S100A8/S100A9, TAP1, HLA-DQA1, CTLA4, IDO1, GZMB, ICOS, and TNFRSF11A/TNFRSF11B across myocarditis, viral infectious disease, COVID-19/SARS, asthma, interstitial lung disease, sarcoidosis, autoimmune thyroiditis, and rheumatic disease. A third theme comprised ECM/vascular and metabolic genes, including MMP1/MMP9/MMP12, ELN, FBN1, COL14A1, COL16A1, COL4A5, LAMB2, ITGA7, TGFB3, AGTR1, PDGFD, ADIPOQ, IRS1, PLA2G7, F3, and PLAT in aortic aneurysm, Marfan syndrome, heart valve disease, cardiomyopathy, type 2 diabetes mellitus, coronary artery disease, and stroke. Together these findings suggest that the input signature reflects a proliferative, chemokine-rich, matrix-remodeling state in which cell-cycle regulators, immune-recruitment programs, and vascular/metabolic pathways are functionally coupled.

Network evidence:

Key hubs in the inferred network are MMP9 (shared by stomach cancer, esophageal cancer, asthma, coronary artery disease, glomerulonephritis, and heart valve disease), EZH2/FOXM1/FOSL1 (carcinoma and cell-cycle terms), CXCL8/S100A8/CCL5 (viral infectious disease, SARS, asthma, sarcoidosis, and hypersensitivity reaction disease), and AGTR1/PLA2G7/F3/PLAT/ADIPOQ/IRS1 (type 2 diabetes mellitus, coronary artery disease, stroke, and cardiomyopathy). Specific modules include the pre-replication complex ORC1/ORC6/CDC6/CDT1/CDC45/MCM5 in Meier-Gorlin syndrome; the mitotic/spindle module CDK1/AURKA/AURKB/PLK1/CCNB1/CCNE1/BIRC5/MKI67 with CENPE/NCAPH/ASPM/MAD2L1/KIF14 in microcephaly; the antigen-processing module TAP1/HLA-DQA1 with CTLA4/IDO1/GZMB; and the ECM/vascular module MMP1/MMP9/MMP12/ELN/FBN1/COL14A1/COL16A1/COL4A5/LAMB2/ITGA7/TGFB3/AGTR1/PDGFD.

Raw object print
## Interpretation Result

### Cluster: Default

### 1. Overview
The enrichment results are Disease Ontology terms dominated by three shared gene modules: (i) cell-cycle/pre-replication and mitotic genes, led by Meier-Gorlin syndrome (CDC45/CDT1/MCM5/CDC6/ORC6/ORC1) and multiple carcinomas with CDK1/AURKA/AURKB/PLK1/CCNB1/CCNE1/BIRC5/MKI67, plus microcephaly genes CENPE/NCAPH/ASPM/MAD2L1/LMNB1/KIF14; (ii) chemokine/antigen-presentation inflammation, seen in myocarditis, viral infectious disease, COVID-19/SARS, asthma, interstitial lung disease, sarcoidosis, and autoimmune thyroiditis; and (iii) ECM/vascular/metabolic remodeling, seen in aortic aneurysm, Marfan syndrome, heart valve disease, cardiomyopathy, type 2 diabetes mellitus, coronary artery disease, and stroke. The strongest terms include breast cancer (35/279), cardiomyopathy (35/279), type 2 diabetes mellitus (32/279), large intestine cancer (31/279), and stomach cancer (25/279), supporting a combined proliferative-inflammatory-stromal signature. 

### 2. Regulatory Drivers
No upstream transcription-factor enrichment was supplied, so candidate master regulators are inferred from genes embedded in the enriched disease lists. Key candidates include EZH2 (breast cancer, stomach cancer, urinary bladder cancer, pancreatic cancer, lymphoma, hepatocellular carcinoma), FOXM1 (stomach cancer, type 2 diabetes mellitus, pancreatic cancer, hepatocellular carcinoma), FOSL1 (stomach cancer, female reproductive organ cancer, in situ carcinoma, head and neck cancer), ZEB1 (viral infectious disease, heart valve disease, corneal disease, coronary artery disease), FOXA1 (stomach cancer, breast cancer, esophageal cancer, lung non-small cell carcinoma, hepatocellular carcinoma), AR (breast cancer, female reproductive organ cancer, in situ carcinoma, endometriosis, prostate carcinoma, type 2 diabetes mellitus), PGR (in situ carcinoma, ductal carcinoma in situ, endometriosis), GATA3 (autoimmune thyroiditis, proteinuria, asthma), TBX3 (stomach cancer, female reproductive organ cancer, large intestine cancer, hepatocellular carcinoma, coronary artery disease), and PAX6 (open-angle glaucoma, corneal disease, type 2 diabetes mellitus, pancreatic cancer). These regulators are positioned to drive proliferation and epigenomic programs (EZH2/FOXM1), EMT/ECM programs (FOSL1/ZEB1), and lineage/hormone programs (FOXA1/AR/PGR/GATA3). 

### 3. Key Mechanisms
Cell-cycle and replication: Meier-Gorlin syndrome genes CDC45/CDT1/MCM5/CDC6/ORC6/ORC1 and mitotic genes CDK1/AURKA/AURKB/PLK1/CCNB1/CCNE1/BIRC5/MKI67/RRM2/CDC25A recur across breast cancer, stomach cancer, urinary bladder cancer, cervical cancer, and hepatocellular carcinoma; microcephaly and primary microcephaly add CENPE/NCAPH/ASPM/MAD2L1/LMNB1/KIF14. ECM/vascular remodeling: MMP1/MMP9/MMP12, ELN, FBN1, COL14A1, COL16A1, COL4A5, LAMB2, ITGA7, TGFB3, AGTR1, and PDGFD appear in aortic aneurysm, abdominal aortic aneurysm, thoracic aortic aneurysm, Marfan syndrome, heart valve disease, open-angle glaucoma, and proteinuria. Chemokine/immune activation: CXCL9/CXCL10/CXCL11, CXCL8, CXCL3, CCL5, CCL8, CCL20, S100A8/S100A9, TAP1, HLA-DQA1, CTLA4, IDO1, GZMB, ICOS, and TNFRSF11A/TNFRSF11B appear in myocarditis, viral infectious disease, COVID-19, severe acute respiratory syndrome, asthma, interstitial lung disease, sarcoidosis, autoimmune thyroiditis, and rheumatic disease. Metabolic/endocrine-vascular: ADIPOQ, IRS1, PCK1, PPP1R3C, ADRA2A, CACNA1D, PLA2G7, F3, PLAT, and AGTR1 appear in type 2 diabetes mellitus, coronary artery disease, stroke, congestive heart failure, cardiomyopathy, and familial partial lipodystrophy. 

### 4. Crosstalk & Interactions
MMPs (MMP1/MMP9/MMP12) are shared by cancer, aortic aneurysm, heart valve disease, glaucoma, and inflammatory lung disease, linking chemokine/immune activation to matrix degradation. AGTR1 and TGFB3 co-occur in cardiomyopathy, while AGTR1/PLA2G7/F3/PLAT/ADIPOQ/IRS1 co-occur in type 2 diabetes mellitus, coronary artery disease, and stroke, connecting renin-angiotensin, coagulation, and metabolic signaling. Chemokines CXCL9/CXCL10/CXCL11, CXCL8, CCL5, and CCL20 co-occur with CTLA4/IDO1/TAP1/HLA-DQA1 in viral infectious disease, COVID-19/SARS, asthma, sarcoidosis, and interstitial lung disease, indicating a coupled chemokine/antigen-presentation axis. EZH2/FOXM1/FOSL1/ZEB1 co-occur with cell-cycle genes and MMPs across carcinomas and cardiovascular terms, suggesting proliferation and EMT/ECM programs are coupled. 

### 5. Hypothesis
The shared signature suggests a coupled proliferation-inflammation-matrix remodeling program: EZH2/FOXM1/FOSL1/ZEB1 and lineage/hormone regulators (FOXA1/AR/PGR/GATA3) promote cell-cycle entry, EMT, and lineage-specific programs; chemokines (CXCL9/CXCL10/CXCL11, CXCL8, CCL5, CCL20) with antigen-presentation/checkpoint genes (TAP1/HLA-DQA1/CTLA4/IDO1) recruit and regulate immune cells; and MMPs/ELN/FBN1/AGTR1/TGFB3/PDGFD remodel ECM and vasculature. Metabolic genes ADIPOQ/IRS1/PLA2G7 and coagulation genes F3/PLAT further link systemic metabolic and vascular stress. Thus the enriched disease terms are not independent but reflect a common proliferative-inflammatory-stromal state that may be targetable by combining cell-cycle/epigenetic inhibition with chemokine/ECM-axis modulation. 

### 6. Narrative Draft
Disease Ontology enrichment of the input gene set was dominated by neoplastic, immune-inflammatory, and cardiovascular/metabolic terms. The cell-cycle theme was anchored by Meier-Gorlin syndrome genes CDC45/CDT1/MCM5/CDC6/ORC6/ORC1 and by mitotic genes such as CDK1, AURKA, AURKB, PLK1, CCNB1, CCNE1, BIRC5, MKI67, RRM2, and CDC25A in breast cancer, stomach cancer, urinary bladder cancer, cervical cancer, and hepatocellular carcinoma; microcephaly terms contributed CENPE/NCAPH/ASPM/MAD2L1/LMNB1/KIF14. An inflammatory theme was supported by CXCL9/CXCL10/CXCL11, CXCL8, CXCL3, CCL5, CCL8, CCL20, S100A8/S100A9, TAP1, HLA-DQA1, CTLA4, IDO1, GZMB, ICOS, and TNFRSF11A/TNFRSF11B across myocarditis, viral infectious disease, COVID-19/SARS, asthma, interstitial lung disease, sarcoidosis, autoimmune thyroiditis, and rheumatic disease. A third theme comprised ECM/vascular and metabolic genes, including MMP1/MMP9/MMP12, ELN, FBN1, COL14A1, COL16A1, COL4A5, LAMB2, ITGA7, TGFB3, AGTR1, PDGFD, ADIPOQ, IRS1, PLA2G7, F3, and PLAT in aortic aneurysm, Marfan syndrome, heart valve disease, cardiomyopathy, type 2 diabetes mellitus, coronary artery disease, and stroke. Together these findings suggest that the input signature reflects a proliferative, chemokine-rich, matrix-remodeling state in which cell-cycle regulators, immune-recruitment programs, and vascular/metabolic pathways are functionally coupled. 

### 7. Refined Regulatory Network
Key Interactions:
  EZH2 -- CDK1 (activation) - EZH2 and CDK1 co-occur in breast cancer, urinary bladder cancer, and hepatocellular carcinoma, supporting an epigenome-cell-cycle proliferation module.
  FOXM1 -- MKI67 (activation) - FOXM1 and MKI67 co-occur in stomach cancer, pancreatic cancer, and hepatocellular carcinoma, consistent with FOXM1 driving proliferation.
  FOXM1 -- CDK1 (activation) - FOXM1 and CDK1 co-occur in hepatocellular carcinoma, linking a proliferation-associated transcription factor to mitotic kinase activity.
  FOSL1 -- MMP9 (activation) - FOSL1 and MMP9 co-occur in stomach cancer, in situ carcinoma, and head and neck cancer, linking AP-1 activity to matrix degradation.
  ZEB1 -- MMP9 (activation) - ZEB1 and MMP9 co-occur in heart valve disease, corneal disease, and coronary artery disease, supporting ZEB1-linked EMT/ECM remodeling.
  AGTR1 -- MMP9 (activation) - AGTR1 and MMP9 co-occur in glomerulonephritis, coronary artery disease, and congestive heart failure, linking angiotensin signaling to matrix metalloproteinase activity.
  AGTR1 -- TGFB3 (activation) - AGTR1 and TGFB3 co-occur in cardiomyopathy, supporting a renin-angiotensin-TGFB fibrotic axis.
  CXCL8 -- MMP9 (activation) - CXCL8 and MMP9 co-occur in stomach cancer, esophageal cancer, and asthma, linking chemokine signaling to ECM turnover.
  CXCL8 -- S100A8 (activation) - S100A8 and CXCL8 co-occur in viral infectious disease and severe acute respiratory syndrome, supporting S100A8-driven chemokine amplification.
  CCL5 -- CTLA4 (recruitment) - CCL5 and CTLA4 co-occur in viral infectious disease, asthma, sarcoidosis, and hypersensitivity reaction disease, consistent with CCL5-mediated T-cell recruitment into CTLA4-associated immune contexts.
  TAP1 -- HLA-DQA1 (functional cooperation) - TAP1 and HLA-DQA1 co-occur in viral infectious disease, rheumatic disease, asthma, primary bacterial infectious disease, and diffuse scleroderma, supporting an antigen-processing/presentation module.
  CTLA4 -- IDO1 (activation) - CTLA4 and IDO1 co-occur in viral infectious disease, consistent with an immune-checkpoint/IDO regulatory module.
  ADIPOQ -- IRS1 (activation) - ADIPOQ and IRS1 co-occur in type 2 diabetes mellitus, supporting adiponectin-insulin signaling crosstalk.
  F3 -- PLAT (functional cooperation) - F3 and PLAT co-occur in type 2 diabetes mellitus, coronary artery disease, and viral infectious disease, linking coagulation and fibrinolysis.
  ELN -- FBN1 (binding) - ELN and FBN1 co-occur in aortic aneurysm and heart valve disease, supporting an elastic fiber/microfibril ECM module.
  FOXA1 -- TFF1 (activation) - FOXA1 and TFF1 co-occur in stomach cancer and breast cancer, supporting a lineage-specific FOXA1-TFF1 program.

**Network Evidence:**
Key hubs in the inferred network are MMP9 (shared by stomach cancer, esophageal cancer, asthma, coronary artery disease, glomerulonephritis, and heart valve disease), EZH2/FOXM1/FOSL1 (carcinoma and cell-cycle terms), CXCL8/S100A8/CCL5 (viral infectious disease, SARS, asthma, sarcoidosis, and hypersensitivity reaction disease), and AGTR1/PLA2G7/F3/PLAT/ADIPOQ/IRS1 (type 2 diabetes mellitus, coronary artery disease, stroke, and cardiomyopathy). Specific modules include the pre-replication complex ORC1/ORC6/CDC6/CDT1/CDC45/MCM5 in Meier-Gorlin syndrome; the mitotic/spindle module CDK1/AURKA/AURKB/PLK1/CCNB1/CCNE1/BIRC5/MKI67 with CENPE/NCAPH/ASPM/MAD2L1/KIF14 in microcephaly; the antigen-processing module TAP1/HLA-DQA1 with CTLA4/IDO1/GZMB; and the ECM/vascular module MMP1/MMP9/MMP12/ELN/FBN1/COL14A1/COL16A1/COL4A5/LAMB2/ITGA7/TGFB3/AGTR1/PDGFD. 

37.1.1 Entry points and inputs

The question decides which entry point to use; all four return a model-written draft that still has to be checked against the result object:

  • interpret() organizes enrichment evidence into a biological narrative;
  • interpret_agent() runs the Cleaner–Detective–Storyteller pipeline and returns conclusion, the answer to the question posed in context; prior makes it check another tool’s label, and review = TRUE adds an audit agent;
  • interpret_hierarchical() labels minor clusters while constraining them to the supplied major-cluster context;
  • interpret_dialogue() continues the conversation interactively.

The input can be one result object, a list of compatible objects, or a compareCluster result processed by cluster. For example, list(go_res, kegg_res) combines compatible knowledge sources, while a compareCluster result returns one report per cluster. The returned fields are structured so that reports can be checked, compared, and rendered consistently.

For single-cell data, the marker table can come from Seurat::FindAllMarkers() or another marker-calling method. Keep the cluster and gene columns, use the same identifier namespace in the marker and CellMarker tables, and pass the grouped markers through compareCluster() before annotation. The executable example below uses the repository-local CellMarker table so that it does not depend on a separate count matrix or a pasted annotation report. A complete Seurat marker workflow is available in the pbmc3k tutorial.

37.1.2 Cell Type Annotation

The cell-type example reads the local datasets/Cell_marker_Human.xlsx marker table, builds four marker profiles, runs compareCluster() with enricher(), and asks interpret_agent() which cell type each cluster most likely is — the question goes in context, and the answer comes back as conclusion — when DEEPSEEK_API_KEY is available.

library(clusterProfiler)
library(readxl)
library(dplyr)

cell_marker_path <- file.path("datasets", "Cell_marker_Human.xlsx")
if (!file.exists(cell_marker_path)) {
    stop("The cell-marker dataset is missing: ", cell_marker_path)
}

cell_marker <- readxl::read_excel(cell_marker_path)
TERM2GENE_cell <- cell_marker |>
    transmute(
        cell_name = .data[["Cell name"]],
        marker = toupper(.data[["Marker"]])
    ) |>
    filter(
        !is.na(cell_name), !is.na(marker),
        nzchar(cell_name), nzchar(marker)
    ) |>
    distinct()

# A compact marker panel keeps the example transparent and the prompt small.
marker_sets <- list(
    T_cell = c("CD3D", "CD3E", "TRBC1", "IL7R", "LTB", "MAL", "CCR7", "LST1"),
    B_cell = c("CD79A", "MS4A1", "CD37", "CD79B", "HLA-DRA", "CD74", "BANK1"),
    Monocyte = c("LYZ", "S100A8", "S100A9", "CTSS", "FCN1", "LGALS3", "TYROBP", "LST1"),
    NK_cell = c("NKG7", "GNLY", "PRF1", "GZMB", "KLRD1", "FCGR3A", "XCL1", "XCL2")
)
marker_table <- do.call(
    rbind,
    lapply(names(marker_sets), function(cluster) {
        data.frame(
            cluster = cluster,
            gene = marker_sets[[cluster]],
            stringsAsFactors = FALSE
        )
    })
)

cell_marker_enrichment <- compareCluster(
    gene ~ cluster,
    data = marker_table,
    fun = enricher,
    TERM2GENE = TERM2GENE_cell,
    pvalueCutoff = 1,
    qvalueCutoff = 1,
    minGSSize = 2,
    maxGSSize = 500
)

annotation_reports <- interpret_agent(
    cell_marker_enrichment,
    context = paste(
        "Human single-cell marker panels. Each cluster is a compact set of",
        "top marker genes and was tested against the local CellMarker database.",
        "Which cell type does each cluster most likely correspond to?",
        "Use the enrichment terms as supporting evidence, but prefer markers",
        "that distinguish closely related cell types, and explain which",
        "supplied markers and cell-marker terms support the label."
    ),
    n_pathways = 12,
    max_tokens = 4096,
    temperature = 0.1
)

if (inherits(annotation_reports, "interpretation")) {
    annotation_reports <- list(Default = annotation_reports)
}
if (!is.list(annotation_reports) || length(annotation_reports) == 0) {
    stop("DeepSeek returned no cell-type annotation reports.")
}
for (report in annotation_reports) {
    if (annotation_failed(report)) {
        stop(
            "DeepSeek cell-type annotation failed for cluster ",
            if (!is.null(report$cluster)) report$cluster else "(unknown)",
            ": ",
            if (!is.null(report$overview)) report$overview else "no diagnostic returned"
        )
    }
}

The result below is generated from the live object returned by DeepSeek. It is rendered as an HTML block, not Markdown headings: the preview is readable in the chapter, while the raw print() output remains available in a collapsed section without entering the book’s table of contents.

cat(render_interpretation_blocks(annotation_reports), sep = "\n")
Interpretation — cluster B_cell (Not returned)

Overview:

The cluster markers define a B-lineage population with strong expression of BCR-associated genes (CD79A, CD79B, MS4A1, CD37, BANK1) and MHC class II antigen-presentation genes (HLA-DRA, CD74). Among the retained enrichment terms, Follicular B cell is best supported because 5/7 markers match it, including BANK1, MS4A1, CD79A, CD79B and CD74. Mature B cell and Naive B cell remain closely related alternatives, while Marginal zone B cell is less specific. The overall profile is most consistent with a mature/follicular B-cell identity rather than a non-B or pre-B population.

Regulatory drivers:

  • BANK1
  • CD79A
  • CD79B
  • MS4A1
  • HLA-DRA

Key mechanisms:

Two major modules underlie the label. The first is the B-cell receptor signaling complex, represented by CD79A/CD79B, BANK1, CD37 and MS4A1; this module establishes B-lineage identity and a mature BCR-responsive program. The second is MHC class II antigen presentation, represented by HLA-DRA and CD74; this supports the antigen-presenting capacity typical of mature B cells. The combination of a BCR module with MHC class II machinery and BANK1 expression favors a follicular/mature B-cell phenotype over naive or marginal-zone B cells.

Crosstalk and interactions:

The BCR signaling and MHC class II modules are functionally linked in mature B cells: BCR engagement promotes antigen uptake and processing, while MHC class II/CD74-mediated antigen presentation supports T-cell help. BANK1 modulates BCR-derived signaling, and MS4A1/CD37 are associated with B-cell surface complexes that influence BCR responses. This crosstalk explains why the cluster shows both B-lineage/BCR markers and antigen-presentation markers, and why the combined signature is more consistent with follicular B cells than with non-B HLA-DRA/CD74-positive cells or less-specific B-cell subsets.

Hypothesis:

The cluster represents a mature/follicular B-cell population in which BCR signaling and MHC class II antigen presentation are co-expressed. BANK1, CD79A/CD79B, MS4A1 and CD37 define the BCR-associated mature B-cell program, while HLA-DRA/CD74 indicate antigen-presenting capacity. Biologically, this implies a follicular B-cell identity adapted for antigen recognition, uptake and T-cell interaction, rather than a naive or marginal-zone B-cell program.

Narrative draft:

The cluster is best annotated as follicular B cells. It expresses canonical B-lineage and BCR-associated markers including CD79A, CD79B, MS4A1, CD37 and BANK1, together with the MHC class II antigen-presentation markers HLA-DRA and CD74. In the CellMarker comparison, Follicular B cell is the strongest retained term, matching 5/7 markers (BANK1, MS4A1, CD79A, CD79B and CD74), with Mature B cell and Naive B cell as closely related alternatives and Marginal zone B cell as a less-specific possibility. BANK1 provides additional support for a mature/follicular B-cell program, while HLA-DRA/CD74 indicate antigen-presenting B cells rather than a non-B mononuclear phagocyte or oligodendroglial identity. Thus, the supplied markers and enrichment terms jointly favor a follicular B-cell label.

Network evidence:

The refined network centers on BCR signaling (CD79A/CD79B, BANK1, CD37, MS4A1) and MHC class II antigen presentation (HLA-DRA/CD74), matching the retained mature/follicular B-cell terms. CD79A/CD79B and MS4A1 provide strong B-lineage and BCR-associated identity; BANK1 supports a mature/follicular B-cell program; HLA-DRA/CD74 support antigen-presenting B cells. Together these modules explain Follicular B cell as the best-supported label, with Mature B cell and Naive B cell as closely related alternatives and Marginal zone B cell as less specific.

Raw object print
## Interpretation Result

### Cluster: B_cell

**Conclusion:** Follicular B cell

### 1. Overview
The cluster markers define a B-lineage population with strong expression of BCR-associated genes (CD79A, CD79B, MS4A1, CD37, BANK1) and MHC class II antigen-presentation genes (HLA-DRA, CD74). Among the retained enrichment terms, Follicular B cell is best supported because 5/7 markers match it, including BANK1, MS4A1, CD79A, CD79B and CD74. Mature B cell and Naive B cell remain closely related alternatives, while Marginal zone B cell is less specific. The overall profile is most consistent with a mature/follicular B-cell identity rather than a non-B or pre-B population. 

### 2. Regulatory Drivers
- BANK1
- CD79A
- CD79B
- MS4A1
- HLA-DRA 

### 3. Key Mechanisms
Two major modules underlie the label. The first is the B-cell receptor signaling complex, represented by CD79A/CD79B, BANK1, CD37 and MS4A1; this module establishes B-lineage identity and a mature BCR-responsive program. The second is MHC class II antigen presentation, represented by HLA-DRA and CD74; this supports the antigen-presenting capacity typical of mature B cells. The combination of a BCR module with MHC class II machinery and BANK1 expression favors a follicular/mature B-cell phenotype over naive or marginal-zone B cells. 

### 4. Crosstalk & Interactions
The BCR signaling and MHC class II modules are functionally linked in mature B cells: BCR engagement promotes antigen uptake and processing, while MHC class II/CD74-mediated antigen presentation supports T-cell help. BANK1 modulates BCR-derived signaling, and MS4A1/CD37 are associated with B-cell surface complexes that influence BCR responses. This crosstalk explains why the cluster shows both B-lineage/BCR markers and antigen-presentation markers, and why the combined signature is more consistent with follicular B cells than with non-B HLA-DRA/CD74-positive cells or less-specific B-cell subsets. 

### 5. Hypothesis
The cluster represents a mature/follicular B-cell population in which BCR signaling and MHC class II antigen presentation are co-expressed. BANK1, CD79A/CD79B, MS4A1 and CD37 define the BCR-associated mature B-cell program, while HLA-DRA/CD74 indicate antigen-presenting capacity. Biologically, this implies a follicular B-cell identity adapted for antigen recognition, uptake and T-cell interaction, rather than a naive or marginal-zone B-cell program. 

### 6. Narrative Draft
The cluster is best annotated as follicular B cells. It expresses canonical B-lineage and BCR-associated markers including CD79A, CD79B, MS4A1, CD37 and BANK1, together with the MHC class II antigen-presentation markers HLA-DRA and CD74. In the CellMarker comparison, Follicular B cell is the strongest retained term, matching 5/7 markers (BANK1, MS4A1, CD79A, CD79B and CD74), with Mature B cell and Naive B cell as closely related alternatives and Marginal zone B cell as a less-specific possibility. BANK1 provides additional support for a mature/follicular B-cell program, while HLA-DRA/CD74 indicate antigen-presenting B cells rather than a non-B mononuclear phagocyte or oligodendroglial identity. Thus, the supplied markers and enrichment terms jointly favor a follicular B-cell label. 

### 7. Refined Regulatory Network
Key Interactions:
  CD79A -- CD79B (binding) - CD79A and CD79B form the B-cell receptor signaling heterodimer and are canonical B-lineage markers.
  CD79A -- BANK1 (activation) - BCR/CD79 signaling recruits and activates BANK1, a B-cell scaffold that regulates calcium mobilization.
  CD79B -- BANK1 (activation) - CD79B ITAM signaling is upstream of BANK1 activation in BCR-stimulated B cells.
  CD79A -- MS4A1 (modulation) - MS4A1/CD20 associates with and modulates BCR signaling through the CD79 complex.
  CD79A -- CD37 (modulation) - CD37 is a B-cell tetraspanin that regulates BCR/CD79 signaling and B-cell activation.
  HLA-DRA -- CD74 (binding) - HLA-DRA associates with CD74 invariant chain in MHC class II antigen-presenting complexes.

**Network Evidence:**
The refined network centers on BCR signaling (CD79A/CD79B, BANK1, CD37, MS4A1) and MHC class II antigen presentation (HLA-DRA/CD74), matching the retained mature/follicular B-cell terms. CD79A/CD79B and MS4A1 provide strong B-lineage and BCR-associated identity; BANK1 supports a mature/follicular B-cell program; HLA-DRA/CD74 support antigen-presenting B cells. Together these modules explain Follicular B cell as the best-supported label, with Mature B cell and Naive B cell as closely related alternatives and Marginal zone B cell as less specific. 
Interpretation — cluster Monocyte (Not returned)

Overview:

The cluster is best explained as a classical CD14 monocyte population. The marker set LYZ, S100A8, S100A9, FCN1, CTSS, TYROBP, and LST1 captures core myeloid identity, phagocytic/lysosomal activity, alarmin-associated inflammation, and ITAM signaling. The absence of distinguishing CD16 monocyte, neutrophil, cDC2/DC3, and broad myeloid markers supports a specific CD14 monocyte label rather than a related or overly broad alternative.

Regulatory drivers:

  • SPI1
  • CEBPB
  • NFKB1
  • RELA
  • SYK

Key mechanisms:

The markers group into four coherent themes: (1) CD14 monocyte identity and myeloid differentiation, driven by SPI1/CEBPB and reflected by LYZ, LST1, TYROBP, and CTSS; (2) alarmin/calprotectin biology through S100A8 and S100A9, indicating an inflammatory classical monocyte state; (3) lysosomal-phagocytic function through FCN1 and CTSS; and (4) TYROBP-SYK ITAM signaling linked to NF-kB inflammatory activation. Together these modules support a classical CD14 monocyte phenotype rather than CD16 monocytes, neutrophils, or conventional dendritic cells.

Crosstalk and interactions:

TYROBP-SYK ITAM signaling can feed into NF-kB activation, connecting the myeloid identity module to inflammatory gene expression. SPI1 and CEBPB provide lineage competence for monocyte genes while NFKB1/RELA amplify the S100A8/S100A9 alarmin and FCN1/CTSS phagocytic-inflammatory program. This creates a self-reinforcing monocyte activation network in which lineage TFs, ITAM signaling, and NF-kB cooperate to maintain the observed CD14 monocyte state.

Hypothesis:

The cluster represents an inflammatory classical CD14 monocyte whose identity is maintained by SPI1/CEBPB-driven myeloid transcriptional programs and whose activation state is reinforced by TYROBP-SYK ITAM signaling and NF-kB-mediated alarmin/phagocytic gene expression. This explains the observed LYZ, S100A8, S100A9, FCN1, CTSS, TYROBP, and LST1 signature and argues against CD16 monocyte, neutrophil, cDC2/DC3, or nonspecific myeloid labels.

Narrative draft:

The cluster displays a compact classical CD14 monocyte signature characterized by LYZ, LST1, TYROBP, CTSS, FCN1, S100A8, and S100A9. LYZ, LST1, TYROBP, and CTSS support myeloid lineage and phagocytic/lysosomal identity, whereas S100A8 and S100A9 indicate an alarmin-associated inflammatory state and FCN1 further supports monocyte phagocytic function. These markers are consistent with SPI1- and CEBPB-driven myeloid differentiation, with additional input from TYROBP-SYK ITAM signaling and NF-kB inflammatory activation. Importantly, the cluster lacks discriminating markers of CD16 monocytes (FCGR3A/MS4A7), neutrophils (FCGR3B/CSF3R/CXCR2/ELANE), and cDC2/DC3 (CD1C/FCER1A/CLEC10A), supporting its annotation as a CD14 monocyte rather than a closely related myeloid subset.

Network evidence:

The supplied markers form a coherent CD14 monocyte signature: LYZ, TYROBP, LST1, and CTSS indicate myeloid/phagocytic lineage, while S100A8, S100A9, and FCN1 indicate an inflammatory classical monocyte state. The refined network connects these markers to myeloid TFs SPI1 and CEBPB, inflammatory NF-κB factors, and TYROBP-SYK ITAM signaling. This supports CD14 monocyte over CD16 monocyte (lacks FCGR3A/MS4A7), neutrophil (lacks FCGR3B/CSF3R/CXCR2/ELANE), cDC2/DC3 (lacks CD1C/FCER1A/CLEC10A), and broad myeloid terms.

Raw object print
## Interpretation Result

### Cluster: Monocyte

**Conclusion:** CD14 monocyte

### 1. Overview
The cluster is best explained as a classical CD14 monocyte population. The marker set LYZ, S100A8, S100A9, FCN1, CTSS, TYROBP, and LST1 captures core myeloid identity, phagocytic/lysosomal activity, alarmin-associated inflammation, and ITAM signaling. The absence of distinguishing CD16 monocyte, neutrophil, cDC2/DC3, and broad myeloid markers supports a specific CD14 monocyte label rather than a related or overly broad alternative. 

### 2. Regulatory Drivers
- SPI1
- CEBPB
- NFKB1
- RELA
- SYK 

### 3. Key Mechanisms
The markers group into four coherent themes: (1) CD14 monocyte identity and myeloid differentiation, driven by SPI1/CEBPB and reflected by LYZ, LST1, TYROBP, and CTSS; (2) alarmin/calprotectin biology through S100A8 and S100A9, indicating an inflammatory classical monocyte state; (3) lysosomal-phagocytic function through FCN1 and CTSS; and (4) TYROBP-SYK ITAM signaling linked to NF-kB inflammatory activation. Together these modules support a classical CD14 monocyte phenotype rather than CD16 monocytes, neutrophils, or conventional dendritic cells. 

### 4. Crosstalk & Interactions
TYROBP-SYK ITAM signaling can feed into NF-kB activation, connecting the myeloid identity module to inflammatory gene expression. SPI1 and CEBPB provide lineage competence for monocyte genes while NFKB1/RELA amplify the S100A8/S100A9 alarmin and FCN1/CTSS phagocytic-inflammatory program. This creates a self-reinforcing monocyte activation network in which lineage TFs, ITAM signaling, and NF-kB cooperate to maintain the observed CD14 monocyte state. 

### 5. Hypothesis
The cluster represents an inflammatory classical CD14 monocyte whose identity is maintained by SPI1/CEBPB-driven myeloid transcriptional programs and whose activation state is reinforced by TYROBP-SYK ITAM signaling and NF-kB-mediated alarmin/phagocytic gene expression. This explains the observed LYZ, S100A8, S100A9, FCN1, CTSS, TYROBP, and LST1 signature and argues against CD16 monocyte, neutrophil, cDC2/DC3, or nonspecific myeloid labels. 

### 6. Narrative Draft
The cluster displays a compact classical CD14 monocyte signature characterized by LYZ, LST1, TYROBP, CTSS, FCN1, S100A8, and S100A9. LYZ, LST1, TYROBP, and CTSS support myeloid lineage and phagocytic/lysosomal identity, whereas S100A8 and S100A9 indicate an alarmin-associated inflammatory state and FCN1 further supports monocyte phagocytic function. These markers are consistent with SPI1- and CEBPB-driven myeloid differentiation, with additional input from TYROBP-SYK ITAM signaling and NF-kB inflammatory activation. Importantly, the cluster lacks discriminating markers of CD16 monocytes (FCGR3A/MS4A7), neutrophils (FCGR3B/CSF3R/CXCR2/ELANE), and cDC2/DC3 (CD1C/FCER1A/CLEC10A), supporting its annotation as a CD14 monocyte rather than a closely related myeloid subset. 

### 7. Refined Regulatory Network
Key Interactions:
  SPI1 -- LYZ (activation) - PU.1/SPI1 is a myeloid master TF and LYZ is a canonical PU.1-regulated myeloid gene; co-expression supports CD14 monocyte lineage.
  SPI1 -- TYROBP (activation) - TYROBP/DAP12 is a myeloid adaptor with PU.1-dependent regulation and is co-expressed with SPI1 in CD14 monocytes.
  SPI1 -- LST1 (activation) - LST1 is a monocyte-associated inflammatory gene in the PU.1/SPI1 myeloid program.
  CEBPB -- FCN1 (activation) - C/EBPβ drives monocyte inflammatory genes; FCN1 is a monocyte marker co-expressed in this cluster.
  CEBPB -- S100A8 (activation) - C/EBPβ regulates alarmin/calprotectin genes in inflammatory monocytes; S100A8 is a supplied marker.
  CEBPB -- S100A9 (activation) - C/EBPβ regulates S100A9 in myeloid inflammatory states; S100A9 is co-expressed with S100A8.
  NFKB1 -- S100A8 (activation) - NF-κB signaling induces S100A8/A9 alarmins in activated CD14 monocytes.
  RELA -- S100A9 (activation) - RelA-containing NF-κB complexes promote inflammatory S100A9 expression in monocytes.
  TYROBP -- SYK (binding) - TYROBP/DAP12 ITAM recruits and activates SYK; this ITAM module is characteristic of myeloid cells.
  NFKB1 -- SYK (activation) - ITAM/SYK signaling downstream of TYROBP activates NF-κB, linking the marker module to inflammatory gene expression.
  S100A8 -- S100A9 (binding) - S100A8 and S100A9 form the calprotectin heterodimer, a hallmark of inflammatory monocytes.

**Network Evidence:**
The supplied markers form a coherent CD14 monocyte signature: LYZ, TYROBP, LST1, and CTSS indicate myeloid/phagocytic lineage, while S100A8, S100A9, and FCN1 indicate an inflammatory classical monocyte state. The refined network connects these markers to myeloid TFs SPI1 and CEBPB, inflammatory NF-κB factors, and TYROBP-SYK ITAM signaling. This supports CD14 monocyte over CD16 monocyte (lacks FCGR3A/MS4A7), neutrophil (lacks FCGR3B/CSF3R/CXCR2/ELANE), cDC2/DC3 (lacks CD1C/FCER1A/CLEC10A), and broad myeloid terms. 
Interpretation — cluster NK_cell (Not returned)

Overview:

The marker panel describes a cytotoxic lymphocyte cluster dominated by Natural killer cell-associated genes plus a shared cytotoxic effector program. The strongest CellMarker enrichment is Natural killer cell (8/8 markers), supported by NK-discriminating markers such as XCL1/XCL2, FCGR3A and KLRD1. The cluster also strongly expresses the cytotoxic module NKG7, GNLY, PRF1 and GZMB, which explains secondary enrichment for Cytotoxic cell and CD8+ T cell. Because FCGR3A/CD16, KLRD1/CD94 and XCL1/XCL2 are more characteristic of NK cells than of conventional CD8+ T cells, the best label is Natural killer cell, with the caveat that the cytotoxic program is shared with cytotoxic T/NK-like lineages.

Regulatory drivers:

  • TBX21
  • EOMES
  • PRDM1
  • RUNX3
  • SYK

Key mechanisms:

The cluster resolves into three linked themes. First, an NK-lineage and receptor module is indicated by KLRD1/CD94, FCGR3A/CD16 and XCL1/XCL2. Second, a cytotoxic granule and exocytosis program is driven by NKG7, GNLY, PRF1 and GZMB, representing the shared effector arm of NK cells and cytotoxic CD8+ T cells. Third, FCGR3A-CD16/SYK activation signaling connects NK receptor engagement to cytotoxic granule release and effector function. The presence of NK-biased receptors and chemokines alongside the granule module favors NK cell identity over the closely related CD8+ cytotoxic T cell label.

Crosstalk and interactions:

TBX21/EOMES and PRDM1/RUNX3 feed into the shared cytotoxic granule module, while FCGR3A/CD16 signals through SYK to promote degranulation and effector responses. KLRD1/CD94 provides an NK receptor context that modulates activation, and XCL1/XCL2 secretion links the cytotoxic NK state to chemokine-mediated immune crosstalk, particularly recruitment of XCR1+ dendritic cells. CD8+ T cells can share NKG7/GNLY/PRF1/GZMB expression, but the combination of FCGR3A, KLRD1 and XCL1/XCL2 makes NK cell the more parsimonious label.

Hypothesis:

The cluster represents a cytotoxic Natural killer cell in which a TBX21/EOMES/PRDM1/RUNX3 regulatory circuit establishes NK-associated cytotoxic identity and granule effector capacity. FCGR3A/CD16-SYK activation signaling and KLRD1/CD94 receptor context further define an NK effector state, while XCL1/XCL2 secretion indicates chemokine-mediated crosstalk. The shared NKG7/GNLY/PRF1/GZMB program explains why Cytotoxic cell and CD8+ T cell terms are also enriched, but the NK-distinguishing markers support NK cell as the biological label.

Narrative draft:

The cluster is best annotated as a cytotoxic Natural killer cell. CellMarker enrichment strongly favors the Natural killer cell term, supported by NK-associated markers including XCL1/XCL2, FCGR3A and KLRD1, alongside the cytotoxic effector genes NKG7, GNLY, PRF1 and GZMB. The latter constitute a shared cytotoxic granule program that also explains enrichment for Cytotoxic cell and CD8+ T cell terms; however, the combination of FCGR3A/CD16, KLRD1/CD94 and NK chemokines is more consistent with an NK effector identity than with conventional CD8+ T cells. Regulatory inference places TBX21, EOMES, PRDM1 and RUNX3 upstream of the cytotoxic module, with FCGR3A-SYK signaling linking NK receptor engagement to degranulation. Thus the cluster most likely corresponds to an activated cytotoxic NK cell population.

Network evidence:

The refined sub-network centers on TBX21/EOMES/PRDM1/RUNX3 master regulators feeding the shared NK/CD8 cytotoxic granule module (NKG7, GNLY, PRF1, GZMB). NK-specific/strong markers KLRD1, FCGR3A, and XCL1/XCL2 connect to CD16/SYK activation and NK chemokine/effector programs, supporting Natural killer cell as the best label, with Cytotoxic cell and CD8+ T cell representing the shared cytotoxic program and closest competing lineage.

Raw object print
## Interpretation Result

### Cluster: NK_cell

**Conclusion:** Natural killer cell

### 1. Overview
The marker panel describes a cytotoxic lymphocyte cluster dominated by Natural killer cell-associated genes plus a shared cytotoxic effector program. The strongest CellMarker enrichment is Natural killer cell (8/8 markers), supported by NK-discriminating markers such as XCL1/XCL2, FCGR3A and KLRD1. The cluster also strongly expresses the cytotoxic module NKG7, GNLY, PRF1 and GZMB, which explains secondary enrichment for Cytotoxic cell and CD8+ T cell. Because FCGR3A/CD16, KLRD1/CD94 and XCL1/XCL2 are more characteristic of NK cells than of conventional CD8+ T cells, the best label is Natural killer cell, with the caveat that the cytotoxic program is shared with cytotoxic T/NK-like lineages. 

### 2. Regulatory Drivers
- TBX21
- EOMES
- PRDM1
- RUNX3
- SYK 

### 3. Key Mechanisms
The cluster resolves into three linked themes. First, an NK-lineage and receptor module is indicated by KLRD1/CD94, FCGR3A/CD16 and XCL1/XCL2. Second, a cytotoxic granule and exocytosis program is driven by NKG7, GNLY, PRF1 and GZMB, representing the shared effector arm of NK cells and cytotoxic CD8+ T cells. Third, FCGR3A-CD16/SYK activation signaling connects NK receptor engagement to cytotoxic granule release and effector function. The presence of NK-biased receptors and chemokines alongside the granule module favors NK cell identity over the closely related CD8+ cytotoxic T cell label. 

### 4. Crosstalk & Interactions
TBX21/EOMES and PRDM1/RUNX3 feed into the shared cytotoxic granule module, while FCGR3A/CD16 signals through SYK to promote degranulation and effector responses. KLRD1/CD94 provides an NK receptor context that modulates activation, and XCL1/XCL2 secretion links the cytotoxic NK state to chemokine-mediated immune crosstalk, particularly recruitment of XCR1+ dendritic cells. CD8+ T cells can share NKG7/GNLY/PRF1/GZMB expression, but the combination of FCGR3A, KLRD1 and XCL1/XCL2 makes NK cell the more parsimonious label. 

### 5. Hypothesis
The cluster represents a cytotoxic Natural killer cell in which a TBX21/EOMES/PRDM1/RUNX3 regulatory circuit establishes NK-associated cytotoxic identity and granule effector capacity. FCGR3A/CD16-SYK activation signaling and KLRD1/CD94 receptor context further define an NK effector state, while XCL1/XCL2 secretion indicates chemokine-mediated crosstalk. The shared NKG7/GNLY/PRF1/GZMB program explains why Cytotoxic cell and CD8+ T cell terms are also enriched, but the NK-distinguishing markers support NK cell as the biological label. 

### 6. Narrative Draft
The cluster is best annotated as a cytotoxic Natural killer cell. CellMarker enrichment strongly favors the Natural killer cell term, supported by NK-associated markers including XCL1/XCL2, FCGR3A and KLRD1, alongside the cytotoxic effector genes NKG7, GNLY, PRF1 and GZMB. The latter constitute a shared cytotoxic granule program that also explains enrichment for Cytotoxic cell and CD8+ T cell terms; however, the combination of FCGR3A/CD16, KLRD1/CD94 and NK chemokines is more consistent with an NK effector identity than with conventional CD8+ T cells. Regulatory inference places TBX21, EOMES, PRDM1 and RUNX3 upstream of the cytotoxic module, with FCGR3A-SYK signaling linking NK receptor engagement to degranulation. Thus the cluster most likely corresponds to an activated cytotoxic NK cell population. 

### 7. Refined Regulatory Network
Key Interactions:
  TBX21 -- NKG7 (activation) - T-bet (TBX21) is a master TF for NK/cytotoxic effector cells and promotes cytotoxic granule genes including NKG7.
  EOMES -- GNLY (activation) - Eomesodermin drives cytotoxic granule gene expression, including granulysin, in NK and CD8+ cytotoxic cells.
  PRDM1 -- PRF1 (activation) - Blimp-1 (PRDM1) promotes terminal cytotoxic differentiation and perforin expression.
  RUNX3 -- GZMB (activation) - RUNX3 is required for cytotoxic effector gene expression including granzyme B.
  FCGR3A -- SYK (activation) - CD16 (FCGR3A) signals through immunoreceptor tyrosine-based activation motifs to activate SYK.
  SYK -- NKG7 (activation) - SYK downstream of CD16/NK activation receptors contributes to cytotoxic granule mobilization and NKG7-associated effector responses.
  KLRD1 -- NKG7 (modulation) - KLRD1/CD94 is an NK receptor that modulates NK cytotoxic activation and is co-expressed with effector genes such as NKG7.
  PRDM1 -- XCL1 (activation) - PRDM1-associated effector differentiation supports chemokine XCL1 expression in cytotoxic NK cells.
  TBX21 -- XCL2 (activation) - T-bet drives NK effector/chemokine programs including XCL2 in activated cytotoxic cells.
  GNLY -- PRF1 (cooperation) - Granulysin and perforin cooperate in cytotoxic granule-mediated killing.

**Network Evidence:**
The refined sub-network centers on TBX21/EOMES/PRDM1/RUNX3 master regulators feeding the shared NK/CD8 cytotoxic granule module (NKG7, GNLY, PRF1, GZMB). NK-specific/strong markers KLRD1, FCGR3A, and XCL1/XCL2 connect to CD16/SYK activation and NK chemokine/effector programs, supporting Natural killer cell as the best label, with Cytotoxic cell and CD8+ T cell representing the shared cytotoxic program and closest competing lineage. 
Interpretation — cluster T_cell (Not returned)

Overview:

The cluster expresses canonical T-cell lineage markers CD3D, CD3E and TRBC1 together with CCR7, IL7R, LTB and MAL, a combination most consistent with naive T cells. CCR7 and MAL favor a naive rather than effector state, while IL7R and LTB support naive T-cell homing, survival and costimulation. Because no CD4 or CD8 lineage markers are present, the cluster cannot be resolved as naive CD4 versus naive CD8 T cells; memory CD8 T cells remain a closely related comparator but are less well supported by the naive-associated markers.

Regulatory drivers:

  • CCR7
  • IL7R
  • MAL
  • LTB
  • CD3D

Key mechanisms:

The TCR/CD3 signaling complex, represented by CD3D, CD3E and TRBC1, establishes T-cell lineage and antigen-receptor competence. A naive T-cell homing and survival module, represented by CCR7, IL7R and MAL, supports lymph-node homing, survival and a naive/resting state. An LTB-linked lymphotoxin/NF-kB costimulation module supports T-cell maintenance and activation readiness. The absence of CD4, CD8A/CD8B, cytotoxic, Treg and NK markers prevents resolution of naive CD4 versus naive CD8 lineage and argues against effector, Treg or NK/NKT identities.

Crosstalk and interactions:

The TCR/CD3 complex provides lineage identity and signal-transduction capability, while CCR7/IL7R/MAL and LTB/NF-kB modules maintain the naive T-cell state and survival program. CCR7 and MAL are particularly consistent with naive biology and are less expected on effector T cells. LTB may integrate with NF-kB signaling to support costimulation and survival. However, the network lacks CD4/CD8 lineage nodes, so the naive CD4 and naive CD8 possibilities remain unresolved and memory CD8 is retained only as a closely related comparator.

Hypothesis:

The cluster is a naive T-cell population, most likely naive CD4 or naive CD8 T cells, driven by TCR/CD3 signaling plus a CCR7/IL7R/MAL homing-survival program and LTB-associated costimulation. The biological meaning is that these cells are circulating or lymph-node-homing naive T cells poised for antigen encounter, but the current marker panel cannot determine CD4 versus CD8 lineage.

Narrative draft:

The cluster shows a clear T-cell identity through CD3D, CD3E and TRBC1, and its phenotype is dominated by CCR7, IL7R, LTB and MAL. CCR7 and MAL are characteristic of naive T cells, whereas IL7R and LTB support naive T-cell survival and costimulation. Enrichment for naive CD4 and naive CD8 T-cell terms is therefore consistent with the marker profile, and memory CD8 T cells remain a related but less favored comparator. Because the panel lacks CD4 and CD8 lineage markers, the most defensible interpretation is a naive T-cell cluster with unresolved CD4 versus CD8 lineage.

Network evidence:

The refined network links CD3D/CD3E/TRBC1 to TCR/CD3 signaling and connects IL7R, CCR7, MAL, and LTB into a naive T-cell homing/survival program. CCR7 and MAL are especially consistent with a naive rather than effector/memory state, while IL7R and LTB support naive T-cell maintenance. The network does not contain CD4 or CD8 lineage markers, so it supports a naive T-cell identity but cannot resolve CD4 versus CD8; the supplied naive CD4 and naive CD8 pathway terms are therefore retained as unresolved lineage possibilities, with memory CD8 as a closely related comparator.

Raw object print
## Interpretation Result

### Cluster: T_cell

**Conclusion:** Naive T cell (CD4 or CD8 unresolved)

### 1. Overview
The cluster expresses canonical T-cell lineage markers CD3D, CD3E and TRBC1 together with CCR7, IL7R, LTB and MAL, a combination most consistent with naive T cells. CCR7 and MAL favor a naive rather than effector state, while IL7R and LTB support naive T-cell homing, survival and costimulation. Because no CD4 or CD8 lineage markers are present, the cluster cannot be resolved as naive CD4 versus naive CD8 T cells; memory CD8 T cells remain a closely related comparator but are less well supported by the naive-associated markers. 

### 2. Regulatory Drivers
- CCR7
- IL7R
- MAL
- LTB
- CD3D 

### 3. Key Mechanisms
The TCR/CD3 signaling complex, represented by CD3D, CD3E and TRBC1, establishes T-cell lineage and antigen-receptor competence. A naive T-cell homing and survival module, represented by CCR7, IL7R and MAL, supports lymph-node homing, survival and a naive/resting state. An LTB-linked lymphotoxin/NF-kB costimulation module supports T-cell maintenance and activation readiness. The absence of CD4, CD8A/CD8B, cytotoxic, Treg and NK markers prevents resolution of naive CD4 versus naive CD8 lineage and argues against effector, Treg or NK/NKT identities. 

### 4. Crosstalk & Interactions
The TCR/CD3 complex provides lineage identity and signal-transduction capability, while CCR7/IL7R/MAL and LTB/NF-kB modules maintain the naive T-cell state and survival program. CCR7 and MAL are particularly consistent with naive biology and are less expected on effector T cells. LTB may integrate with NF-kB signaling to support costimulation and survival. However, the network lacks CD4/CD8 lineage nodes, so the naive CD4 and naive CD8 possibilities remain unresolved and memory CD8 is retained only as a closely related comparator. 

### 5. Hypothesis
The cluster is a naive T-cell population, most likely naive CD4 or naive CD8 T cells, driven by TCR/CD3 signaling plus a CCR7/IL7R/MAL homing-survival program and LTB-associated costimulation. The biological meaning is that these cells are circulating or lymph-node-homing naive T cells poised for antigen encounter, but the current marker panel cannot determine CD4 versus CD8 lineage. 

### 6. Narrative Draft
The cluster shows a clear T-cell identity through CD3D, CD3E and TRBC1, and its phenotype is dominated by CCR7, IL7R, LTB and MAL. CCR7 and MAL are characteristic of naive T cells, whereas IL7R and LTB support naive T-cell survival and costimulation. Enrichment for naive CD4 and naive CD8 T-cell terms is therefore consistent with the marker profile, and memory CD8 T cells remain a related but less favored comparator. Because the panel lacks CD4 and CD8 lineage markers, the most defensible interpretation is a naive T-cell cluster with unresolved CD4 versus CD8 lineage. 

### 7. Refined Regulatory Network
Key Interactions:
  CD3D -- CD3E (binding) - CD3D and CD3E are canonical components of the TCR/CD3 complex and co-occur as T-cell lineage markers.
  MAL -- CD3E (activation) - MAL is a lipid-raft-associated protein that facilitates TCR/CD3 signal transduction in T cells.
  IL7R -- CCR7 (activation) - IL-7 receptor signaling supports naive T-cell survival and is associated with maintenance of the naive homing program including CCR7.
  MAL -- CCR7 (co-expression) - CCR7 and MAL are co-expressed in naive T cells and support lymphoid homing and naive T-cell identity.
  IL7R -- LTB (co-expression) - LTB and IL7R are expressed in naive T cells and contribute to survival/costimulatory programs; their co-expression supports a naive T-cell module.
  IL7R -- CD3E (co-expression) - CD3E marks TCR-bearing T cells while IL7R marks naive/survival-associated T cells, together supporting a naive T-cell state.

**Network Evidence:**
The refined network links CD3D/CD3E/TRBC1 to TCR/CD3 signaling and connects IL7R, CCR7, MAL, and LTB into a naive T-cell homing/survival program. CCR7 and MAL are especially consistent with a naive rather than effector/memory state, while IL7R and LTB support naive T-cell maintenance. The network does not contain CD4 or CD8 lineage markers, so it supports a naive T-cell identity but cannot resolve CD4 versus CD8; the supplied naive CD4 and naive CD8 pathway terms are therefore retained as unresolved lineage possibilities, with memory CD8 as a closely related comparator. 

When the book is rendered without DEEPSEEK_API_KEY, the two chunks above are skipped and the rest of the chapter still renders. When the key is present, a render performs a real DeepSeek call; keep the cache enabled for ordinary builds and clear interpretation_cache/ deliberately when a fresh report is wanted.

37.2 Extended evidence inputs

interpret_agent() applies three sequential stages to an interpretation request:

  1. Term curation selects and organizes the supplied enrichment terms in the stated biological context; it does not rerun the enrichment test.
  2. Evidence inspection combines the result object with optional gene-level changes and interaction data to identify genes or modules that support each term.
  3. Narrative drafting writes the checked inputs into the structured interpretation fields used by the report and plotting methods.

The implementation refers to these stages as Cleaner, Detective, and Storyteller. They are components of one shared-model pipeline, not separate statistical analyses. The stages share one evidence bundle, and their output remains a model-generated draft that should be checked against the original result object.

context <- "scRNA-seq analysis of CD8+ T cells in tumor microenvironment, comparing exhausted and naive states."
res <- interpret_agent(edo, context = context)

37.3 PPI and expression evidence

Set add_ppi = TRUE to request protein interactions from STRING. Pass a named gene_fold_change vector to retain expression direction in the interpretation. These inputs add network and expression evidence; they do not establish pathway activity or causality.

# Prepare a named vector of fold changes
gene_list <- c("CD8A" = 2.5, "PDCD1" = 1.8, "GZMB" = 3.2)

res <- interpret(
    edo,
    add_ppi = TRUE,
    gene_fold_change = gene_list
)

37.4 Prior labels and hierarchical inputs

For cell-type annotation, prior supplies an existing label for comparison. The returned annotation can agree with, refine, or disagree with that label; inspect the markers and enrichment terms before accepting a change.

my_priors <- c("T_cell" = "T cells")
res <- interpret_agent(
    edo,
    prior = my_priors,
    context = "Which cell type does each cluster most likely correspond to?"
)
res$prior_verdict

interpret_hierarchical() accepts major- and minor-cluster enrichment objects together with a mapping. It constrains each minor-cluster interpretation to the supplied major-cluster context; the mapping itself must be checked against the experimental design.

cluster_mapping <- c(
    "SubCluster1_1" = "MajorCluster1",
    "SubCluster1_2" = "MajorCluster1",
    "SubCluster2_1" = "MajorCluster2"
)
cluster_mapping
  SubCluster1_1   SubCluster1_2   SubCluster2_1 
"MajorCluster1" "MajorCluster1" "MajorCluster2" 
res_hier <- interpret_hierarchical(
    x_minor = enrich_minor,
    x_major = enrich_major,
    mapping = cluster_mapping
)

37.5 When enrichment returns no terms

When a result has no enriched terms, interpret_agent() can be given the input genes and optional PPI data. The implementation warns that no significant pathways were found, passes the raw genes to the Detective and Storyteller stages, and marks the returned object with data_source = "gene_list_only". The output should therefore be reported as a gene-based hypothesis; its confidence is taken from the returned object rather than assigned a fixed value.

res <- interpret_agent(tough_genes, add_ppi = TRUE)

37.6 Visualization of interpretation objects

The plot() method displays relationships stored in an interpretation object. When the returned object contains them, the plot can distinguish key drivers, activation or inhibition labels, and physical interactions. These labels are model outputs and require review against the supplied expression and interaction evidence.

plot(res)

The complete hand-off is:

enrichment result → optional fold-change/PPI/prior evidence
                  → interpretation object → report or plot

The final report and plot are views of the interpretation object. They do not constitute a second enrichment test, and interaction edges remain external supporting evidence.

37.7 Operational checks

context should identify the experiment, biological setting, contrast direction, and any relevant cell-type or tissue resolution. interpret() cannot infer these details from pathway names alone.

A weak context names only the assay:

context <- "scRNA-seq of T cells"
context
[1] "scRNA-seq of T cells"

A strong context answers six questions in one or two sentences:

Question Example
Species and tissue human breast tumour, bulk tissue
Disease / biological setting breast carcinoma, tumour grade
Experimental design 200 samples from the MAINZ cohort
Contrast tested, and its direction grade III vs. grade I; positive values are higher in grade III
Cell type / composition bulk tissue, no cell-type resolution
Hypothesis under test progression involves loss of epithelial differentiation and ECM remodelling

Written out, that is still only a few lines:

context <- paste(
  "Human breast-cancer transcriptome (MAINZ cohort, bulk tumour tissue, 200",
  "samples). Genes are ranked by the log2 ratio of geometric-mean expression in",
  "grade III versus grade I tumours, so positive values are higher in the",
  "higher-grade tumours. No cell-type resolution is available. Hypothesis:",
  "progression from grade I to grade III involves loss of epithelial",
  "differentiation and increased extracellular-matrix remodelling."
)
context
[1] "Human breast-cancer transcriptome (MAINZ cohort, bulk tumour tissue, 200 samples). Genes are ranked by the log2 ratio of geometric-mean expression in grade III versus grade I tumours, so positive values are higher in the higher-grade tumours. No cell-type resolution is available. Hypothesis: progression from grade I to grade III involves loss of epithelial differentiation and increased extracellular-matrix remodelling."

Two rules of thumb follow. First, state the direction of the contrast – “A vs. B” without saying which side is up is a common way to get a report with the regulation backwards. Second, do not put the answer in the context: if you write “we expect apoptosis to be suppressed”, the model will often agree with you regardless of the data. Describe the design, not the conclusion you are hoping for. (If your data are from single cells, add the cell type or the compartment the cluster belongs to; for bulk tissue, saying that no cell-type resolution exists is more useful than omitting the point.)

37.7.1 Choosing a Model and Switching Provider

Model selection is delegated to aisdk. interpret() itself has no model registry and no provider logic: when model is left at its default (NULL) it uses whatever aisdk currently considers the default, and model = "provider:model" overrides that default for a single call.

library(aisdk)

# Session-wide default, used by every interpret() call that omits `model`
set_model("deepseek:deepseek-v4-flash")
get_model()

Calls that omit model use the session-wide setting selected with set_model(). Pass model for a one-off provider or model.

res <- interpret(edo, model = "openai:gpt-4o")

Credentials follow the same rule. aisdk reads each provider’s key from an environment variable: OPENAI_API_KEY, ANTHROPIC_API_KEY and GEMINI_API_KEY for the three providers bundled with aisdk, and the corresponding variable for the adapters in aisdk.providers (for example DEEPSEEK_API_KEY, which is what this chapter uses). Put the key in a project .Renviron or export it in the shell; interpret() never takes a key argument. If you never call set_model(), aisdk falls back to its built-in default, openai:gpt-4o – which is why the examples you may have seen elsewhere appear to use GPT-4o by default.

aisdk ships a catalogue of the providers and models it knows about:

list_models()            # every provider and model aisdk knows about
list_models("openai")    # just one provider

Model choice affects latency, cost, context capacity, and output variability. Fix the model when comparing reports, because different models can produce different summaries from the same input.

37.7.2 Multi-Model and Consensus Workflows

There is no built-in consensus or ensemble mode in interpret() or interpret_agent(). A call goes to exactly one model. interpret_agent() is a multi-agent pipeline, not a multi-model one: its three agents share a single model.

What you can do today is run the same input through several models and compare the reports yourself. Because model = is a per-call argument, this needs no extra machinery:

res_deepseek <- interpret(edo, model = "deepseek:deepseek-v4-flash")
res_gpt      <- interpret(edo, model = "openai:gpt-4o")

Each call is a separate, billable request, and the two reports will not be identical even for the same model (see below). A pragmatic middle ground is to use one model to write the report and a second, independent call only to criticise it: ask a different model whether every gene and pathway named in the narrative is actually present in the input table. That is a manual workflow, but it catches the most common failure mode – plausible-sounding genes that were never in the data. For provider failover, aisdk provides generate_text_fallback() for its own generation calls, but interpret() does not expose a fallback argument.

37.7.3 Practical Guidance and Pitfalls

Non-determinism. interpret() samples at temperature = 0.3 by default, so two calls with identical input will differ in wording and occasionally in emphasis. This is expected, not a bug. It has a direct consequence for reproducible builds: Quarto’s chunk cache (cache: true) is what keeps the published page stable – the LLM call runs once and its output is reused on later renders. Clear the cache and you will get a different report. If you need the exact same text in two places, cache the object and reuse it.

Unsupported entities. The model is instructed to ground claims in the supplied table, but it can still produce incorrect output. Before quoting a report, check that every gene named in the narrative appears in the geneID (or, for GSEA, core_enrichment) column and every pathway named appears in Description. If add_ppi = TRUE, identify the cited edges as STRING evidence, not measurements from the experiment.

n_pathways. Only the top n_pathways terms (default 20) are sent to the model, ordered by adjusted p-value (p.adjust, falling back to pvalue). Raising it gives the model more to work with but dilutes the signal and enlarges the prompt; lowering it forces a tighter focus. For a compareClusterResult, interpret() splits the result by cluster and returns one report per cluster, so the number of calls – and the cost – scales with the number of clusters, not with n_pathways.

max_tokens. The default is 8192. Reasoning models spend part of that budget deliberating before they emit the JSON, and if they run out, the reply is truncated and cannot be parsed; the symptom is a warning mentioning finish_reason: length and a placeholder report. If you hit it, raise max_tokens (the diagnostic suggests 16384 or more) or switch to a model that does not reason before answering.

Seeing the cost. interpret() returns only the parsed report; token usage is not part of the returned object. Run with verbose = TRUE to print the raw response and the prompt/completion/total token counts – the practical way to watch spend while you tune n_pathways and max_tokens.

add_ppi. Setting add_ppi = TRUE queries STRING for the genes in the top terms and injects the edge list into the prompt, which lets the model identify functional modules from individual genes. It requires network access, adds latency, and is a second failure point; the query is wrapped so that a STRING outage degrades to “no network evidence” instead of an error. Leave it at its default (FALSE) unless module-level reasoning is what you need.

gene_fold_change. Passing a named numeric vector of log fold changes adds the direction of regulation to the prompt. Note the limitation: the helper intersects your vector with the genes in the result’s geneID column, and a gseaResult table has no geneID column (it carries core_enrichment instead). So gene_fold_change is used for over-representation results (enrichResult, compareClusterResult) and silently ignored for GSEA results – which is harmless, because a GSEA result already encodes direction in the sign of its enrichment score.

Ranking. For over-representation results the terms are ordered by p.adjust; for GSEA the direction the model sees is the sign of NES. If your GSEA ranked list was built so that positive means “up in the condition of interest”, say so in context – otherwise the model has to guess the orientation.

Treat the output as an unverified draft. Check every gene and pathway named in the narrative against the input table; then assess whether each mechanistic statement has supporting evidence.

37.8 Worked Example: From Enrichment to a Report

This example builds a GSEA result offline from the geneList shipped with DOSE, passes a defined context to interpret(), and renders the returned report. The interpret_agent() example above is disabled because it makes multiple model calls.

library(clusterProfiler)
library(org.Hs.eg.db)

data(geneList, package = "DOSE")

# A real enrichment result, computed offline: GSEA over GO cellular components.
# geneList is the DOSE demo list -- log2 ratios of grade III vs. grade I tumours
# from the MAINZ breast-cancer cohort.
gse <- gseGO(
    geneList      = geneList,
    OrgDb         = org.Hs.eg.db,
    keyType       = "ENTREZID",
    ont           = "CC",
    minGSSize     = 15,
    maxGSSize     = 100,
    eps           = 0,
    pvalueCutoff  = 0.05,
    pAdjustMethod = "BH"
)

# A context that names the species, tissue, design, contrast and hypothesis.
context <- paste(
    "Human breast-cancer transcriptome (MAINZ cohort, bulk tumour tissue).",
    "Genes are ranked by the log2 ratio of geometric-mean expression in grade",
    "III versus grade I tumours, so positive values are higher in the",
    "higher-grade tumours. Hypothesis: progression from grade I to grade III",
    "involves loss of epithelial differentiation and increased",
    "extracellular-matrix remodelling."
)

report <- interpret(gse, context = context, n_pathways = 15)

if (interpret_failed(report)) {
    stop("interpret() returned no report -- check the API key and quota:\n",
         report$overview)
}

cat(render_interpretation_blocks(report), sep = "\n")
Interpretation — cluster Default (Not returned)

Overview:

The enrichment results separate high-grade breast tumours into two major contrasting programmes. Negative enrichment in grade III versus grade I is dominated by extracellular-matrix and basement-membrane differentiation terms, including elastic fiber, solid phase of basement membrane, non-collagenous component of basement membrane, gel phase of interstitial matrix, collagen trimer and complex of collagen trimers, with core genes such as ELN, FBLN5, LTBP3/4, COL4A5/6, LAMA2/3/4, LAMB1/2, NID1/2, HSPG2, DCN, LUM, OGN and VCAN. Positive enrichment in grade III is dominated by mitotic and proliferative machinery, including spindle midzone, spindle microtubule, outer kinetochore, kinesin complex and condensed nuclear chromosome, with PLK1, AURKA, AURKB, CDK1, CCNB1, BIRC5, NDC80, BUB1B and kinesins, as well as proteasome complex, immunoglobulin complex and specific granule lumen. Thus, grade progression is associated with loss of differentiated ECM/basement-membrane/elastic-fiber architecture and gain of mitotic, proteostatic and immune/granule programmes.

Regulatory drivers:

  • No transcription-factor or upstream-regulator enrichment term is present in the supplied results, so the strongest supported regulatory drivers are pathway-embedded master kinases and checkpoint proteins rather than named TFs. These include PLK1, AURKA, AURKB, CDK1, CHEK1 and NEK2, together with BIRC5, CCNB1, NDC80, BUB1B and ZWINT, all co-enriched in spindle midzone, spindle microtubule, outer kinetochore and condensed nuclear chromosome. Their coordinated positive enrichment supports increased mitotic kinase/checkpoint activity in grade III. On the ECM side, downregulated elastic-fiber and basement-membrane components include LOXL2, LOXL1, LTBP2/3/4, FBLN5/1/2, EFEMP1/2, DCN, LUM, OGN and ASPN, consistent with loss of matrix-assembly and matrix-crosslinking regulators. Immune/granule regulators include SYK and CD79B within the immunoglobulin complex and HPSE, ELANE and CXCL1 within specific granule lumen.

Key mechanisms:

Major theme 1 is loss of differentiated ECM and basement-membrane architecture in higher-grade tumours: elastic fiber (LOXL2, ELN, FBLN5, LTBP3/4, COL6A1/A3, MFAP3/4/5), solid phase of basement membrane (COL4A6, LAMA2/3/4, LAMB1/2, NID1/2, HSPG2, PXDN, SPARC, POSTN), non-collagenous component of basement membrane, gel phase of interstitial matrix (LUM, PRELP, VCAN, BGN, ECM2, FMOD, DCN, OMD, CHAD, ASPN, OGN), collagen trimer and complex of collagen trimers (COL1A1/2, COL3A1, COL5A1/2/3, COL6A1/2/3, COL8A1/2, COL14A1, COL16A1 and others). Major theme 2 is increased mitotic/proliferative machinery: spindle midzone (CDCA8, KIF18A/B, BIRC5, AURKB, PRC1, AURKA, PLK1, RACGAP1), spindle microtubule (CENPE, SKA1, CDK1, KIF11, AURKA/B, PLK1), outer kinetochore (NDC80, SKA1, CCNB1, PLK1, BUB1B, ZWINT, SPC25, BUB1, CENPF, DSN1), kinesin complex and condensed nuclear chromosome (NCAPH, NEK2, NCAPG, CHEK1, PLK1, RAD51, BRCA1/2, H2AX). Major theme 3 is proteostasis: proteasome complex and proteasome storage granule. Major theme 4 is immune/granule biology: immunoglobulin complex (IGHM, IGKC, CD79B, SYK) and specific granule lumen (CAMP, HPSE, LYZ, LCN2, ELANE, CXCL1, CHI3L1, PTX3).

Crosstalk and interactions:

The ECM-loss programme is potentially linked to the positive granule/immune programme through matrix-degrading effectors. HPSE, which is positively enriched in specific granule lumen, can degrade heparan sulfate proteoglycans such as HSPG2, a negatively enriched basement-membrane component; ELANE in the same granule-lumen term can degrade collagen, while collagen trimer and complex of collagen trimers are downregulated. The ECM terms also contain LTBP2/3/4 and IGFBP2/4/6/7, suggesting coordinated loss of matrix-associated growth-factor-binding proteins alongside structural collagens and laminins. The mitotic programme is internally coherent: AURKB and BIRC5 co-occur in spindle midzone and spindle microtubule, CDK1 and CCNB1 co-occur in outer kinetochore and condensed nuclear chromosome, and PLK1/AURKA/BUB1B/NDC80 map to spindle and kinetochore modules. Proteasome complex and proteasome storage granule are co-enriched with mitotic genes, consistent with proteasome-dependent control of mitotic regulators such as cyclins and checkpoint proteins. Immunoglobulin complex components SYK and CD79B and specific granule lumen effectors HPSE, ELANE and CXCL1 provide a third axis that may connect inflammatory/proteolytic remodelling to loss of basement-membrane integrity.

Hypothesis:

The data refine the original progression hypothesis: grade III breast tumours are characterized not by a uniform gain of ECM but by loss of differentiated ECM/basement-membrane/elastic-fiber and interstitial-matrix transcripts, together with increased mitotic/kinetochore/spindle, proteasome and immune/granule programmes. Loss of basement-membrane components such as LAMA2/3/4, LAMB1/2, COL4A5/6, NID1/2 and HSPG2, and loss of elastic-fiber/collagen genes such as ELN, FBLN5, LTBP3/4 and multiple COL genes, would reduce epithelial-stromal integrity and differentiated tissue architecture. Concomitant positive enrichment of HPSE, ELANE and CXCL1 in specific granule lumen suggests that matrix degradation and inflammatory remodelling accompany this structural loss, while PLK1, AURKA, AURKB, CDK1, BIRC5, NDC80 and BUB1B drive increased mitotic activity. Therefore, high-grade progression may reflect a coupled state of ECM dedifferentiation plus proteolytic/inflammatory remodelling and proliferative expansion.

Narrative draft:

In this human breast-cancer transcriptome cohort, grade III tumours compared with grade I tumours showed coordinated downregulation of genes defining elastic fiber, solid and non-collagenous basement-membrane compartments, gel-phase interstitial matrix and collagen trimers, including ELN, FBLN5, LTBP3/4, COL4A5/6, LAMA2/3/4, LAMB1/2, NID1/2, HSPG2, DCN, LUM, OGN and VCAN. Conversely, grade III tumours were enriched for spindle midzone, spindle microtubule, outer kinetochore, kinesin complex and condensed nuclear chromosome genes such as PLK1, AURKA, AURKB, CDK1, CCNB1, BIRC5, NDC80, BUB1B and multiple kinesins, as well as proteasome complex, immunoglobulin complex and specific granule lumen components. These findings support a model in which loss of differentiated ECM/basement-membrane architecture is accompanied by increased mitotic machinery and by granule/immune effectors such as HPSE, ELANE and CXCL1 that may promote matrix degradation and inflammatory remodelling. The data therefore connect epithelial/ECM dedifferentiation to proliferative and proteolytic programmes in high-grade breast cancer.

Network evidence:

The refined network is restricted to modules directly supported by co-enrichment. The mitotic module combines spindle midzone/spindle microtubule components AURKA, PLK1, AURKB and BIRC5, outer-kinetochore/condensed-chromosome components CDK1, CCNB1, BUB1B, ZWINT, NDC80 and SPC25, and checkpoint/DNA-damage components CHEK1, BRCA1, RAD51 and H2AX. The ECM module combines collagen trimer/complex of collagen trimers components COL1A1, COL1A2, COL4A5 and COL4A6 with solid-phase basement-membrane laminin/nidogen components LAMA2, LAMB1 and NID1, elastic-fiber components FBLN5, ELN, LTBP4 and FBN1, and interstitial-matrix proteoglycans DCN and LUM. The immune/granule module connects immunoglobulin complex components SYK, CD79B and IGHM with specific granule lumen effectors HPSE and ELANE, and the proteasome module includes PSMA7, PSMB5, VCP and PSMD1 from proteasome complex. These edges highlight mitotic kinase/kinetochore, ECM basement-membrane/elastic-fiber, immune/granule-protease and proteasome hubs as the core network structure.

Raw object print
## Interpretation Result

### Cluster: Default

### 1. Overview
The enrichment results separate high-grade breast tumours into two major contrasting programmes. Negative enrichment in grade III versus grade I is dominated by extracellular-matrix and basement-membrane differentiation terms, including elastic fiber, solid phase of basement membrane, non-collagenous component of basement membrane, gel phase of interstitial matrix, collagen trimer and complex of collagen trimers, with core genes such as ELN, FBLN5, LTBP3/4, COL4A5/6, LAMA2/3/4, LAMB1/2, NID1/2, HSPG2, DCN, LUM, OGN and VCAN. Positive enrichment in grade III is dominated by mitotic and proliferative machinery, including spindle midzone, spindle microtubule, outer kinetochore, kinesin complex and condensed nuclear chromosome, with PLK1, AURKA, AURKB, CDK1, CCNB1, BIRC5, NDC80, BUB1B and kinesins, as well as proteasome complex, immunoglobulin complex and specific granule lumen. Thus, grade progression is associated with loss of differentiated ECM/basement-membrane/elastic-fiber architecture and gain of mitotic, proteostatic and immune/granule programmes. 

### 2. Regulatory Drivers
No transcription-factor or upstream-regulator enrichment term is present in the supplied results, so the strongest supported regulatory drivers are pathway-embedded master kinases and checkpoint proteins rather than named TFs. These include PLK1, AURKA, AURKB, CDK1, CHEK1 and NEK2, together with BIRC5, CCNB1, NDC80, BUB1B and ZWINT, all co-enriched in spindle midzone, spindle microtubule, outer kinetochore and condensed nuclear chromosome. Their coordinated positive enrichment supports increased mitotic kinase/checkpoint activity in grade III. On the ECM side, downregulated elastic-fiber and basement-membrane components include LOXL2, LOXL1, LTBP2/3/4, FBLN5/1/2, EFEMP1/2, DCN, LUM, OGN and ASPN, consistent with loss of matrix-assembly and matrix-crosslinking regulators. Immune/granule regulators include SYK and CD79B within the immunoglobulin complex and HPSE, ELANE and CXCL1 within specific granule lumen. 

### 3. Key Mechanisms
Major theme 1 is loss of differentiated ECM and basement-membrane architecture in higher-grade tumours: elastic fiber (LOXL2, ELN, FBLN5, LTBP3/4, COL6A1/A3, MFAP3/4/5), solid phase of basement membrane (COL4A6, LAMA2/3/4, LAMB1/2, NID1/2, HSPG2, PXDN, SPARC, POSTN), non-collagenous component of basement membrane, gel phase of interstitial matrix (LUM, PRELP, VCAN, BGN, ECM2, FMOD, DCN, OMD, CHAD, ASPN, OGN), collagen trimer and complex of collagen trimers (COL1A1/2, COL3A1, COL5A1/2/3, COL6A1/2/3, COL8A1/2, COL14A1, COL16A1 and others). Major theme 2 is increased mitotic/proliferative machinery: spindle midzone (CDCA8, KIF18A/B, BIRC5, AURKB, PRC1, AURKA, PLK1, RACGAP1), spindle microtubule (CENPE, SKA1, CDK1, KIF11, AURKA/B, PLK1), outer kinetochore (NDC80, SKA1, CCNB1, PLK1, BUB1B, ZWINT, SPC25, BUB1, CENPF, DSN1), kinesin complex and condensed nuclear chromosome (NCAPH, NEK2, NCAPG, CHEK1, PLK1, RAD51, BRCA1/2, H2AX). Major theme 3 is proteostasis: proteasome complex and proteasome storage granule. Major theme 4 is immune/granule biology: immunoglobulin complex (IGHM, IGKC, CD79B, SYK) and specific granule lumen (CAMP, HPSE, LYZ, LCN2, ELANE, CXCL1, CHI3L1, PTX3). 

### 4. Crosstalk & Interactions
The ECM-loss programme is potentially linked to the positive granule/immune programme through matrix-degrading effectors. HPSE, which is positively enriched in specific granule lumen, can degrade heparan sulfate proteoglycans such as HSPG2, a negatively enriched basement-membrane component; ELANE in the same granule-lumen term can degrade collagen, while collagen trimer and complex of collagen trimers are downregulated. The ECM terms also contain LTBP2/3/4 and IGFBP2/4/6/7, suggesting coordinated loss of matrix-associated growth-factor-binding proteins alongside structural collagens and laminins. The mitotic programme is internally coherent: AURKB and BIRC5 co-occur in spindle midzone and spindle microtubule, CDK1 and CCNB1 co-occur in outer kinetochore and condensed nuclear chromosome, and PLK1/AURKA/BUB1B/NDC80 map to spindle and kinetochore modules. Proteasome complex and proteasome storage granule are co-enriched with mitotic genes, consistent with proteasome-dependent control of mitotic regulators such as cyclins and checkpoint proteins. Immunoglobulin complex components SYK and CD79B and specific granule lumen effectors HPSE, ELANE and CXCL1 provide a third axis that may connect inflammatory/proteolytic remodelling to loss of basement-membrane integrity. 

### 5. Hypothesis
The data refine the original progression hypothesis: grade III breast tumours are characterized not by a uniform gain of ECM but by loss of differentiated ECM/basement-membrane/elastic-fiber and interstitial-matrix transcripts, together with increased mitotic/kinetochore/spindle, proteasome and immune/granule programmes. Loss of basement-membrane components such as LAMA2/3/4, LAMB1/2, COL4A5/6, NID1/2 and HSPG2, and loss of elastic-fiber/collagen genes such as ELN, FBLN5, LTBP3/4 and multiple COL genes, would reduce epithelial-stromal integrity and differentiated tissue architecture. Concomitant positive enrichment of HPSE, ELANE and CXCL1 in specific granule lumen suggests that matrix degradation and inflammatory remodelling accompany this structural loss, while PLK1, AURKA, AURKB, CDK1, BIRC5, NDC80 and BUB1B drive increased mitotic activity. Therefore, high-grade progression may reflect a coupled state of ECM dedifferentiation plus proteolytic/inflammatory remodelling and proliferative expansion. 

### 6. Narrative Draft
In this human breast-cancer transcriptome cohort, grade III tumours compared with grade I tumours showed coordinated downregulation of genes defining elastic fiber, solid and non-collagenous basement-membrane compartments, gel-phase interstitial matrix and collagen trimers, including ELN, FBLN5, LTBP3/4, COL4A5/6, LAMA2/3/4, LAMB1/2, NID1/2, HSPG2, DCN, LUM, OGN and VCAN. Conversely, grade III tumours were enriched for spindle midzone, spindle microtubule, outer kinetochore, kinesin complex and condensed nuclear chromosome genes such as PLK1, AURKA, AURKB, CDK1, CCNB1, BIRC5, NDC80, BUB1B and multiple kinesins, as well as proteasome complex, immunoglobulin complex and specific granule lumen components. These findings support a model in which loss of differentiated ECM/basement-membrane architecture is accompanied by increased mitotic machinery and by granule/immune effectors such as HPSE, ELANE and CXCL1 that may promote matrix degradation and inflammatory remodelling. The data therefore connect epithelial/ECM dedifferentiation to proliferative and proteolytic programmes in high-grade breast cancer. 

### 7. Refined Regulatory Network
Key Interactions:
  AURKA -- PLK1 (activation) - Both are co-enriched in spindle midzone and spindle microtubule, supporting a mitotic kinase module.
  AURKB -- BIRC5 (binding) - Both are co-enriched in spindle midzone and spindle microtubule, consistent with the chromosomal passenger complex.
  CDK1 -- CCNB1 (binding/activation) - Both are co-enriched in outer kinetochore and condensed nuclear chromosome, consistent with the CDK1-cyclin B1 mitotic complex.
  PLK1 -- BUB1B (activation) - Both are co-enriched in outer kinetochore and condensed nuclear chromosome, linking PLK1 to spindle-checkpoint regulation.
  BUB1B -- ZWINT (binding) - Both are co-enriched in outer kinetochore, consistent with kinetochore recruitment of BUBR1 by ZWINT.
  NDC80 -- SPC25 (binding) - Both are co-enriched in outer kinetochore, consistent with the NDC80 kinetochore complex.
  PLK1 -- PRC1 (activation) - Both are co-enriched in spindle midzone and spindle microtubule, linking PLK1 to midzone organization.
  CDK1 -- CHEK1 (inhibition) - Both are co-enriched in condensed nuclear chromosome, consistent with checkpoint kinase control of CDK1.
  BRCA1 -- RAD51 (activation) - Both are co-enriched in condensed nuclear chromosome, consistent with homologous-recombination regulation.
  BRCA1 -- H2AX (recruitment) - Both are co-enriched in condensed nuclear chromosome, consistent with DNA-damage response recruitment.
  COL1A1 -- COL1A2 (binding) - Both are co-enriched in collagen trimer and complex of collagen trimers, consistent with type I collagen heterotrimer formation.
  COL4A5 -- COL4A6 (binding) - Both are co-enriched in solid phase of basement membrane, consistent with collagen IV network assembly.
  LAMA2 -- LAMB1 (binding) - Both are co-enriched in solid phase of basement membrane, consistent with laminin heterotrimer assembly.
  LAMB1 -- NID1 (binding) - Both are co-enriched in solid phase of basement membrane, consistent with nidogen-laminin basement-membrane bridging.
  FBLN5 -- ELN (binding) - Both are co-enriched in elastic fiber, consistent with fibulin-5 association with elastin.
  LTBP4 -- FBN1 (binding) - Both are co-enriched in elastic fiber and basement-membrane terms, consistent with microfibril-associated matrix assembly.
  COL1A1 -- DCN (binding) - Both are co-enriched in collagen trimer and gel phase of interstitial matrix, consistent with decorin binding to collagen.
  LUM -- COL1A2 (binding) - Both are co-enriched in collagen trimer and gel phase of interstitial matrix, consistent with lumican-collagen interaction.
  HPSE -- HSPG2 (cleavage/degradation) - HPSE is positively enriched in specific granule lumen while HSPG2 is negatively enriched in solid phase of basement membrane, linking heparanase to basement-membrane heparan sulfate proteoglycan loss.
  COL1A1 -- ELANE (cleavage/degradation) - ELANE is positively enriched in specific granule lumen while collagen trimer genes including COL1A1 are negatively enriched, linking granule protease activity to collagen loss.
  SYK -- CD79B (activation/binding) - Both are co-enriched in immunoglobulin complex, consistent with B-cell receptor signalling.
  IGHM -- CD79B (binding) - Both are co-enriched in immunoglobulin complex, consistent with surface immunoglobulin-BCR association.
  PSMA7 -- PSMB5 (binding) - Both are co-enriched in proteasome complex, consistent with proteasome subunit assembly.
  VCP -- PSMD1 (binding) - Both are co-enriched in proteasome complex, consistent with proteasome-associated regulatory interactions.

**Network Evidence:**
The refined network is restricted to modules directly supported by co-enrichment. The mitotic module combines spindle midzone/spindle microtubule components AURKA, PLK1, AURKB and BIRC5, outer-kinetochore/condensed-chromosome components CDK1, CCNB1, BUB1B, ZWINT, NDC80 and SPC25, and checkpoint/DNA-damage components CHEK1, BRCA1, RAD51 and H2AX. The ECM module combines collagen trimer/complex of collagen trimers components COL1A1, COL1A2, COL4A5 and COL4A6 with solid-phase basement-membrane laminin/nidogen components LAMA2, LAMB1 and NID1, elastic-fiber components FBLN5, ELN, LTBP4 and FBN1, and interstitial-matrix proteoglycans DCN and LUM. The immune/granule module connects immunoglobulin complex components SYK, CD79B and IGHM with specific granule lumen effectors HPSE and ELANE, and the proteasome module includes PSMA7, PSMB5, VCP and PSMD1 from proteasome complex. These edges highlight mitotic kinase/kinetochore, ECM basement-membrane/elastic-fiber, immune/granule-protease and proteasome hubs as the core network structure. 

The printed report follows the schema described at the top of this chapter. Read it in this order:

  1. 1. Overview – the model’s one-paragraph summary. If it is vague, the context was probably too vague.
  2. 2. Regulatory Drivers and 3. Key Mechanisms – the “who” and the “how”. Check every named gene against your input table.
  3. 5. Hypothesis – the “so what”. This is the part worth arguing with.
  4. 6. Narrative Draft – a paragraph written for a Results or Discussion section. It is a draft: edit it, do not paste it.
  5. 7. Refined Regulatory Network – populated only when the model can support edges; plot(report) draws the same network with ggtangle when it is available.

37.9 Next steps

  • For the preceding evidence objects, see evidence integration.
  • For a reproducible hand-off, record the analysis in the reference appendix.
  • Keep optional AI assistance after statistical checking and external evidence review.