Last updated: 2026-07-02
Checks: 5 1
Knit directory:
immgenT-GP-analysis/analysis/
This reproducible R Markdown analysis was created with workflowr (version 1.7.2). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.
Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.
The command set.seed(1) was run prior to running the
code in the R Markdown file. Setting a seed ensures that any results
that rely on randomness, e.g. subsampling or permutations, are
reproducible.
Great job! Recording the operating system, R version, and package versions is critical for reproducibility.
Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.
Great job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
Tracking code development and connecting the code version to the
results is critical for reproducibility. To start using Git, open the
Terminal and type git init in your project directory.
This project is not being versioned with Git. To obtain the full
reproducibility benefits of using workflowr, please see
?wflow_start.
Produced by script-refactor/TableS1.R:
# Supplementary Table 1: per-GP summary.
#
# One row per GP: which Level-1/Level-2/condition/organ categories it
# predicts well (AUC > 0.8, driven by high loading), plus its top positive
# and negative signature genes.
#
# Source: ported from script/Supplement_Table1.R (unchanged apart from the
# output path).
data_path <- "data/"
output_path <- "figure-refactor/"
L_pm_filtered <- readRDS(paste0(data_path, "L_pm_filtered.rds"))
F_pm_filtered <- readRDS(paste0(data_path, "F_pm_filtered.rds"))
level_1_AUC_list <- readRDS(paste0(data_path, "level_1_AUC_list_figure.rds"))
level_2_AUC_list <- readRDS(paste0(data_path, "level_2_AUC_list_figure.rds"))
condition_detailed_AUC_list_figure <- readRDS(paste0(data_path, "condition_detailed_AUC_list_figure.rds"))
organ_simplified_AUC_list_figure <- readRDS(paste0(data_path, "organ_simplified_AUC_list_figure.rds"))
# Normalize F_pm_filtered such that each column has max abs value of 1
F_pm_filtered <- apply(F_pm_filtered, 2, function(x) x / max(abs(x)))
colnames(F_pm_filtered) <- colnames(L_pm_filtered)
gps <- colnames(F_pm_filtered)
get_passing_categories <- function(auc_list, gps, L_mat, threshold = 0.8) {
auc_mat <- auc_list$auc
thr_mat <- auc_list$threshold
gp_median_loading <- apply(L_mat, 2, median)
lapply(gps, function(gp) {
if (!gp %in% colnames(auc_mat)) return("")
auc_vals <- auc_mat[, gp]
thr_vals <- thr_mat[, gp]
med_load <- gp_median_loading[gp]
# Keep only categories predicted by HIGH loading (threshold >= median loading)
cats <- rownames(auc_mat)[auc_vals > threshold & thr_vals >= med_load]
paste(cats, collapse = "; ")
})
}
level1_cats <- get_passing_categories(level_1_AUC_list, gps, L_pm_filtered)
level2_cats <- get_passing_categories(level_2_AUC_list, gps, L_pm_filtered)
condition_cats <- get_passing_categories(condition_detailed_AUC_list_figure, gps, L_pm_filtered)
organ_cats <- get_passing_categories(organ_simplified_AUC_list_figure, gps, L_pm_filtered)
sig_genes_pos <- lapply(gps, function(gp) {
vals <- F_pm_filtered[, gp]
candidates <- names(vals)[vals > 0.25]
top <- head(candidates[order(vals[candidates], decreasing = TRUE)], 5)
paste(top, collapse = "; ")
})
sig_genes_neg <- lapply(gps, function(gp) {
vals <- F_pm_filtered[, gp]
candidates <- names(vals)[vals < -0.25]
top <- head(candidates[order(abs(vals[candidates]), decreasing = TRUE)], 5)
paste(top, collapse = "; ")
})
supp_table <- data.frame(
GP = gps,
Level1 = unlist(level1_cats),
Level2 = unlist(level2_cats),
Condition = unlist(condition_cats),
Organ = unlist(organ_cats),
Signature_Genes_Pos = unlist(sig_genes_pos),
Signature_Genes_Neg = unlist(sig_genes_neg),
stringsAsFactors = FALSE
)
write.csv(supp_table, file = paste0(output_path, "Supplementary_Table1_GP_summary.csv"), row.names = FALSE)
Showing the first 20 rows (of 200); download the full table at figure-refactor/Supplementary_Table1_GP_summary.csv.
| GP | Level1 | Level2 | Condition | Organ | Signature_Genes_Pos | Signature_Genes_Neg |
|---|---|---|---|---|---|---|
| K1 | CD8.K; CD4.Y; CD4.P; Treg.P; gdT.B; gdT.C; gdT.D; gdT.P; CD8aa.C; CD8aa.D; CD8aa.P; DP.wY; DP.wP | CT010467.1; Tmsb4x; Actb; Tmsb10; Eef1a1 | ||||
| K2 | CD8.wM; CD4.wM; Treg.wM; gdT.E; gdT.wM; CD8aa.wM; Tz.wM; DN.wM; DP.wC; DP.wM | PDAC_SoyHFD | Arhgap15; Dock2; Mbnl1; Inpp4b; Foxp1 | Tmsb10; Tmsb4x; Fau; Pfn1; Ppia | ||
| K3 | gdT.A; gdT.B; gdT.C; gdT.D; gdT.E; gdT.F; gdT.Z; CD8aa.C; CD8aa.D; CD8aa.E; DP.wY | CeDtg; CeDtg_glia; Ddvillin; Ddvillin_glia; MNVCR6; MNVCW3 | small intestine epi | Gzma; Cd7; Ccl5; Fcer1g; Tyrobp | Tmsb10; Tpt1; CT010467.1; Actb; Tmsb4x | |
| K4 | CD4.wN | SLO | Tmsb10; Fau; CT010467.1; Pfn1; Ppia | Dock2; Rack1; Arhgap15; Myh9; Ptprc | ||
| K5 | CD8.K; CD8.P; CD4.P; Treg.P; gdT.P; CD8aa.P; Tz.P; DN.P; DP.wP | H2ac8; H1f5; H1f4; H4c4; Hist1h2ap | ||||
| K6 | CD4.T; CD4.U; CD4.X; CD4.Y; CD4.P; Treg.D; Treg.E; gdT.Q; gdT.R; gdT.S; gdT.T; gdT.U; gdT.V; gdT.X; gdT.Z; Tz.D | Crodentium; MTB_49w; Saureus | S100a6; Gzmb; Lgals1; Vim; Crip1 | Tmsb10; CT010467.1; Eef1a1; Cmss1; Cdk8 | ||
| K7 | gdT.X; gdT.Z; DP.wG | CT010467.1; Ccl5; Cmss1; Cdk8; Crip1 | Igfbp4; Ccr7; Limd2 | |||
| K8 | gdT.Z | VV_D63_AntigenExperienced; VV_D63_bystander; VV_D80_bystander | Fth1; S100a6; Thy1; Ctla2a; Gem | Ccl5; Gzma; Gzmb; AW112010; Tyrobp | ||
| K9 | CD8.wU; CD8.wV; DP.wC; DP.wD; DP.wE | Cdk8; Cmss1; CT010467.1; Eef2; Myh9 | Tmsb10; Fau; Tmsb4x; Cd52 | |||
| K10 | CD8.G; CD8.H; CD8.I; CD8.J; CD8.K; CD8.wU; CD8.wY; CD4.S; DN.F | dirty_2m_LCMVarm_D30; dirty_2m_LCMVarm_D7; GBMpron; LCMVarm_intravascular; LCMVarm_intravascularcirculating; LCMVarm_intravascularsurveilling | Ccl5; Gzma; Lgals1; Nkg7; Ly6c2 | |||
| K11 | placenta; kidney | Vps37b; Gramd3; Dusp10; Junb; Ccr7 | Cd52; Ltb; Ptprcap | |||
| K12 | CD8.C; CD8.wX; CD4.G; CD4.H; CD4.I; CD4.U; Treg.B; DN.A; DN.G | Izumo1r; Cdk8; Tox; Tbc1d4; Pdcd1 | Crip1; Ccl5; Satb1; Igfbp4; Selplg | |||
| K13 | CD4.X; CD4.Y; gdT.Q; gdT.R; gdT.S; gdT.T; gdT.U; gdT.V; Tz.D | D3; Foxp3mutant_D3; Saureus | Tmem176b; Tmem176a; Il7r; CT010467.1; Cd163l1 | Ms4a4b; Inpp4b; Ctla4; Ifi27l2a; Cd2 | ||
| K14 | DP.wF; DP.wG | Cd8b1; Cd8a; Satb1; Rag1; Themis | H2-K1; Crip1; H2-D1; B2m; Eef1a1 | |||
| K15 | CD8.D; CD8.F; CD4.F; Treg.C; gdT.X; DN.G; DN.H; DP.wH | Eif5a; Npm1; Hsp90ab1; Ncl; Mif | Malat1; Tmsb4x; Itm2b; Cd52; Ypel3 | |||
| K16 | CD8.F; CD4.D; DN.I; DN.J | B16_ACTaPD1a41BB; CtrachomatisL2_primaryD5; LCMVcl13_D8; Toxo_D9 | Ifi27l2a; Isg15; Ly6a; Bst2; Stat1 | |||
| K17 | Ifi27l2a; Atp5e; Tmsb4x; Ripor2; Lef1 | Actg1; Ubb; Hspa8; Eef1a1; Il31ra | ||||
| K18 | Cpa3; CT010467.1; Crip1; Ccl5; Tmsb10 | Ifi27l2a; Ccr7; Ly6d; Rgcc | ||||
| K19 | Prl8a9; Tpbpa; Psg21; Prl3b1; Creg1 | Cts6; Ccr10 | ||||
| K20 | CD8.K | LCMVarm_intravascular | Cenpa; Ube2c; Cdc20; Cenpf; Arl6ip1 | H2ac8; H1f5; H1f4; Hist1h2ap; H1f3 |
Table S1. One row per GP: which Level-1 (major lineage), Level-2 (sub-lineage), condition, and organ categories it predicts well (AUC > 0.8, driven by high loading), plus its top 5 positive and negative signature genes (|score| > 0.25).
sessionInfo()
R version 4.5.1 (2025-06-13)
Platform: aarch64-apple-darwin20
Running under: macOS Sequoia 15.6.1
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.1
locale:
[1] en_CA/en_CA/en_CA/C/en_CA/en_CA
time zone: Asia/Tokyo
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] vctrs_0.7.3 cli_3.6.6 knitr_1.50 rlang_1.2.0
[5] xfun_0.55 stringi_1.8.7 otel_0.2.0 promises_1.5.0
[9] jsonlite_2.0.0 workflowr_1.7.2 glue_1.8.1 rprojroot_2.1.1
[13] git2r_0.36.2 htmltools_0.5.9 httpuv_1.6.16 sass_0.4.10
[17] rmarkdown_2.30 evaluate_1.0.5 jquerylib_0.1.4 tibble_3.3.0
[21] fastmap_1.2.0 yaml_2.3.12 lifecycle_1.0.5 stringr_1.6.0
[25] compiler_4.5.1 fs_1.6.6 Rcpp_1.1.1-1.1 pkgconfig_2.0.3
[29] later_1.4.4 digest_0.6.39 R6_2.6.1 pillar_1.11.1
[33] magrittr_2.0.5 bslib_0.9.0 tools_4.5.1 cachem_1.1.0