OSCR

Quantitative pathology and APOE genotype reveal dementia risk and progression in Lewy body disease.

Code ↔ Paper

7 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

The 7 matches
  1. [1] § Materials and methods › Logistic regression modelling of dementia risk ↔ QuantPath_Figure_4_and_5.R, lines 90 to 130 · score 0.87 · logistic regression models, continuous predictors, predicted probabilities, categorical variables, Marginal, binomial · Report a mismatch
  2. [2] § Materials and methods › Pathology burden classification and diagnostic performance metrics ↔ QuantPath_Figure_1_and_2.R, lines 1212 to 1270 · score 0.78 · pathology presence ratio, pathology absence ratio, odds ratio, PPR, PAR, PPV · Report a mismatch
  3. [3] § Materials and methods › Statistical analysis ↔ SuStaIn_ASyn_Subtype.ipynb, lines 446 to 508 · score 0.75 · AMY_LS, AMY_MI, DA, MFG, MTG, PTEGM · Report a mismatch
  4. [4] § Materials and methods › Neuropathological assessment ↔ QuantPath_Table1_and_Suppl_Tables_3_4_5.R, lines 553 to 595 · score 0.73 · NIA AA, Thal phase, ischaemic pathology, Braak stage, ADNC, pTau · Report a mismatch
  5. [5] § Materials and methods › Neuropathological assessment ↔ QuantPath_Figure_1_and_2.R, lines 1212 to 1270 · score 0.67 · pathology absence ratio, odds ratio, PPR, PAR, Segments, PPV · Report a mismatch
  6. [6] § Materials and methods › Statistical analysis ↔ QuantPath_Figure_4_and_5.R, lines 90 to 130 · score 0.66 · logistic regression models, predicted probabilities, biological sex, death, duration, age · Report a mismatch
  7. [7] § Materials and methods › Statistical analysis ↔ QuantPath_Table1_and_Suppl_Tables_3_4_5.R, lines 553 to 595 · score 0.62 · Kruskal Wallis, Thal phase, Lewy bodies, Braak stage, density, ADNC · Report a mismatch

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

