XGBoost-SHAP Interpretable Modeling Identifies and Validates an Eight-Gene Biomarker for Hepatic Encephalopathy Risk Prediction in Cirrhosis.
The 18 matches
- [1] § 4. Materials and Methods › 4.6. Construction and Validation of XGBoost–SHAP Models ↔ r.07_xgboost.R, lines 29–136 · score 0.89 · colsample_bytree, XGBoost regression, cross validation, squarederror, subsampling, depth
- [2] § 4. Materials and Methods › 4.2. Differential Expression Analysis ↔ r.01_DEG.R, lines 15–100 · score 0.86 · contrasts.fit, eBayes, lmFit, linear model, limma, volcano
- [3] § 2. Results › 2.1. Workflow of the Study ↔ r.02_Mfuzz.R, lines 15–56 · score 0.79 · chronic liver failure, eCLD, decompensated cirrhosis, ACLF, acute, CC
- [4] § 2. Results › 2.1. Workflow of the Study ↔ r.11_PCA.R, lines 17–63 · score 0.78 · eCLD, chronic liver failure, decompensated cirrhosis, ACLF, CC, healthy
- [5] § 4. Materials and Methods › 4.5. Machine Learning-Based Marker Gene Selection ↔ r.06_RF.R, lines 17–75 · score 0.74 · randomForest, IncMSE, IncNodePurity, regression, modeling, gene
- [6] § 4. Materials and Methods › 4.8. Gene Set Enrichment Analysis (GSEA) ↔ r.10_GSEA.R, lines 68–119 · score 0.74 · gradient permutation, minSize, maxSize, Spearman, NES, thresholds
- [7] § 2. Results › 2.5. Multi-Algorithm Cross-Validated Screening for HE-Specific Marker Genes ↔ r.06_RF.R, lines 17–75 · score 0.70 · IncMSE, IncNodePurity, random forest, genes
- [8] § 4. Materials and Methods › 4.3. Functional Enrichment Analysis ↔ r.03_GOKEGG.R, lines 39–92 · score 0.69 · enrichGO, enrichKEGG, bitr, BH, enrichment, gene
- [9] § 4. Materials and Methods › 4.6. Construction and Validation of XGBoost–SHAP Models ↔ r.12_ROC.R, lines 150–213 · score 0.64 · fusion weights, Risk scores, w1, w2, AUC, models
- [10] § 4. Materials and Methods › 4.8. Gene Set Enrichment Analysis (GSEA) ↔ R/fgsea.R, lines 316–376 · score 0.63 · minSize, maxSize, fgsea, BH, NES, permutation
- [11] § 4. Materials and Methods › 4.7. Structural Equation Modeling and Mediation Effect Analysis ↔ r.09_SEM.R, lines 305–351 · score 0.60 · TUBA1C, mediation, mediated, bootstrap, indirect, SEM
- [12] § 2. Results › 2.4. Identification of Prognosis-Associated DEGs ↔ r.01_DEG.R, lines 102–148 · score 0.57 · good prognosis, poor prognosis, limma, DEGs, cirrhotic, GSE15654
- [13] § 4. Materials and Methods › 4.7. Structural Equation Modeling and Mediation Effect Analysis ↔ r.09_SEM.R, lines 70–93 · score 0.56 · ComBat, batch correction, SEM, Modeling
- [14] § 4. Materials and Methods › 4.6. Construction and Validation of XGBoost–SHAP Models ↔ r.08_model_validation.R, lines 141–200 · score 0.56 · KM survival, model validation, probability, median, risk
- [15] § 4. Materials and Methods › 4.1. Data Acquisition and Cohort Construction ↔ r.11_PCA.R, lines 17–63 · score 0.56 · eCLD, ACLF, DC, CC, healthy, clustering
- [16] § 2. Results › 2.5. Multi-Algorithm Cross-Validated Screening for HE-Specific Marker Genes ↔ r.04_LASSO.R, lines 122–164 · score 0.55 · partial likelihood deviance, cross validation, optimal, LASSO
- [17] § 2. Results › 2.6. Dual-Model Construction Based on XGBoost–SHAP and Multi-Level Clinical Validation ↔ packaging.R, lines 1–47 · score 0.54 · SHapley, exPlanations, Additive, XGBoost, model
- [18] § 2. Results › 2.7. Structural Equation Modeling-Based Analyses of Characteristic Gene Regulatory Networks ↔ r.09_SEM.R, lines 305–351 · score 0.51 · TUBA1C, mediated, indirect, SEM, mediation, LRRC32
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
R · 484 lines · 17 KB · MIT · 3 matches
- rm(list = ls()); gc()
- ORIGINAL_DIR <- ""
- output <- file.path(ORIGINAL_DIR, "09_SEM")
- if (!dir.exists(output)) {
- dir.create(output, recursive = TRUE)
- }
- setwd(ORIGINAL_DIR)
- library(tidyverse)
- library(mediation)
- library(limma)
- library(sva)
- library(corrplot)
- library(pheatmap)
- library(lavaan)
- library(semPlot)
- library(dplyr)
- library(ggplot2)
- library(scales)
- library(grid)
- library(ggrepel)
- # Helper function for normality testing
- test_normality <- function(exp_data, by_group = FALSE, group_info = NULL) {
- if (is.data.frame(exp_data)) exp_data <- as.matrix(exp_data)
- if (!by_group) {
- pvals <- apply(exp_data, 1, function(x) {
- x <- as.numeric(x)
- if (all(is.na(x)) || sum(!is.na(x)) < 3) return(NA_real_)
- res <- tryCatch(shapiro.test(x), error = function(e) NULL)
- if (is.null(res)) NA_real_ else as.numeric(res$p.value)
- })
- df <- data.frame(gene = rownames(exp_data), p.value = as.numeric(pvals), stringsAsFactors = FALSE)
- df$adj.p <- p.adjust(df$p.value, method = "BH")
- return(df[order(df$adj.p), ])
- } else {
- if (is.null(group_info)) stop("group_info required for by_group = TRUE")
- groups <- levels(factor(group_info))
- res_list <- list()
- for (g in groups) {
- cols <- which(group_info == g)
- if (length(cols) < 3) {
- tmp <- data.frame(gene = rownames(exp_data), group = g, p.value = NA_real_, stringsAsFactors = FALSE)
- } else {
- pvals <- apply(exp_data[, cols, drop = FALSE], 1, function(x) {
- x <- as.numeric(x)
- if (all(is.na(x)) || sum(!is.na(x)) < 3) return(NA_real_)
- res <- tryCatch(shapiro.test(x), error = function(e) NULL)
- if (is.null(res)) NA_real_ else as.numeric(res$p.value)
- })
- tmp <- data.frame(gene = rownames(exp_data), group = g, p.value = as.numeric(pvals), stringsAsFactors = FALSE)
- tmp$adj.p <- p.adjust(tmp$p.value, method = "BH")
- }
- res_list[[g]] <- tmp
- }
- df_all <- do.call(rbind, lapply(res_list, function(x) {
- if (!"adj.p" %in% colnames(x)) x$adj.p <- NA_real_
- x
- }))
- rownames(df_all) <- NULL
- return(df_all[order(df_all$group, df_all$adj.p), ])
- }
- }
- # Helper function for batch correction
- perform_batch_correction <- function(exp_data, batch_info, group_info = NULL) {
- sample_order <- colnames(exp_data)
- batch_factor <- batch_info[match(sample_order, names(batch_info))]
- unique_batches <- unique(batch_factor)
- cat("Unique batches:", unique_batches, "\n")
- cat("Number of unique batches:", length(unique_batches), "\n")
- if (length(unique_batches) > 1 && !any(is.na(unique_batches))) {
- if (!is.null(group_info)) {
- group_factor <- group_info[match(sample_order, names(group_info))]
- mod <- model.matrix(~ group_factor)
- exp_corrected <- ComBat(dat = exp_data, batch = batch_factor, mod = mod)
- } else {
- exp_corrected <- ComBat(dat = exp_data, batch = batch_factor)
- }
- } else {
- warning("Batch correction not performed - insufficient batches")
- exp_corrected <- exp_data
- }
- return(exp_corrected)
- }
- # Helper function for PCA plot
- create_pca_plot <- function(exp_data, group_info, project_info = NULL, title = "PCA Plot") {
- pca <- prcomp(t(exp_data), scale. = TRUE)
- pca_data <- data.frame(
- PC1 = pca$x[, 1],
- PC2 = pca$x[, 2],
- Sample = colnames(exp_data),
- Group = group_info
- )
- if (!is.null(project_info)) {
- pca_data$Project <- project_info
- }
- var_explained <- pca$sdev^2 / sum(pca$sdev^2)
- pc1_var <- round(var_explained[1] * 100, 2)
- pc2_var <- round(var_explained[2] * 100, 2)
- p <- ggplot(pca_data, aes(x = PC1, y = PC2, color = factor(Group))) +
- geom_point(size = 2, alpha = 0.7) +
- labs(
- x = paste0("PC1 (", pc1_var, "%)"),
- y = paste0("PC2 (", pc2_var, "%)"),
- title = title,
- color = "Group"
- ) +
- theme_minimal()
- return(list(plot = p, pca = pca, data = pca_data))
- }
- # Helper function for correlation heatmap
- create_correlation_heatmap <- function(exp_data, output_dir, filename_prefix) {
- cor_matrix <- cor(t(exp_data), use = "pairwise.complete.obs")
- p_matrix <- cor.mtest(cor_matrix)$p
- genes <- colnames(cor_matrix)
- cor_df <- as.data.frame(as.table(cor_matrix), stringsAsFactors = FALSE) %>%
- rename(gene_y = Var1, gene_x = Var2, r = Freq)
- p_df <- as.data.frame(as.table(p_matrix), stringsAsFactors = FALSE) %>%
- rename(gene_y = Var1, gene_x = Var2, p = Freq)
- plot_df <- cor_df %>%
- left_join(p_df, by = c("gene_y", "gene_x")) %>%
- mutate(
- sig = case_when(
- p < 0.001 ~ "***",
- p < 0.01 ~ "**",
- p < 0.05 ~ "*",
- TRUE ~ ""
- ),
- label = ifelse(gene_x == gene_y, sprintf("%.2f", r), sprintf("%.2f%s", r, sig))
- )
- plot_df$gene_x <- factor(plot_df$gene_x, levels = genes)
- plot_df$gene_y <- factor(plot_df$gene_y, levels = rev(genes))
- p <- ggplot(plot_df, aes(x = gene_x, y = gene_y, fill = r)) +
- geom_tile(color = "white", linewidth = 0.4) +
- geom_text(aes(label = label), size = 2.8, color = "black") +
- scale_fill_gradient2(
- low = "#8491B4", mid = "white", high = "#F39B7F",
- midpoint = 0, limits = c(-1, 1), name = "Correlation"
- ) +
- scale_x_discrete(position = "top") +
- coord_fixed() +
- theme_minimal(base_size = 11) +
- theme(
- panel.grid = element_blank(),
- axis.title = element_blank(),
- axis.text.x.top = element_text(face = "italic", color = "black",
- angle = 45, hjust = 0, vjust = 0,
- margin = margin(b = 0)),
- axis.text.y.left = element_text(face = "italic", color = "black",
- margin = margin(r = 0))
- )
- ggsave(file.path(output_dir, paste0(filename_prefix, "_corrplot_full.pdf")),
- p, width = 4.5, height = 4.5, dpi = 300)
- ggsave(file.path(output_dir, paste0(filename_prefix, "_corrplot_full.png")),
- p, width = 4.5, height = 4.5, dpi = 300)
- return(list(plot = p, cor_matrix = cor_matrix, p_matrix = p_matrix))
- }
- #### Load and prepare data ####
- # Load expression data
- exp01 <- read.csv(file.path("00_rawdata", "00.rawdata_GSE139602_exp.csv"), row.names = 1)
- group01 <- read.csv(file.path("00_rawdata", "00.rawdata_GSE139602_group.csv"), row.names = 1)
- group01 <- group01[colnames(exp01), , drop = FALSE]
- # Convert group labels
- group01$group <- ifelse(group01$characteristics_ch1 == "disease state: Healthy", 0,
- ifelse(group01$characteristics_ch1 == "disease state: eCLD", 1,
- ifelse(group01$characteristics_ch1 == "disease state: Compensated Cirrhosis", 2,
- ifelse(group01$characteristics_ch1 == "disease state: Decompesated Cirrhosis", 3,
- ifelse(group01$characteristics_ch1 == "disease state: Acute-on-chronic liver failure", 4, NA)))))
- exp02 <- read.csv(file.path("00_rawdata", "00.rawdata_GSE15654_exp.csv"), row.names = 1)
- group02 <- read.csv(file.path("00_rawdata", "00.rawdata_GSE15654_group.csv"), row.names = 1)
- # Load models and gene lists
- model1 <- readRDS(file.path("07_xgboost", "07_xgboost_GSE139602_final_xgboost_model.Rdata"))
- model2 <- readRDS(file.path("07_xgboost", "07_xgboost_GSE15654_final_xgboost_model_cox.Rdata"))
- model1_gene <- read.csv(file.path("07_xgboost", "07_xgboost_GSE139602_shap_mat.csv"), row.names = 1)
- model2_gene <- read.csv(file.path("07_xgboost", "07_xgboost_GSE15654_shap_mat.csv"), row.names = 1)
- all_features <- c(colnames(model1_gene), colnames(model2_gene))
- # Find common genes
- common_genes <- intersect(rownames(exp01), rownames(exp02))
- exp01 <- exp01[common_genes, ]
- exp02 <- exp02[common_genes, ]
- exp_merged <- cbind(exp01, exp02)
- # Prepare group information
- group01$project <- "GSE139602"
- group02$project <- "GSE15654"
- group_merged <- data.frame(
- row.names = c(rownames(group01), rownames(group02)),
- group = c(group01$group, group02$group),
- project = c(group01$project, group02$project)
- )
- group_merged <- group_merged[colnames(exp_merged), ]
- #### Batch correction ####
- # Pre-correction visualization
- png(file.path(output, "09_SEM_pre_merged.png"), width = 5, height = 4, res = 300, units = "in")
- boxplot(exp_merged, xaxt = "n", col = "lightblue",
- main = "Gene Expression Distribution (Pre-batch Correction)",
- ylab = "Expression Value")
- dev.off()
- pdf(file.path(output, "09_SEM_pre_merged.pdf"), width = 5, height = 4)
- boxplot(exp_merged, xaxt = "n", col = "lightblue",
- main = "Gene Expression Distribution (Pre-batch Correction)",
- ylab = "Expression Value")
- dev.off()
- # Perform batch correction
- group_merged$sample <- rownames(group_merged)
- sample_order <- colnames(exp_merged)
- batch_info <- group_merged$project[match(sample_order, group_merged$sample)]
- group_info <- group_merged$group[match(sample_order, group_merged$sample)]
- names(batch_info) <- sample_order
- names(group_info) <- sample_order
- exp_corrected <- perform_batch_correction(exp_merged, batch_info, group_info)
- # Post-correction visualization
- png(file.path(output, "09_SEM_post_merged.png"), width = 5, height = 4, res = 300, units = "in")
- boxplot(exp_corrected, xaxt = "n", col = "lightblue",
- main = "Gene Expression Distribution (Post-batch Correction)",
- ylab = "Expression Value")
- dev.off()
- pdf(file.path(output, "09_SEM_post_merged.pdf"), width = 5, height = 4)
- boxplot(exp_corrected, xaxt = "n", col = "lightblue",
- main = "Gene Expression Distribution (Post-batch Correction)",
- ylab = "Expression Value")
- dev.off()
- # Save corrected data
- write.csv(group_merged, file.path(output, "09_SEM_group_merged.csv"))
- write.csv(exp_merged, file.path(output, "09_SEM_exp_merged.csv"))
- write.csv(exp_corrected, file.path(output, "09_SEM_exp_corrected.csv"))
- # PCA plots
- pca_pre <- create_pca_plot(exp_merged, group_merged$group, group_merged$project,
- "PCA of Pre-corrected Expression Data")
- ggsave(file.path(output, "09_SEM_pca_pre.png"), pca_pre$plot, width = 6, height = 5)
- ggsave(file.path(output, "09_SEM_pca_pre.pdf"), pca_pre$plot, width = 6, height = 5)
- pca_post <- create_pca_plot(exp_corrected, group_merged$group, group_merged$project,
- "PCA of Post-corrected Expression Data")
- ggsave(file.path(output, "09_SEM_pca_post.png"), pca_post$plot, width = 6, height = 5)
- ggsave(file.path(output, "09_SEM_pca_post.pdf"), pca_post$plot, width = 6, height = 5)
- #### Normality testing ####
- exp_data <- exp_corrected[all_features, ]
- norm_res <- test_normality(exp_data, by_group = FALSE)
- write.csv(norm_res, file.path(output, "09_SEM_normality_shapiro_overall.csv"))
- #### Correlation analysis ####
- cor_results <- create_correlation_heatmap(exp_data, output, "09_SEM")
- #### Mediation analysis ####
- # Prepare data for mediation
- X <- as.data.frame(t(exp_corrected[all_features, ]))
- X <- scale(X)
- X <- as.data.frame(X)
- # Predict progression and survival
- progression <- predict(model1, scale(t(exp_corrected[colnames(model1_gene), ])))
- survival <- predict(model2, scale(t(exp_corrected[colnames(model2_gene), ])))
- X$progression <- progression
- X$survival <- survival
- # Define mediator and outcome models
- mediator_vars <- c("NPC2", "TLN1", "TUBA1C", "LRRC32", "PRB2")
- outcome_vars <- c("SOX9", "RNASE4", "SERPINA3")
- # Linear regression models for mediation
- model_a <- lm(progression ~ NPC2 + TLN1 + TUBA1C + LRRC32 + PRB2, data = X)
- model_bc <- lm(survival ~ NPC2 + TLN1 + TUBA1C + LRRC32 + PRB2 + SOX9 + RNASE4 + SERPINA3 + progression, data = X)
- # Perform mediation analysis
- mediation_results <- list()
- for (treat in mediator_vars) {
- med_result <- mediate(model.m = model_a,
- model.y = model_bc,
- treat = treat,
- mediator = "progression",
- boot = TRUE,
- sims = 1000)
- mediation_results[[treat]] <- summary(med_result)
- }
- #### Structural Equation Modeling (SEM) ####
- # Define SEM model
- sem_model <- '
- # Direct effects on progression
- progression ~ a_NPC2*NPC2 + a_TLN1*TLN1 + a_TUBA1C*TUBA1C + a_LRRC32*LRRC32 + a_PRB2*PRB2
- # Effects on outcome mediators
- SOX9 ~ b_SOX9*progression
- RNASE4 ~ b_RNASE4*progression
- SERPINA3 ~ b_SERPINA3*progression
- # Effects on survival
- survival ~ c_SOX9*SOX9 + c_RNASE4*RNASE4 + c_SERPINA3*SERPINA3 + c_progression*progression
- # Indirect effects
- indirect_NPC2_SOX9 := a_NPC2 * b_SOX9 * c_SOX9
- indirect_NPC2_RNASE4 := a_NPC2 * b_RNASE4 * c_RNASE4
- indirect_NPC2_SERPINA3 := a_NPC2 * b_SERPINA3 * c_SERPINA3
- indirect_TLN1_SOX9 := a_TLN1 * b_SOX9 * c_SOX9
- indirect_TLN1_RNASE4 := a_TLN1 * b_RNASE4 * c_RNASE4
- indirect_TLN1_SERPINA3 := a_TLN1 * b_SERPINA3 * c_SERPINA3
- indirect_TUBA1C_SOX9 := a_TUBA1C * b_SOX9 * c_SOX9
- indirect_TUBA1C_RNASE4 := a_TUBA1C * b_RNASE4 * c_RNASE4
- indirect_TUBA1C_SERPINA3 := a_TUBA1C * b_SERPINA3 * c_SERPINA3
- indirect_LRRC32_SOX9 := a_LRRC32 * b_SOX9 * c_SOX9
- indirect_LRRC32_RNASE4 := a_LRRC32 * b_RNASE4 * c_RNASE4
- indirect_LRRC32_SERPINA3 := a_LRRC32 * b_SERPINA3 * c_SERPINA3
- indirect_PRB2_SOX9 := a_PRB2 * b_SOX9 * c_SOX9
- indirect_PRB2_RNASE4 := a_PRB2 * b_RNASE4 * c_RNASE4
- indirect_PRB2_SERPINA3 := a_PRB2 * b_SERPINA3 * c_SERPINA3
- '
- # Fit SEM model
- set.seed(123)
- fit <- sem(sem_model, data = X, se = "bootstrap", bootstrap = 2000, missing = "FIML")
- # Extract results
- fit_summary <- summary(fit, standardized = TRUE, rsquare = TRUE)
- fit_measures <- fitmeasures(fit, c("cfi", "tli", "rmsea", "srmr"))
- parameter_estimates <- parameterEstimates(fit, standardized = TRUE)
- # Save results
- write.csv(parameter_estimates, file.path(output, "09_SEM_sem_results.csv"))
- write.csv(fit_measures, file.path(output, "09_SEM_fit_measures.csv"))
- # Extract indirect effects
- indirect_effects <- parameter_estimates[grepl("^indirect_", parameter_estimates$label), ]
- indirect_effects <- indirect_effects %>%
- mutate(p_adj = p.adjust(pvalue, method = "fdr"))
- write.csv(indirect_effects, file.path(output, "09_SEM_indirect_effects.csv"))
- write.csv(indirect_effects[indirect_effects$pvalue < 0.05, ],
- file.path(output, "09_SEM_significant_indirect.csv"))
- #### Create SEM path diagram ####
- # Prepare node positions
- nodes <- bind_rows(
- tibble(node = c("NPC2", "TLN1", "TUBA1C", "LRRC32", "PRB2"),
- x = c(-4, -2, 0, 2, 4), y = 4),
- tibble(node = "progression", x = 0, y = 3),
- tibble(node = c("SOX9", "RNASE4", "SERPINA3"),
- x = c(-2, 0, 2), y = 2),
- tibble(node = "survival", x = 0, y = 1)
- )
- # Prepare edges
- pe <- parameter_estimates %>%
- filter(op == "~") %>%
- transmute(
- from = rhs,
- to = lhs,
- est = std.all,
- pval = pvalue
- )
- edges <- pe %>%
- inner_join(nodes %>% rename(from = node, x = x, y = y), by = "from") %>%
- inner_join(nodes %>% rename(to = node, xend = x, yend = y), by = "to") %>%
- mutate(
- dx = xend - x,
- curve_type = case_when(
- dx > 0 ~ "right",
- dx < 0 ~ "left",
- TRUE ~ "vertical"
- ),
- xm = (x + xend) / 2 + ifelse(dx == 0, 0.18, 0),
- ym = (y + yend) / 2 + ifelse(dx == 0, 0, 0.12 * sign(dx))
- )
- # Prepare node labels with italics for genes
- gene_nodes <- c("NPC2", "TLN1", "TUBA1C", "LRRC32", "PRB2", "SOX9", "RNASE4", "SERPINA3")
- nodes <- nodes %>%
- mutate(
- label_expr = ifelse(
- node %in% gene_nodes,
- paste0("italic('", node, "')"),
- paste0("'", node, "'")
- )
- )
- # Create SEM path diagram
- p_sem <- ggplot() +
- geom_curve(
- data = edges %>% filter(curve_type == "right"),
- aes(x = x, y = y, xend = xend, yend = yend, color = est, linewidth = abs(est)),
- curvature = 0.25, alpha = 0.9, lineend = "round",
- arrow = arrow(length = unit(0.18, "cm"), type = "closed")
- ) +
- geom_curve(
- data = edges %>% filter(curve_type == "left"),
- aes(x = x, y = y, xend = xend, yend = yend, color = est, linewidth = abs(est)),
- curvature = -0.25, alpha = 0.9, lineend = "round",
- arrow = arrow(length = unit(0.18, "cm"), type = "closed")
- ) +
- geom_curve(
- data = edges %>% filter(curve_type == "vertical"),
- aes(x = x, y = y, xend = xend, yend = yend, color = est, linewidth = abs(est)),
- curvature = 0.20, alpha = 0.9, lineend = "round",
- arrow = arrow(length = unit(0.18, "cm"), type = "closed")
- ) +
- geom_point(
- data = nodes,
- aes(x = x, y = y),
- shape = 21, size = 14, stroke = 0.9,
- fill = alpha("#F2F2F2", 0.45), color = "#4D4D4D"
- ) +
- geom_label_repel(
- data = edges,
- aes(x = xm, y = ym, label = sprintf("%.2f", est)),
- size = 3.0, color = "black", fill = "#F7F7F7",
- alpha = 0.95, label.size = 0.15, label.r = unit(0.08, "lines"),
- box.padding = 0.12, point.padding = 0.05,
- min.segment.length = 0, segment.color = NA,
- segment.size = 0.25, force = 1.2,
- max.overlaps = Inf, show.legend = FALSE
- ) +
- geom_text(
- data = nodes,
- aes(x = x, y = y, label = label_expr),
- parse = TRUE, size = 4.3, fontface = "bold", color = "#1F1F1F"
- ) +
- scale_color_gradient2(
- low = "#2C7BB6", mid = "#BDBDBD", high = "#D7191C", midpoint = 0,
- name = "Standardized coefficient"
- ) +
- scale_linewidth(range = c(0.7, 2.8), name = "|Standardized coefficient|") +
- coord_cartesian(xlim = c(-5, 5), ylim = c(0.6, 4.4), clip = "off") +
- theme_void(base_size = 13) +
- theme(
- legend.position = "right",
- plot.margin = margin(10, 20, 10, 20)
- )
- ggsave(file.path(output, "09_SEM_semplot.png"), p_sem, width = 7.5, height = 6, dpi = 300)
- ggsave(file.path(output, "09_SEM_semplot.pdf"), p_sem, width = 7.5, height = 6, dpi = 300)
- message("SEM analysis completed successfully!")
- # Print summary
- cat("\n=== SEM Fit Measures ===\n")
- print(fit_measures)
- cat("\n=== Significant Indirect Effects ===\n")
- print(indirect_effects[indirect_effects$pvalue < 0.05, c("label", "est", "pvalue", "p_adj")])
r.09_SEM.R at commit b1fc48c, under MIT · at the source
Overview
- Department of Medical Genetics and Developmental Biology, School of Basic Medical Sciences, Capital Medical University, Beijing 100069, China; (Y.L.); (T.Z.)
- Laboratory for Clinical Medicine, Capital Medical University, Beijing 100069, China
- Beijing Key Laboratory of Cell and Gene Therapy in Otology, Beijing 100069, China
- Department of Human Cell Biology and Genetics, SUSTech Homeostatic Medicine Institute, School of Medicine, Southern University of Science and Technology, Shenzhen 518055, China
Abstract
Cirrhosis, accounting for 2.4% of global mortality in 2019, represents a leading cause of death in chronic liver disease. Hepatic encephalopathy (HE), a decompensated complication of cirrhosis, is associated with a median survival of only 0.92 years post-diagnosis. Current screening methods relying on neuropsychological tests (e.g., Psychometric Hepatic Encephalopathy Score, PHES) have limitations such as time-consuming procedures and subjective interpretation, potentially delaying diagnosis. To address this, we integrated four cirrhotic transcriptomic cohorts (GSE41919, GSE57193, GSE139602, and GSE15654) and employed an integrated algorithm (LASSO [Least Absolute Shrinkage and Selection Operator]–RFE [Recursive Feature Elimination]–random forest) to identify HE-specific biomarker genes. Ultimately, we developed an HE risk-prediction system centered on eight HE-specific marker genes, namely, PRB2, TUBA1C, NPC2, LRRC32, TLN1, SOX9, SERPINA3 and RNASE4. Based on these genes, an XGBoost (eXtreme Gradient Boosting)-based HE risk stratification model was constructed, and SHAP (SHapley Additive exPlanations) analysis was further introduced to address the “black-box” limitation of conventional machine learning models and to improve the interpretability. The finalized eight-gene system enables accurate, efficient, and interpretable HE risk assessment in patients with cirrhosis. Functional characterization through gene set enrichment analysis and structural equation modeling further revealed that these marker genes converge on four interconnected biological processes, namely, metabolic homeostasis, synaptic and neural transmission, immune inflammatory signaling, and hepatic detoxification, which collectively reflect the gut–liver–brain axis disruption central to HE pathogenesis. This dual-model system, incorporating both cirrhosis progression and survival prognosis, provides a reliable and clinically applicable tool for early HE risk warning and stratification, reducing the limitations of traditional neuropsychological screening and offering a translational foundation for timely intervention and prognostic optimization in high-risk cirrhotic patients.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repositories
Its files are read in the Code ↔ Paper reader above, with 18 matches between paragraphs and lines of code.
seandavi/GEOquery
cb12423bf2691af82f742fc10f891835e8bab3ce, 17 August 2026Availability: 1 check, the latest on 26 September 2026: the link answers
- 26 September 2026: the link answers
62 files
- R/
GDS2MA.R , R, 83 lines - R/
GEOquery-package.R , R, 218 lines - R/
browseGEOAccession.R , R, 40 lines - R/
cache.R , R, 59 lines - R/
checksum.R , R, 33 lines - R/
classes.R , R, 152 lines - R/
conditions.R , R, 68 lines - R/
fileOpen.R , R, 12 lines - R/
getGEO.R , R, 233 lines - R/
getGEOSuppFiles.R , R, 197 lines - R/
getGEOfile.R , R, 219 lines - R/
getGSEDataTables.R , R, 58 lines - R/
parseGEO.R , R, 664 lines - R/
rnaseq.R , R, 344 lines - R/
searchGEO.R , R, 151 lines - R/
singlecell.R , R, 845 lines - R/
sra.R , R, 94 lines - R/
zzz.R , R, 6 lines - dev/
precompute-vignettes.R , R, 67 lines - inst/
scripts/ , R, 21 linesbuildGEODocsumJson.R - inst/
scripts/ , R, 136 linesgeometa.R - tests/
testthat.R , R, 4 lines - tests/
testthat/ , R, 10 lineshelper-integration.R - tests/
testthat/ , R, 40 lineshelper-network.R - tests/
testthat/ , R, 19 linestest_GDS.R - tests/
testthat/ , R, 26 linestest_GEO_conversions.R - tests/
testthat/ , R, 38 linestest_GPL.R - tests/
testthat/ , R, 131 linestest_GSE.R - tests/
testthat/ , R, 16 linestest_GSM.R - tests/
testthat/ , R, 24 linestest_cache.R - tests/
testthat/ , R, 53 linestest_checksum.R - tests/
testthat/ , R, 30 linestest_conditions.R - tests/
testthat/ , R, 22 linestest_fetch_GPL_false.R - tests/
testthat/ , R, 39 linestest_findfirstentity.R - tests/
testthat/ , R, 31 linestest_gds_na.R - tests/
testthat/ , R, 8 linestest_geo_browse.R - tests/
testthat/ , R, 107 linestest_geo_rnaseq.R - tests/
testthat/ , R, 47 linestest_http.R - tests/
testthat/ , R, 139 linestest_issue_fixes.R - tests/
testthat/ , R, 130 linestest_misc_offline.R - tests/
testthat/ , R, 97 linestest_parse_synthetic.R - tests/
testthat/ , R, 89 linestest_parse_utils.R - tests/
testthat/ , R, 15 linestest_printhead.R - tests/
testthat/ , R, 66 linestest_private_token.R - tests/
testthat/ , R, 46 linestest_returntype.R - tests/
testthat/ , R, 112 linestest_rnaseq_helpers.R - tests/
testthat/ , R, 74 linestest_sc_sample_meta.R - tests/
testthat/ , R, 9 linestest_search.R - tests/
testthat/ , R, 42 linestest_searchGEO_json.R - tests/
testthat/ , R, 420 linestest_singlecell.R - tests/
testthat/ , R, 41 linestest_sra.R - tests/
testthat/ , R, 34 linestest_supp_files.R - tests/
testthat/ , R, 25 linestest_url_join.R - vignettes/
GEOquery.qmd , Quarto, 197 lines - vignettes/
downstream-analysis.qmd , Quarto, 114 lines - vignettes/
finding-and-downloading- , Quarto, 230 linesdata.qmd - vignettes/
geo-data-formats.qmd , Quarto, 220 lines - vignettes/
rnaseq.qmd , Quarto, 115 lines - vignettes/
single-cell.qmd , Quarto, 251 lines - LICENSE, License, 2 lines
- LICENSE.md, License, 21 lines
- README.md, Text, 114 lines
ModelOriented/shapviz
a3ead2491c66b7345eaf23e212eb1edda03b4697, 31 August 2026Availability: 1 check, the latest on 26 September 2026: the link answers
- 26 September 2026: the link answers
30 files
- R/
bee.R , R, 74 lines - R/
collapse_shap.R , R, 80 lines - R/
collect_axes.R , R, 56 lines - R/
data.R , R, 32 lines - R/
extractors.R , R, 117 lines - R/
methods.R , R, 400 lines - R/
potential_interactions.R , R, 158 lines - R/
shapviz-package.R , R, 24 lines - R/
shapviz.R , R, 594 lines - R/
sv_dependence.R , R, 379 lines - R/
sv_dependence2D.R , R, 244 lines - R/
sv_force.R , R, 187 lines - R/
sv_importance.R , R, 329 lines - R/
sv_interaction.R , R, 194 lines - R/
sv_waterfall.R , R, 270 lines - packaging.R, R, 120 lines, 1 match
- tests/
testthat.R , R, 12 lines - tests/
testthat/ , R, 21 linestest-bee.R - tests/
testthat/ , R, 99 linestest-collapse_shap.R - tests/
testthat/ , R, 68 linestest-helpers.R - tests/
testthat/ , R, 299 linestest-interface.R - tests/
testthat/ , R, 158 linestest-plots-mshapviz.R - tests/
testthat/ , R, 227 linestest-plots-shapviz.R - tests/
testthat/ , R, 203 linestest-potential_interacti ons.R - vignettes/
basic_use.Rmd , R, 306 lines - vignettes/
geographic.Rmd , R, 147 lines - vignettes/
multiple_output.Rmd , R, 168 lines - vignettes/
tidymodels.Rmd , R, 398 lines - LICENSE.md, License, 336 lines
- README.md, Text, 107 lines
alserglab/fgsea
570f5903545835cb340e699fcdfdf444b1ba07ec, 22 September 2026Availability: 1 check, the latest on 26 September 2026: the link answers
- 26 September 2026: the link answers
53 files
- R/
RcppExports.R , R, 59 lines - R/
fgsea-package.R , R, 38 lines - R/
fgsea.R , R, 743 lines, 1 match - R/
fgseaMultilevel.R , R, 295 lines - R/
fgseaORA.R , R, 146 lines - R/
geseca-multilevel.R , R, 381 lines - R/
geseca-plot.R , R, 555 lines - R/
geseca-simple.R , R, 151 lines - R/
geseca-utils.R , R, 70 lines - R/
pathways.R , R, 97 lines - R/
plot.R , R, 286 lines - R/
util.R , R, 45 lines - data-raw/
exampleExpressionMatrix. , R, 5 linesR - data-raw/
examplePathways.R , R, 6 lines - data-raw/
exampleRanks.R , R, 6 lines - inst/
exact/ , C++, 139 linesexact.cpp - inst/
exact/ , R, 52 linesrunFgsea.R - inst/
gen_gene_ranks.R , R, 29 lines - inst/
gen_gse14308_expression_ , R, 21 linesmatrix.R - inst/
gene_reactome_pathways.R , R, 25 lines - inst/
gse19429_gsea.R , R, 17 lines - inst/
run_broad_gsea.R , R, 30 lines - inst/
th1_gsea.R , R, 201 lines - src/
RcppExports.cpp , C++, 105 lines - src/
ScoreCalculation.cpp , C++, 43 lines - src/
ScoreCalculation.h , C/C++, 22 lines - src/
ScoreRuler.cpp , C++, 172 lines - src/
ScoreRuler.h , C/C++, 43 lines - src/
esCalculation.cpp , C++, 75 lines - src/
esCalculation.h , C/C++, 98 lines - src/
fastGSEA.cpp , C++, 502 lines - src/
fastGSEA.h , C/C++, 55 lines - src/
fgseaMultilevel.cpp , C++, 55 lines - src/
fgseaMultilevel.h , C/C++, 25 lines - src/
fgseaMultilevelSupplemen , C++, 494 linest.cpp - src/
fgseaMultilevelSupplemen , C/C++, 104 linest.h - src/
geseca.cpp , C++, 29 lines - src/
geseca.h , C/C++, 13 lines - src/
util.cpp , C++, 82 lines - src/
util.h , C/C++, 31 lines - test.R, R, 5 lines
- tests/
testthat.R , R, 9 lines - tests/
testthat/ , R, 52 linestest_fora.R - tests/
testthat/ , R, 103 linestest_geseca.R - tests/
testthat/ , R, 289 linestest_gsea_analysis.R - tests/
testthat/ , R, 261 linestest_gsea_multilevel.R - tests/
testthat/ , R, 202 linestest_gsea_stat.R - tests/
testthat/ , R, 18 linestest_pathways.R - tests/
testthat/ , R, 54 linestest_plot.R - vignettes/
fgsea-tutorial.Rmd , R, 183 lines - vignettes/
geseca-tutorial.Rmd , R, 536 lines - LICENCE, License, 20 lines
- README.md, Text, 103 lines
yuanfeng-lan/HE-risk-Prediction
b1fc48c5cbe5977c65ab0cb4a0b9cccdeb51e2d4, 24 July 2026Availability: 1 check, the latest on 26 September 2026: the link answers
- 26 September 2026: the link answers
14 files
- r.00_rawdata.R, R, 108 lines
- r.01_DEG.R, R, 211 lines, 2 matches
- r.02_Mfuzz.R, R, 241 lines, 1 match
- r.03_GOKEGG.R, R, 218 lines, 1 match
- r.04_LASSO.R, R, 234 lines, 1 match
- r.05_RFE.R, R, 267 lines
- r.06_RF.R, R, 377 lines, 2 matches
- r.07_xgboost.R, R, 539 lines, 1 match
- r.08_model_validation.R, R, 499 lines, 1 match
- r.09_SEM.R, R, 484 lines, 3 matches
- r.10_GSEA.R, R, 573 lines, 1 match
- r.11_PCA.R, R, 220 lines, 2 matches
- r.12_ROC.R, R, 368 lines, 1 match
- README.md, Text, 187 lines
Tracing map
Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.
What the map holds:
- 4 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
- 151 scripts, each with its path and the digest of its content;
- 18 matches between paragraphs of the paper and lines of the code (method lexical-v1);
- neither the text of the paper nor the code itself.
Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.
Data
Datasets cited
- geo:GSE41919, at NCBI GEO; found in the text, “2.1. Workflow of the Study”
Other data links
- ncbi.nlm.nih.gov/
geo , NCBI; found in the text, “4.1. Data Acquisition and Cohort Construction”
Data Availability Statement
All data utilized in this study were obtained from the Gene Expression Omnibus (GEO) database, a publicly accessible repository maintained by the National Center for Biotechnology Information (NCBI). All datasets are freely available for download without any access restrictions. The specific GEO accession numbers and corresponding datasets are cited within the manuscript.
Reproduced under the paper's license (CC BY), from the paper cited above.
Versions
The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.
Version 1, 27 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 4 authors, 5 keywords, 8 MeSH terms, 1 funder, 38 references.
Cite
This paper
Lan, Y., Zhao, T., Xu, Y., & Ye, H. (2026). XGBoost-SHAP Interpretable Modeling Identifies and Validates an Eight-Gene Biomarker for Hepatic Encephalopathy Risk Prediction in Cirrhosis. International journal of molecular sciences, 27(15), 6925. https://
BibTeX
@article{lan2026xgboost,
author = {Lan, Yuanfeng and Zhao, Tian and Xu, Ying and Ye, Haihong},
title = {{XGBoost-SHAP Interpretable Modeling Identifies and Validates an Eight-Gene Biomarker for Hepatic Encephalopathy Risk Prediction in Cirrhosis}},
journal = {International journal of molecular sciences},
year = {2026},
month = aug,
volume = {27},
number = {15},
pages = {6925},
publisher = {Multidisciplinary Digital Publishing Institute (MDPI)},
issn = {1422-0067},
doi = {10.3390/
url = {https://
pmid = {42589578},
pmcid = {PMC13467542}
}
RIS
TY - JOUR
AU - Lan, Yuanfeng
AU - Zhao, Tian
AU - Xu, Ying
AU - Ye, Haihong
TI - XGBoost-SHAP Interpretable Modeling Identifies and Validates an Eight-Gene Biomarker for Hepatic Encephalopathy Risk Prediction in Cirrhosis
T2 - International journal of molecular sciences
J2 - Int J Mol Sci
PY - 2026
DA - 2026/
VL - 27
IS - 15
SP - 6925
SN - 1422-0067
PB - Multidisciplinary Digital Publishing Institute (MDPI)
DO - 10.3390/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.3390/
"type": "article-journal",
"title": "XGBoost-SHAP Interpretable Modeling Identifies and Validates an Eight-Gene Biomarker for Hepatic Encephalopathy Risk Prediction in Cirrhosis",
"container-title": "International journal of molecular sciences",
"author": [
{
"family": "Lan",
"given": "Yuanfeng"
},
{
"family": "Zhao",
"given": "Tian"
},
{
"family": "Xu",
"given": "Ying"
},
{
"family": "Ye",
"given": "Haihong"
}
],
"container-title-short":
"volume": "27",
"issue": "15",
"page": "6925",
"DOI": "10.3390/
"PMID": "42589578",
"PMCID": "PMC13467542",
"ISSN": "1422-0067",
"publisher": "Multidisciplinary Digital Publishing Institute (MDPI)",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
8,
1
]
]
}
}
The tracing map gets a citation of its own once an author has validated it and it has a DOI.
Similar papers
The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.
- [1] doi:10.1038/s42003-026-10957-8 [code]
- Brain defence by the extracellular matrix protein Cochlin.Journal: Communications biologyIn common: randomForest, glmnet, survival, 12 other tools
- [2] doi:10.3390/ijms27104466 [code]
- Uncovering the Key Circuit FOSL2/
FOS/ EGR3/ EGR1, Contributing to the Hyperexcitability of Excitatory Neurons in the Epileptic Temporal Cortex and Hippocampus. Journal: International journal of molecular sciencesIn common: glmnet, pROC, caret, 11 other tools, genetics / omics, 2 references - [3] doi:10.1016/j.xcrm.2026.102682 [code]
- TET CpG sequence-context-specifi
c DNA demethylation shapes progression of IDH-mutant gliomas. Journal: Cell reports. MedicineIn common: glmnet, pROC, survival, 11 other tools, genetics / omics, other condition, 1 reference - [4] doi:10.7717/peerj.21426 [code]
- Integrated transcriptomic identification and validation reveal key autophagy-associated biomarkers in sleep deprivation.Journal: PeerJIn common: randomForest, glmnet, pROC, 11 other tools, genetics / omics
- [5] doi:10.1016/j.isci.2026.115657 [code]
- Integration of machine learning to develop a disulfidptosis model for predicting glioma prognosis, immunotherapy response, and drug.Journal: iScienceIn common: glmnet, pROC, survival, 11 other tools, other condition
- [6] doi:10.1093/bioinformatics/btag592 [code]
- Network-based stratification of allele-specific expression reveals patient subgroups in Huntington's disease.Journal: Bioinformatics (Oxford, England)In common: randomForest, pROC, survival, 10 other tools, genetics / omics, other condition
- [7] doi:10.1016/j.xcrm.2026.102766 [code]
- A longitudinal single-cell and spatial multiomic atlas of pediatric high-grade glioma.Journal: Cell reports. MedicineIn common: pROC, SingleCellExperiment, limma, 10 other tools, genetics / omics, other condition
- [8] doi:10.3390/ijms27093997 [code]
- Coordinated Multicellular Immune Programs and Drug Targets Revealed by Single-Cell Analysis in Driver-Mutated NSCLC.Journal: International journal of molecular sciencesIn common: glmnet, survival, clusterProfiler, 9 other tools, genetics / omics, other condition
- [9] doi:10.1093/neuonc/noag128 [code]
- Spatially-resolved single-cell imaging of melanoma brain metastases identifies localized immune patterns predictive of immune checkpoint blockade response.Journal: Neuro-oncologyIn common: glmnet, pROC, survival, 8 other tools, genetics / omics, other condition
- [10] doi:10.1038/s41593-026-02367-0 [code]
- A reproducible three-dimensional model of human brain tissue to investigate physiological and disease-associated microglia phenotypes.Journal: Nature neuroscienceIn common: SingleCellExperiment, limma, clusterProfiler, 9 other tools, 1 reference
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 4 repositories of the authors' code, each at its verified commit and with its license, 151 scripts, and 18 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:750d8260be6deb72…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