R · 728 lines · 23 KB · CC-BY-4.0 · 2 matches

  1. #MULTIVARIATE LOGISTICAL REGRESSUION#####################
  2. # Load required libraries
  3. library(readxl)
  4. library(tidyverse)
  5. library(ggplot2)
  6. library(gridExtra)
  7. library(reshape2)
  8. library(FactoMineR)
  9. library(factoextra)
  10. library(dplyr)
  11. library(ggeffects)
  12. library(gtsummary)
  13. library(flextable)
  14. # Set directories
  15. setwd("DIR")
  16. datadir <- "DIR"
  17. dir.create(datadir, showWarnings = FALSE)
  18. setwd(datadir)
  19. # Load data
  20. ex <- read_excel("EXCEL",
  21. sheet = "SHEET")
  22. excel <- as.data.frame(ex)
  23. excel_main <- excel
  24. ########### Bin variables: Duration>15 and Age_at_Death>77
  25. # Load dplyr package
  26. library(dplyr)
  27. # Filter the dataframe to remove rows where ApoE and INFARCT have NA values
  28. # Ensure no missing values
  29. excel_main <- excel_main %>% filter(!is.na(Duration))
  30. # Calculate the median of Duration
  31. median_duration <- median(excel_main$Duration, na.rm = TRUE, 0)
  32. print(median_duration)
  33. # Bin the values at the median
  34. excel_main$Duration_Binned <- cut(excel_main$Duration,
  35. breaks = c(-Inf, median_duration, Inf),
  36. labels = c(paste0("< ", median_duration, "yrs"),
  37. paste0("≥ ", median_duration, "yrs")), # Use median in labels
  38. include.lowest = TRUE, right = FALSE) # left-inclusive binning
  39. table(excel_main$Duration_Binned)
  40. # Ensure no missing values
  41. excel_main <- excel_main %>% filter(!is.na(Age_at_Death))
  42. # Calculate the median of Age_at_Death
  43. median_Age_at_Death <- median(excel_main$Age_at_Death, na.rm = TRUE)
  44. print(median_Age_at_Death)
  45. # Bin the values at the median
  46. excel_main$Age_at_Death_Binned <- cut(excel_main$Age_at_Death,
  47. breaks = c(-Inf, median_Age_at_Death, Inf),
  48. labels = c(paste0("< ", median_Age_at_Death, "yrs"),
  49. paste0("≥ ", median_Age_at_Death, "yrs")), # Use median in labels
  50. include.lowest = TRUE, right = FALSE) # left-inclusive binning
  51. table(excel_main$Age_at_Death_Binned)
  52. # Convert categorical variables to factors
  53. excel_main$Duration_Binned <- as.factor(excel_main$Duration_Binned)
  54. excel_main$Age_at_Death_Binned <- as.factor(excel_main$Age_at_Death_Binned)
  55. excel_main$INFARCT <- as.factor(excel_main$INFARCT)
  56. excel_main$ApoE <- as.factor(excel_main$ApoE)
  57. # View first few rows to check binning
  58. head(excel_main[, c("Duration", "Duration_Binned", "Age_at_Death", "Age_at_Death_Binned")])
  59. # View first few rows to check binning
  60. head(excel_main)
  61. ####################################################FULL_MODEL
  62. UPPR_DIR <- paste0(datadir,"/FULL_MODEL")
  63. dir.create(UPPR_DIR)
  64. setwd(UPPR_DIR)
  65. excel_main <- subset(excel_main, select = c(DEMENTIA, ApoE, ASYN_FRNT_HIPP, AT8_FRNT_HIPP, ABETA_FRNT_HIPP, INFARCT, Duration_Binned, Age_at_Death_Binned, BIOLOGICAL_SEX))
  66. # Define predictors and outcome
  67. predictors <- c("ASYN_FRNT_HIPP", "AT8_FRNT_HIPP", "ABETA_FRNT_HIPP", "INFARCT", "Duration_Binned", "Age_at_Death_Binned", "BIOLOGICAL_SEX")
  68. outcome <- "DEMENTIA"
  69. # Ensure outcome variable is a factor
  70. excel_main[[outcome]] <- as.factor(excel_main[[outcome]])
  71. ####################################################APOE
  72. # Manually define x-axis limits for continuous predictors
  73. xlims_list <- list(
  74. "ASYN_FRNT_HIPP" = c(0, 50),
  75. "ABETA_FRNT_HIPP" = c(0, 8),
  76. "AT8_FRNT_HIPP" = c(0, 15)
  77. )
  78. # Run the analysis separately for ApoE3 and ApoE4
  79. for (apoe_type in c("ApoE3", "ApoE4")) {
  80. # Filter dataset for current ApoE type
  81. #apoe_type <- "ApoE3"
  82. subset_data <- excel_main %>% filter(ApoE == apoe_type)
  83. # Train logistic regression model
  84. model_base <- glm(DEMENTIA ~ ., data = subset_data[, c(predictors, outcome)], family = "binomial")
  85. library(car)
  86. vif(model_base)
  87. library(sjPlot)
  88. library(sjmisc)
  89. library(ggeffects)
  90. library(cowplot)
  91. library(RColorBrewer)
  92. library(ggplot2)
  93. # Generate marginal effects for all predictors
  94. effects_list <- ggpredict(model_base) # Get predicted probabilities
  95. plot_order <- c(
  96. "ASYN_FRNT_HIPP", "ABETA_FRNT_HIPP", "AT8_FRNT_HIPP",
  97. "BIOLOGICAL_SEX", "INFARCT", "Duration_Binned", "Age_at_Death_Binned"
  98. )
  99. effects_list <- effects_list[plot_order]
  100. # Define categorical variables
  101. categorical_vars <- c("INFARCT", "Age_at_Death_Binned", "Duration_Binned", "BIOLOGICAL_SEX")
  102. # Define colors for continuous variable lines
  103. continuous_colors <- c("α-synuclein" = "forestgreen",
  104. "Aβ" = "firebrick",
  105. "pTau" = "dodgerblue")
  106. # Define x-axis label mapping
  107. x_axis_labels <- c(
  108. "ASYN_FRNT_HIPP" = "α-synuclein",
  109. "ABETA_FRNT_HIPP" = "Aβ",
  110. "AT8_FRNT_HIPP" = "pTau",
  111. "INFARCT" = "Ischaemia",
  112. "BIOLOGICAL_SEX" = "Biological sex",
  113. "Duration_Binned" = "Duration",
  114. "Age_at_Death_Binned" = "Age at death"
  115. )
  116. # Recode levels for INFARCT
  117. infarct_labels <- c("INF_0" = "Absent", "INF_1" = "Present")
  118. bsex_labels <- c("M" = "Male", "F" = "Female")
  119. # Create individual plots
  120. common_ylim <- c(0, 100)
  121. plot_list <- lapply(seq_along(effects_list), function(i) {
  122. var_name <- names(effects_list)[i]
  123. effects_data <- as.data.frame(effects_list[[i]])
  124. if (nrow(effects_data) == 0) return(NULL) # Skip empty frames
  125. is_categorical <- var_name %in% categorical_vars
  126. if (!is_categorical) {
  127. plot_obj <- ggplot(effects_data, aes(x = x, y = predicted * 100)) +
  128. geom_ribbon(
  129. aes(ymin = conf.low * 100, ymax = conf.high * 100),
  130. fill = continuous_colors[[x_axis_labels[[var_name]]]],
  131. alpha = 0.2
  132. ) +
  133. geom_line(
  134. size = 3,
  135. color = continuous_colors[[x_axis_labels[[var_name]]]]
  136. ) +
  137. labs(
  138. x = x_axis_labels[[var_name]],
  139. y = if (i == 1) "Dementia probability (%)" else NULL
  140. ) +
  141. xlim(xlims_list[[var_name]]) + # 👈 Apply manual x-axis limit here
  142. ylim(common_ylim) +
  143. theme_minimal() +
  144. theme(
  145. plot.title = element_blank(),
  146. axis.title.x = element_text(size = 34),
  147. axis.title.y = element_text(size = 34),
  148. axis.text = element_text(size = 34),
  149. plot.margin = margin(t = 40, r = 5, b = 5, l = 5, unit = "pt"),
  150. legend.position = "none"
  151. )
  152. } else {
  153. if (var_name == "INFARCT") {
  154. effects_data$x <- factor(effects_data$x,
  155. levels = names(infarct_labels),
  156. labels = infarct_labels)
  157. } else if (var_name == "BIOLOGICAL_SEX") {
  158. effects_data$x <- factor(effects_data$x,
  159. levels = names(bsex_labels),
  160. labels = bsex_labels)
  161. }
  162. plot_obj <- ggplot(effects_data, aes(x = x, y = predicted * 100, color = as.factor(x))) +
  163. geom_point(size = 10) +
  164. geom_errorbar(aes(ymin = conf.low * 100, ymax = conf.high * 100),
  165. width = 0.7, linetype = "dotted", size = 2) +
  166. scale_color_manual(values = c("orchid1", "darkorchid4")) +
  167. labs(
  168. x = x_axis_labels[[var_name]],
  169. y = if (i == 1) "Dementia probability (%)" else NULL,
  170. color = "Category"
  171. ) +
  172. ylim(common_ylim) +
  173. theme_minimal() +
  174. theme(
  175. plot.title = element_blank(),
  176. axis.title.x = element_text(size = 34),
  177. axis.title.y = element_text(size = 34),
  178. axis.text = element_text(size = 34),
  179. plot.margin = margin(t = 40, r = 5, b = 5, l = 5, unit = "pt"),
  180. legend.position = "none"
  181. )
  182. }
  183. # Remove y-axis title for plots after the first one
  184. if (i != 1) {
  185. plot_obj <- plot_obj + theme(axis.title.y = element_blank())
  186. }
  187. return(plot_obj)
  188. })
  189. # Remove NULLs from empty predictors
  190. plot_list <- plot_list[!sapply(plot_list, is.null)]
  191. # Arrange plots
  192. sjplot <- cowplot::plot_grid(plotlist = plot_list, nrow = 1, align = "h")
  193. # Display plot
  194. print(sjplot)
  195. # Save
  196. ggsave(paste0("sjplot_UPPERQUARTILE_", apoe_type, ".png"), sjplot, width = 35, height = 5, dpi = 300)
  197. }
  198. #######################DECISION TREE################
  199. # Define continuous variables
  200. continuous_vars <- c("ASYN_FRNT_HIPP", "ABETA_FRNT_HIPP", "AT8_FRNT_HIPP")
  201. # Apply per group
  202. get_fixed_splits_by_apoe <- function(data, apoe_group) {
  203. df_sub <- data %>%
  204. filter(ApoE == apoe_group) %>%
  205. mutate(DEMENTIA_BIN = ifelse(DEMENTIA == "Dem", 1, 0))
  206. # Define cutoffs
  207. asyn_75 <- quantile(df_sub$ASYN_FRNT_HIPP, 0.75, na.rm = TRUE)
  208. abeta_75 <- quantile(df_sub$ABETA_FRNT_HIPP, 0.75, na.rm = TRUE)
  209. at8_85 <- quantile(df_sub$AT8_FRNT_HIPP, 0.85, na.rm = TRUE)
  210. tibble(
  211. ApoE = apoe_group,
  212. variable = c("ASYN_FRNT_HIPP", "ABETA_FRNT_HIPP", "AT8_FRNT_HIPP"),
  213. percentile = c("75th", "75th", "85th"),
  214. fixed_cut = c(asyn_75, abeta_75, at8_85)
  215. )
  216. }
  217. # Run for both ApoE groups
  218. split_apoe3 <- get_fixed_splits_by_apoe(df_binned, "APOE ε3")
  219. split_apoe4 <- get_fixed_splits_by_apoe(df_binned, "APOE ε4")
  220. # Combine
  221. split_results_all <- bind_rows(split_apoe3, split_apoe4)
  222. # View results
  223. print(split_results_all)
  224. # Save to CSV
  225. write_csv(split_results_all, "logistic_best_splits_by_apoe.csv")
  226. # Define the fixed splits for each ApoE group
  227. fixed_splits <- split_results_all %>%
  228. arrange(ApoE, variable) %>%
  229. select(ApoE, variable, fixed_cut) %>%
  230. mutate(fixed_cut = round(fixed_cut, 2))
  231. df_binned <- df_binned %>%
  232. mutate(DEMENTIA_BIN = ifelse(DEMENTIA == "Dem", 1, 0))
  233. ###DT_apoe3
  234. # -- 1. Rename variables in importance table
  235. result_apoe3_renamed <- as.data.frame(result_apoe3$importance) %>%
  236. mutate(Variable = case_when(
  237. Variable == "INFARCTINF_1" ~ "INFARCT",
  238. Variable == "BIOLOGICAL_SEXM" ~ "BIOLOGICAL_SEX",
  239. Variable == "Age_at_Death_Binned≥ 77" ~ "Age_at_Death_Binned",
  240. Variable == "Duration_Binned≥ 15" ~ "Duration_Binned",
  241. TRUE ~ Variable
  242. ))
  243. # -- 2. Get ordered variables by importance
  244. importance_apoe3 <- result_apoe3_renamed %>%
  245. arrange(desc(Importance)) %>%
  246. pull(Variable)
  247. # -- 3. Merge with fixed splits
  248. ordered_variables_apoe3 <- fixed_splits %>%
  249. filter(ApoE == "APOE ε3") %>%
  250. arrange(match(variable, importance_apoe3))
  251. ordered_vars <- importance_apoe3
  252. var_rename <- c(
  253. ASYN_FRNT_HIPP = "α-synuclein",
  254. ABETA_FRNT_HIPP = "Aβ",
  255. Duration_Binned = "Duration",
  256. INFARCT = "Ischaemia",
  257. Age_at_Death_Binned = "Age at death",
  258. BIOLOGICAL_SEX = "Biological sex",
  259. AT8_FRNT_HIPP = "pTau"
  260. )
  261. # Apply renaming
  262. ordered_vars <- unname(var_rename[ordered_vars])
  263. ordered_vars
  264. # -- 4. Create binned columns
  265. cutoffs <- ordered_variables_apoe3$fixed_cut
  266. names(cutoffs) <- ordered_variables_apoe3$variable
  267. df_binned1 <- df_binned %>%
  268. mutate(
  269. ASYN_FRNT_HIPP_CAT = ifelse(ASYN_FRNT_HIPP >= cutoffs["ASYN_FRNT_HIPP"], paste0("\u2265", cutoffs["ASYN_FRNT_HIPP"]), paste0("<", cutoffs["ASYN_FRNT_HIPP"])),
  270. ABETA_FRNT_HIPP_CAT = ifelse(ABETA_FRNT_HIPP >= cutoffs["ABETA_FRNT_HIPP"], paste0("\u2265", cutoffs["ABETA_FRNT_HIPP"]), paste0("<", cutoffs["ABETA_FRNT_HIPP"])),
  271. AT8_FRNT_HIPP_CAT = ifelse(AT8_FRNT_HIPP >= cutoffs["AT8_FRNT_HIPP"], paste0("\u2265", cutoffs["AT8_FRNT_HIPP"]), paste0("<", cutoffs["AT8_FRNT_HIPP"]))
  272. )
  273. # -- 5. Prepare dataset for APOE ε3 group
  274. df_apoe3 <- df_binned1 %>%
  275. filter(ApoE == "APOE ε3") %>%
  276. mutate(
  277. `α-synuclein` = ASYN_FRNT_HIPP_CAT,
  278. `Aβ` = ABETA_FRNT_HIPP_CAT,
  279. `pTau` = AT8_FRNT_HIPP_CAT,
  280. Ischaemia = factor(INFARCT, levels = c("INF_0", "INF_1"), labels = c("Absent", "Present")),
  281. `Biological sex` = factor(BIOLOGICAL_SEX, levels = c("F", "M"), labels = c("FEMALE", "MALE")),
  282. `Age at death` = Age_at_Death_Binned,
  283. Duration = Duration_Binned
  284. ) %>%
  285. select(DEMENTIA, DEMENTIA_BIN, `α-synuclein`, `Aβ`, `pTau`, Ischaemia, `Biological sex`, `Age at death`, Duration) %>%
  286. mutate(across(everything(), as.character))
  287. # -- 6. Evaluate path-level risk
  288. library(dplyr)
  289. # -- 1. Evaluate path-level risk
  290. tree_paths_eval_apoe3 <- df_apoe3 %>%
  291. group_by(`α-synuclein`, `Aβ`, `pTau`, Ischaemia, `Biological sex`, `Age at death`, Duration) %>%
  292. summarise(
  293. n = n(),
  294. pct_high = mean(DEMENTIA_BIN == 1, na.rm = TRUE),
  295. .groups = "drop"
  296. ) %>%
  297. mutate(
  298. risk_label = case_when(
  299. is.na(pct_high) ~ "No data",
  300. pct_high >= 0.7 ~ "High risk",
  301. TRUE ~ "Low risk"
  302. ),
  303. label = paste0(risk_label, "\n(n=", n, ", ",
  304. ifelse(is.na(pct_high), "NA", round(pct_high * 100)), "%)"),
  305. display_label = risk_label
  306. )
  307. write.csv(tree_paths_eval_apoe3, "ApoE3_risk_bins_OBS.csv", row.names = FALSE)
  308. # -- 2. Define ordered variables for tree depth (same as image structure)
  309. ordered_vars
  310. # -- 3. Create custom PathString that stops branching when pct_high ≥ 0.7 <20
  311. tree_paths_eval_apoe3$PathString <- apply(tree_paths_eval_apoe3, 1, function(row) {
  312. path <- c("Start")
  313. label_to_use <- row[["display_label"]] # default
  314. for (v in ordered_vars) {
  315. value <- row[[v]]
  316. path <- c(path, paste0(v, ": ", value))
  317. # Check if this subgroup exceeds threshold
  318. subset_rows <- tree_paths_eval_apoe3
  319. for (i in seq_along(path)[-1]) {
  320. parts <- strsplit(path[i], ": ")[[1]]
  321. subset_rows <- subset_rows[subset_rows[[parts[1]]] == parts[2], ]
  322. }
  323. if (nrow(subset_rows) > 0) {
  324. avg_pct <- mean(subset_rows$pct_high)
  325. if (avg_pct >= 0.6) {
  326. label_to_use <- "High risk"
  327. break
  328. } else if (avg_pct <= 0.30) {
  329. label_to_use <- "Low risk"
  330. break
  331. }
  332. }
  333. } # <-- closes the for loop
  334. paste(c(path, label_to_use), collapse = "/")
  335. })
  336. library(dplyr)
  337. library(DiagrammeR)
  338. library(stringr)
  339. library(digest)
  340. # ---- Step 1: Extract node paths from tree_paths_eval
  341. paths <- strsplit(tree_paths_eval_apoe3$PathString, "/")
  342. # ---- Step 2: Create edges and unique node labels
  343. edges <- data.frame(from = character(), to = character(), label = character())
  344. nodes <- data.frame(id = character(), label = character(), group = character(), stringsAsFactors = FALSE)
  345. for (p in paths) {
  346. for (i in 2:length(p)) {
  347. from <- paste(p[1:(i - 1)], collapse = "/")
  348. to <- paste(p[1:i], collapse = "/")
  349. label <- p[i]
  350. # Generate unique, clean IDs for Graphviz
  351. from_id <- paste0("node_", digest(from, algo = "crc32"))
  352. to_id <- paste0("node_", digest(to, algo = "crc32"))
  353. edges <- rbind(edges, data.frame(from = from_id, to = to_id, label = label))
  354. group <- ifelse(grepl("risk", label), "risk",
  355. ifelse(grepl("^α-syn", label), "asyn",
  356. ifelse(grepl("^Aβ", label), "abeta",
  357. ifelse(grepl("^pTau", label), "ptau",
  358. ifelse(grepl("Ischa", label), "isch",
  359. ifelse(grepl("Sex", label), "sex",
  360. ifelse(grepl("Duration", label), "dur", "default")))))))
  361. nodes <- rbind(nodes, data.frame(
  362. id = to_id,
  363. label = label,
  364. group = group,
  365. stringsAsFactors = FALSE
  366. ))
  367. }
  368. }
  369. # Remove duplicates
  370. nodes <- nodes[!duplicated(nodes$id), ]
  371. edges <- edges[!duplicated(edges), ]
  372. # Get root node ID from the first edge
  373. root_id <- edges$from[1]
  374. # If it's not in the node list, add it manually
  375. if (!(root_id %in% nodes$id)) {
  376. nodes <- rbind(nodes, data.frame(
  377. id = root_id,
  378. label = "APOE ε3",
  379. group = "apoe",
  380. stringsAsFactors = FALSE
  381. ))
  382. }
  383. # ---- Step 3: Build Graphviz DOT syntax
  384. color_map <- c(
  385. "asyn" = "lawngreen",
  386. "abeta" = "lightpink",
  387. "isch" = "khaki1",
  388. "ptau" = "lightskyblue1",
  389. "sex" = "plum1",
  390. "dur" = "lemonchiffon",
  391. "risk" = "mistyrose",
  392. "apoe" = "dodgerblue1", # ← custom color for APOE root
  393. "default" = "white"
  394. )
  395. # Fix labels: escape quotes, remove newlines for Graphviz compatibility
  396. nodes$label <- gsub("\"", "'", nodes$label) # Replace double quotes
  397. nodes$label <- gsub("\n", "\\n", nodes$label) # Escape line breaks
  398. node_defs <- paste0(
  399. nodes$id, ' [label="', nodes$label,
  400. '", style=filled, fillcolor="', color_map[nodes$group], '"];'
  401. )
  402. edge_defs <- paste0(
  403. edges$from, ' -> ', edges$to, ';'
  404. )
  405. # ---- Step 4: Wrap in grViz
  406. dot_code_apoe3 <- paste0(
  407. "digraph G {\n",
  408. " graph [layout = dot, rankdir = TB];\n",
  409. " node [shape=box, fontname=Helvetica];\n\n",
  410. paste(node_defs, collapse = "\n"), "\n\n",
  411. paste(edge_defs, collapse = "\n"), "\n}"
  412. )
  413. # ---- Step 5: Render the final publication-style graph
  414. grViz(dot_code_apoe3)
  415. library(rsvg)
  416. library(DiagrammeRsvg)
  417. # Render and export to PDF
  418. grViz(dot_code_apoe3) %>%
  419. export_svg() %>%
  420. charToRaw() %>%
  421. rsvg_pdf("decision_tree_apoe3_min_split_ObsOnly.pdf")
  422. ###DT_apoe4
  423. # -- 1. Rename variables in importance table
  424. result_apoe4_renamed <- as.data.frame(result_apoe4$importance) %>%
  425. mutate(Variable = case_when(
  426. Variable == "INFARCTINF_1" ~ "INFARCT",
  427. Variable == "BIOLOGICAL_SEXM" ~ "BIOLOGICAL_SEX",
  428. Variable == "Age_at_Death_Binned≥ 77" ~ "Age_at_Death_Binned",
  429. Variable == "Duration_Binned≥ 15" ~ "Duration_Binned",
  430. TRUE ~ Variable
  431. ))
  432. # -- 2. Get ordered variables by importance
  433. importance_apoe4 <- result_apoe4_renamed %>%
  434. arrange(desc(Importance)) %>%
  435. pull(Variable)
  436. # -- 3. Merge with fixed splits
  437. ordered_variables_apoe4 <- fixed_splits %>%
  438. filter(ApoE == "APOE ε4") %>%
  439. arrange(match(variable, importance_apoe4))
  440. ordered_vars <- importance_apoe4
  441. var_rename <- c(
  442. ASYN_FRNT_HIPP = "α-synuclein",
  443. ABETA_FRNT_HIPP = "Aβ",
  444. Duration_Binned = "Duration",
  445. INFARCT = "Ischaemia",
  446. Age_at_Death_Binned = "Age at death",
  447. BIOLOGICAL_SEX = "Biological sex",
  448. AT8_FRNT_HIPP = "pTau"
  449. )
  450. # Apply renaming
  451. ordered_vars <- unname(var_rename[ordered_vars])
  452. # -- 4. Create binned columns
  453. cutoffs <- ordered_variables_apoe4$fixed_cut
  454. names(cutoffs) <- ordered_variables_apoe4$variable
  455. df_binned1 <- df_binned %>%
  456. mutate(
  457. ASYN_FRNT_HIPP_CAT = ifelse(ASYN_FRNT_HIPP >= cutoffs["ASYN_FRNT_HIPP"], paste0("\u2265", cutoffs["ASYN_FRNT_HIPP"]), paste0("<", cutoffs["ASYN_FRNT_HIPP"])),
  458. ABETA_FRNT_HIPP_CAT = ifelse(ABETA_FRNT_HIPP >= cutoffs["ABETA_FRNT_HIPP"], paste0("\u2265", cutoffs["ABETA_FRNT_HIPP"]), paste0("<", cutoffs["ABETA_FRNT_HIPP"])),
  459. AT8_FRNT_HIPP_CAT = ifelse(AT8_FRNT_HIPP >= cutoffs["AT8_FRNT_HIPP"], paste0("\u2265", cutoffs["AT8_FRNT_HIPP"]), paste0("<", cutoffs["AT8_FRNT_HIPP"]))
  460. )
  461. # -- 5. Prepare dataset for APOE ε4 group
  462. df_apoe4 <- df_binned1 %>%
  463. filter(ApoE == "APOE ε4") %>%
  464. mutate(
  465. `α-synuclein` = ASYN_FRNT_HIPP_CAT,
  466. `Aβ` = ABETA_FRNT_HIPP_CAT,
  467. `pTau` = AT8_FRNT_HIPP_CAT,
  468. Ischaemia = factor(INFARCT, levels = c("INF_0", "INF_1"), labels = c("Absent", "Present")),
  469. `Biological sex` = factor(BIOLOGICAL_SEX, levels = c("F", "M"), labels = c("FEMALE", "MALE")),
  470. `Age at death` = Age_at_Death_Binned,
  471. Duration = Duration_Binned
  472. ) %>%
  473. select(DEMENTIA, DEMENTIA_BIN, `α-synuclein`, `Aβ`, `pTau`, Ischaemia, `Biological sex`, `Age at death`, Duration) %>%
  474. mutate(across(everything(), as.character))
  475. # -- 6. Evaluate path-level risk
  476. library(dplyr)
  477. # -- 1. Evaluate path-level risk
  478. tree_paths_eval_apoe4 <- df_apoe4 %>%
  479. group_by(`α-synuclein`, `Aβ`, `pTau`, Ischaemia, `Biological sex`, `Age at death`, Duration) %>%
  480. summarise(
  481. n = n(),
  482. pct_high = mean(DEMENTIA_BIN == 1, na.rm = TRUE),
  483. .groups = "drop"
  484. ) %>%
  485. mutate(
  486. risk_label = case_when(
  487. is.na(pct_high) ~ "No data",
  488. pct_high >= 0.7 ~ "High risk",
  489. TRUE ~ "Low risk"
  490. ),
  491. label = paste0(risk_label, "\n(n=", n, ", ",
  492. ifelse(is.na(pct_high), "NA", round(pct_high * 100)), "%)"),
  493. display_label = risk_label
  494. )
  495. write.csv(tree_paths_eval_apoe4, "ApoE4_risk_bins_OBS.csv", row.names = FALSE)
  496. # -- 2. Define ordered variables for tree depth (same as image structure)
  497. ordered_vars
  498. # -- 3. Create custom PathString that stops branching when pct_high ≥ 0.8
  499. tree_paths_eval_apoe4$PathString <- apply(tree_paths_eval_apoe4, 1, function(row) {
  500. path <- c("Start")
  501. label_to_use <- row[["display_label"]] # default
  502. for (v in ordered_vars) {
  503. value <- row[[v]]
  504. path <- c(path, paste0(v, ": ", value))
  505. # Check if this subgroup exceeds threshold
  506. subset_rows <- tree_paths_eval_apoe4
  507. for (i in seq_along(path)[-1]) {
  508. parts <- strsplit(path[i], ": ")[[1]]
  509. subset_rows <- subset_rows[subset_rows[[parts[1]]] == parts[2], ]
  510. }
  511. if (nrow(subset_rows) > 0) {
  512. avg_pct <- mean(subset_rows$pct_high)
  513. if (avg_pct >= 0.66) {
  514. label_to_use <- "High risk"
  515. break
  516. } else if (avg_pct <= 0.3) {
  517. label_to_use <- "Low risk"
  518. break
  519. }
  520. }
  521. } # <-- closes the for loop
  522. paste(c(path, label_to_use), collapse = "/")
  523. })
  524. library(dplyr)
  525. library(DiagrammeR)
  526. library(stringr)
  527. library(digest)
  528. # ---- Step 1: Extract node paths from tree_paths_eval
  529. paths <- strsplit(tree_paths_eval_apoe4$PathString, "/")
  530. # ---- Step 2: Create edges and unique node labels
  531. edges <- data.frame(from = character(), to = character(), label = character())
  532. nodes <- data.frame(id = character(), label = character(), group = character(), stringsAsFactors = FALSE)
  533. for (p in paths) {
  534. for (i in 2:length(p)) {
  535. from <- paste(p[1:(i - 1)], collapse = "/")
  536. to <- paste(p[1:i], collapse = "/")
  537. label <- p[i]
  538. # Generate unique, clean IDs for Graphviz
  539. from_id <- paste0("node_", digest(from, algo = "crc32"))
  540. to_id <- paste0("node_", digest(to, algo = "crc32"))
  541. edges <- rbind(edges, data.frame(from = from_id, to = to_id, label = label))
  542. group <- ifelse(grepl("risk", label), "risk",
  543. ifelse(grepl("^α-syn", label), "asyn",
  544. ifelse(grepl("^Aβ", label), "abeta",
  545. ifelse(grepl("^pTau", label), "ptau",
  546. ifelse(grepl("Ischa", label), "isch",
  547. ifelse(grepl("Sex", label), "sex",
  548. ifelse(grepl("Duration", label), "dur", "default")))))))
  549. nodes <- rbind(nodes, data.frame(
  550. id = to_id,
  551. label = label,
  552. group = group,
  553. stringsAsFactors = FALSE
  554. ))
  555. }
  556. }
  557. # Remove duplicates
  558. nodes <- nodes[!duplicated(nodes$id), ]
  559. edges <- edges[!duplicated(edges), ]
  560. # Get root node ID from the first edge
  561. root_id <- edges$from[1]
  562. # If it's not in the node list, add it manually
  563. if (!(root_id %in% nodes$id)) {
  564. nodes <- rbind(nodes, data.frame(
  565. id = root_id,
  566. label = "APOE ε4",
  567. group = "apoe",
  568. stringsAsFactors = FALSE
  569. ))
  570. }
  571. # ---- Step 3: Build Graphviz DOT syntax
  572. color_map <- c(
  573. "asyn" = "lawngreen",
  574. "abeta" = "lightpink",
  575. "isch" = "khaki1",
  576. "ptau" = "lightskyblue1",
  577. "sex" = "plum1",
  578. "dur" = "lemonchiffon",
  579. "risk" = "mistyrose",
  580. "apoe" = "firebrick2", # ← custom color for APOE root
  581. "default" = "white"
  582. )
  583. node_defs <- paste0(
  584. nodes$id, ' [label="', nodes$label,
  585. '", style=filled, fillcolor="', color_map[nodes$group], '"];'
  586. )
  587. edge_defs <- paste0(
  588. edges$from, ' -> ', edges$to, ';'
  589. )
  590. # ---- Step 4: Wrap in grViz
  591. dot_code_apoe4 <- paste0(
  592. "digraph G {\n",
  593. " graph [layout = dot, rankdir = TB];\n",
  594. " node [shape=box, fontname=Helvetica];\n\n",
  595. paste(node_defs, collapse = "\n"), "\n\n",
  596. paste(edge_defs, collapse = "\n"), "\n}"
  597. )
  598. # ---- Step 5: Render the final publication-style graph
  599. grViz(dot_code_apoe4)
  600. library(rsvg)
  601. library(DiagrammeRsvg)
  602. # Render and export to PDF
  603. grViz(dot_code_apoe4) %>%
  604. export_svg() %>%
  605. charToRaw() %>%
  606. rsvg_pdf("decision_tree_apoe4_min_split_ObsOnly.pdf")

QuantPath_Figure_4_and_5.R, under CC-BY-4.0 · at the source

Overview

  1. Department of Clinical and Movement Neurosciences, UCL Queen Square Institute of Neurology, University College London, London WC1N 3BG, UK
  2. Queen Square Brain Bank for Neurological Disorders, UCL Queen Square Institute of Neurology, London WC1N 1PJ, UK
  3. Aligning Science Across Parkinson’s (ASAP) Collaborative Research Network, Chevy Chase, MD 20815, USA
  4. Department of Neuromuscular Diseases, UCL Queen Square Institute of Neurology, University College London, London WC1N 3BG, UK
  5. Reta Lila Weston Institute of Neurological Studies, UCL Queen Square Institute of Neurology, London WC1N 3BG, UK
  6. Queen Square Movement Disorders Centre, UCL Queen Square Institute of Neurology, London WC1N 3BG, UK
  7. Department of Neurodegenerative Disease, UCL Queen Square Institute of Neurology, London WC1N 3BG, UK
  8. Division of Neuropathology, National Hospital for Neurology and Neurosurgery, University College London NHS Foundation Trust, London NW1 2PB, UK
  9. UK Dementia Research Institute at The University of Cambridge, Cambridge CB2 0AH, UK
  10. Centre for Preventive Neurology, Wolfson Institute of Population Health, Queen Mary University London, London E1 4NS, UK
Journal: Brain : a journal of neurology, volume 149, issue 11, pages 3905-3922
Dates: received 12 September 2025; accepted 1 March 2026; published online 27 March 2026; in print November 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1093/brain/awag114 · PMID 41889331 · PMCID PMC13730591 · OpenAlex W7141045465
Open access: hybrid, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: genetics / omics (modality), human (organism), Alzheimer's / dementia (population), Parkinson's (population)
Methods: Statistics, Machine learning, Preprocessing, Connectivity, fMRI & imaging
Keywords: Lewy body diseases, Parkinson’s disease, APOE genotype, orthostatic hypotension with ischaemic pathology, Alzheimer’s co-pathology, SuStaIn
MeSH: Apolipoproteins E*, Brain*, Dementia*, Lewy Body Disease*, Aged, Aged, 80 and over, alpha-Synuclein, Amyloid beta-Peptides, Apolipoprotein E4, Disease Progression, Female, Genotype, Humans, Male, Parkinson Disease, tau Proteins (* major topic)
Topic: Parkinson's Disease Mechanisms and Treatments (Clinical Neurology, Medicine), according to OpenAlex
Citations: cited by 1 paper (Europe PMC); 64 references in the paper
Research resources: RRID:SCR_025020

Abstract

Dementia in Lewy body diseases (LBD) is common and arises through heterogeneous and incompletely understood pathways. Evidence suggests contributions from genetic factors, including APOE ɛ4 genotype, and co-pathology, including concomitant Alzheimer’s disease pathology and hypoperfusion related to orthostatic hypotension. However, the relative impact of these factors remains unclear.

To address this, we analysed 399 post-mortem brains from LBD cases comprising Parkinson’s disease, Parkinson’s disease dementia and dementia with Lewy bodies, and controls, integrating APOE genotype, clinical data and assessment of ischaemic pathology alongside large-scale digital pathology quantification. We established an image analysis pipeline using machine learning to enable automated, standardized measurement of α-synuclein, amyloid-β and phosphorylated tau burden across multiple brain regions.

Quantitative pathology was strongly correlated with semi-quantitative ratings and outperformed conventional staging in predicting dementia. Across multiple analytical approaches, APOE ɛ3 and ɛ4 carriers showed distinct dementia risk profiles. APOE ɛ3 carriers developed dementia at lower quantitative α-synuclein and amyloid-β thresholds than ɛ4 carriers, although overall dementia risk was dominated by ɛ4 genotype, consistent with ɛ4 both promoting greater pathology accumulation and modifying the threshold for dementia onset. Orthostatic hypotension and ischaemic pathology increased dementia risk only in ɛ3 carriers with low Lewy and Alzheimer’s proteinopathy burden, and male sex further modulated dementia risk for this subgroup. The Subtype and Stage Inference (SuStaIn) algorithm identified four trajectories of Lewy pathology progression. Two corresponded to recognized patterns: (i) brainstem first; and (ii) with early amygdala and concomitant brainstem involvement. Two further patterns showed early cortical involvement: (i) with early cingulate cortex involvement together with brainstem pathology; and (ii) starting in the neocortex before limbic and brainstem involvement. Co-pathology progression modelling identified subtypes with early predominance of amyloid-β, phosphorylated tau or α-synuclein and showed that Lewy subtypes follow two propagation trajectories in opposite directions.

Together, these findings demonstrate that integrating quantitative pathology with genotype and clinical data reveals distinct yet overlapping pathways to dementia in LBD, refining disease progression models and providing a basis for genotype- and pathology-informed patient stratification in therapeutic trials.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

Its files are read in the Code ↔ Paper reader above, with 7 matches between paragraphs and lines of code.

Zenodo 18315069

License: CC-BY-4.0
State: the link answers, verified on 4 November 2026
Evidence: files inventoried
Languages: R (4), Jupyter (2)
Size: 12 files, 6 scripts
Software Heritage: not checked
Found in: “Data availability”
Holds: 2 notebooks
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: tidyverse (4 files), ggplot2 (3 files), Matplotlib (2 files), NumPy (2 files), pandas (2 files), Plotly (2 files), scikit-learn (2 files), scikit-posthocs (2 files), SciPy (2 files), seaborn (2 files), statsmodels (2 files), car (1 file), cowplot (1 file), pROC (1 file), reshape2 (1 file), rstatix (1 file), statannotations (1 file)
Availability: 1 check, the latest on 4 November 2026: the link answers (HTTP 200)
  • 4 November 2026: the link answers (HTTP 200)
6 files

The paper's code and data availability statement is in the Data section.

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:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 6 scripts, each with its path and the digest of its content;
  • 7 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

No dataset and no data link were found in the paper.

Data availability

The raw quantitative pathological data, protocols, R and python code and key laboratory materials used and generated in this study are listed in a Key Resource Table (KRT) alongside their persistent identifiers at https://zenodo.org/records/18315069. Whole slide images of cases used in this study are available for viewing via UCL QSBB Digital Pathology Resource (RRID:SCR_025020). Anonymized clinical and pathology data are available upon reasonable request, if in compliance with regulatory ethical approval.

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, 4 November 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 19 authors, 6 keywords, 16 MeSH terms, 2 funders, 0 references, 1 RRID.

Cite

This paper

Nelvagal, H. R., Chiraki, N., Curless, T., Cullinane, P. W., Rockliffe, A., Pimparkar, S., Kawamura, H., Ollerenshaw, S., Elahi, I., Brandner, S., Wu, L., Real, R., Ryten, M., Hardy, J., De Pablo Fernandez, E., Warner, T. T., Morris, H. R., Lim, Y. M., & Jaunmuktane, Z. (2026). Quantitative pathology and APOE genotype reveal dementia risk and progression in Lewy body disease. Brain : a journal of neurology, 149(11), 3905-3922. https://doi.org/10.1093/brain/awag114

BibTeX

@article{nelvagal2026quantitative,
author = {Nelvagal, Hemanth R and Chiraki, Nancy and Curless, Toby and Cullinane, Patrick W and Rockliffe, Alice and Pimparkar, Samarth and Kawamura, Haruka and Ollerenshaw, Sophie and Elahi, Isha and Brandner, Sebastian and Wu, Lesley and Real, Raquel and Ryten, Mina and Hardy, John and De Pablo Fernandez, Eduardo and Warner, Thomas T and Morris, Huw R and Lim, Yau Mun and Jaunmuktane, Zane},
title = {{Quantitative pathology and APOE genotype reveal dementia risk and progression in Lewy body disease}},
journal = {Brain : a journal of neurology},
year = {2026},
month = nov,
volume = {149},
number = {11},
pages = {3905--3922},
publisher = {Oxford University Press},
issn = {0006-8950},
doi = {10.1093/brain/awag114},
url = {https://doi.org/10.1093/brain/awag114},
pmid = {41889331},
pmcid = {PMC13730591}
}

RIS

TY - JOUR
AU - Nelvagal, Hemanth R
AU - Chiraki, Nancy
AU - Curless, Toby
AU - Cullinane, Patrick W
AU - Rockliffe, Alice
AU - Pimparkar, Samarth
AU - Kawamura, Haruka
AU - Ollerenshaw, Sophie
AU - Elahi, Isha
AU - Brandner, Sebastian
AU - Wu, Lesley
AU - Real, Raquel
AU - Ryten, Mina
AU - Hardy, John
AU - De Pablo Fernandez, Eduardo
AU - Warner, Thomas T
AU - Morris, Huw R
AU - Lim, Yau Mun
AU - Jaunmuktane, Zane
TI - Quantitative pathology and APOE genotype reveal dementia risk and progression in Lewy body disease
T2 - Brain : a journal of neurology
J2 - Brain
PY - 2026
DA - 2026/11/01
VL - 149
IS - 11
SP - 3905
EP - 3922
SN - 0006-8950
PB - Oxford University Press
DO - 10.1093/brain/awag114
UR - https://doi.org/10.1093/brain/awag114
LA - en
ER -

CSL-JSON

{
"id": "10.1093/brain/awag114",
"type": "article-journal",
"title": "Quantitative pathology and APOE genotype reveal dementia risk and progression in Lewy body disease",
"container-title": "Brain : a journal of neurology",
"author": [
{
"family": "Nelvagal",
"given": "Hemanth R"
},
{
"family": "Chiraki",
"given": "Nancy"
},
{
"family": "Curless",
"given": "Toby"
},
{
"family": "Cullinane",
"given": "Patrick W"
},
{
"family": "Rockliffe",
"given": "Alice"
},
{
"family": "Pimparkar",
"given": "Samarth"
},
{
"family": "Kawamura",
"given": "Haruka"
},
{
"family": "Ollerenshaw",
"given": "Sophie"
},
{
"family": "Elahi",
"given": "Isha"
},
{
"family": "Brandner",
"given": "Sebastian"
},
{
"family": "Wu",
"given": "Lesley"
},
{
"family": "Real",
"given": "Raquel"
},
{
"family": "Ryten",
"given": "Mina"
},
{
"family": "Hardy",
"given": "John"
},
{
"family": "De Pablo Fernandez",
"given": "Eduardo"
},
{
"family": "Warner",
"given": "Thomas T"
},
{
"family": "Morris",
"given": "Huw R"
},
{
"family": "Lim",
"given": "Yau Mun"
},
{
"family": "Jaunmuktane",
"given": "Zane"
}
],
"container-title-short": "Brain",
"volume": "149",
"issue": "11",
"page": "3905-3922",
"DOI": "10.1093/brain/awag114",
"PMID": "41889331",
"PMCID": "PMC13730591",
"ISSN": "0006-8950",
"publisher": "Oxford University Press",
"URL": "https://doi.org/10.1093/brain/awag114",
"language": "en",
"issued": {
"date-parts": [
[
2026,
11,
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.1093/brain/awag131 [code]
Data-driven modelling of tau pathology reveals distinct progressive supranuclear palsy subtypes.
Journal: Brain : a journal of neurology
In common: Alzheimer's / dementia, 9 authors
[2] doi:10.1212/nxg.0000000000200092 [code]
Genome-wide Analysis of Motor Progression in Parkinson Disease.
Journal: Neurology. Genetics
In common: Plotly, reshape2, ggplot2, 4 other tools, Parkinson's, genetics / omics, 4 authors
[3] doi:10.1038/s41467-024-52025-x [code]
Genetic, transcriptomic, histological, and biochemical analysis of progressive supranuclear palsy implicates glial activation and novel risk genes.
Journal: Nature communications
In common: tidyverse, pandas, Matplotlib, 1 other tool, Alzheimer's / dementia, genetics / omics, 4 authors
[4] doi:10.1126/sciadv.adk1296 [code]
The annotation of &lt;i&gt;GBA1&lt;/i&gt; has been concealed by its protein-coding pseudogene &lt;i&gt;GBAP1&lt;/i&gt;.
Journal: Science advances
In common: rstatix, car, cowplot, 7 other tools, Parkinson's, genetics / omics, 2 authors
[5] doi:10.21203/rs.3.rs-8766017/v1 [code]
A molecular map of the living human brain from quantitative MRI
Journal: Research Square (preprint)
In common: reshape2, statsmodels, ggplot2, 7 other tools, genetics / omics, 2 authors
[6] doi:10.1126/sciadv.adp8504 [code]
Astrocytic RNA editing regulates the host immune response to alpha-synuclein.
Journal: Science advances
In common: cowplot, reshape2, ggplot2, 4 other tools, Parkinson's, 2 authors
[7] doi:10.1038/s41588-023-01300-6 [code]
Brain expression quantitative trait locus and network analyses reveal downstream effects and putative drivers for brain-related diseases.
Journal: Nature genetics
In common: pROC, statannotations, Plotly, 11 other tools, genetics / omics
[8] 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: pROC, rstatix, car, 11 other tools, genetics / omics
[9] doi:10.1016/j.isci.2023.107522 [code]
Deep learning for risk-based stratification of cognitively impaired individuals.
Journal: iScience
In common: scikit-posthocs, rstatix, Plotly, 10 other tools, Alzheimer's / dementia
[10] doi:10.1038/s41467-025-66783-9 [code]
Evidence for divergent cortical organisation in Parkinson's disease and Lewy Body Dementia.
Journal: Nature communications
In common: scikit-posthocs, statsmodels, seaborn, 5 other tools, Parkinson's, Alzheimer's / dementia, author Mina Ryten

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.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/doi/10.1093/brain/awag114.svg)](https://openscicode.org/badge/doi/10.1093/brain/awag114)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1093/brain/awag114.svg
   :target: https://openscicode.org/badge/doi/10.1093/brain/awag114
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1093/brain/awag114"><img src="https://openscicode.org/badge/doi/10.1093/brain/awag114.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.

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: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.