OSCR

Genetic risk of Alzheimer's disease is associated with loss of brain network segregation in midlife.

Code ↔ Paper

1 match 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.

One block of code here has a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.

The 1 match
  1. [1] § Methods › Cognitive assessments and risk factors › The PREVENT cohort › Cognitive assessment ↔ risk_on_segregation_PREVENT.R, lines 1 to 42 · score 0.53 · cognitive domain, ratio, rotated, component, baseline · block oscr:b:HC46DZFDXNNFQ-C · 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 · 349 lines · 18 KB · no license · 1 match

  1. library(readxl)
  2. library(dplyr)
  3. library(psych)
  4. library(ggplot2)
  5. library(corrplot)
  6. library(Rmisc)
  7. library(lme4)
  8. library(lmerTest)
  9. library(effectsize)
  10. library(car)
  11. library(rstatix)
  12. library(tidyr)
  13. library(gghalves)
  14. ## Load cognition data
  15. Cog_t1 <- read_excel("Demo_risk_cog_t1_t2.xlsx", sheet = "baseline")
  16. Cog_t2 <- read_excel("Demo_risk_cog_t1_t2.xlsx", sheet = "follow_up")
  17. # recode data
  18. Cog_t1$FH1 <- factor(Cog_t1$FH1, levels=c(0,1), labels = c("FH-","FH+"))
  19. Cog_t2$FH2 <- factor(Cog_t2$FH2, levels=c(0,1), labels = c("FH-","FH+"))
  20. Cog_t1$apoe4 <- factor(Cog_t1$apoe4, levels=c(0,1), labels = c("non-carriers","carriers"))
  21. Cog_t2$apoe4 <- factor(Cog_t2$apoe4, levels=c(0,1), labels = c("non-carriers","carriers"))
  22. Cog_t1$Sex <- factor(Cog_t1$Sex, levels=c(1,2), labels = c("Male","Female"))
  23. Cog_t2$Sex <- factor(Cog_t2$Sex, levels=c(1,2), labels = c("Male","Female"))
  24. # Rotated PCA to extract main cognitive domains
  25. # parrallel analysis and scree plot to decide the number of components
  26. ParaAna_t1<-fa.parallel(Cog_t1[,9:21], fa="pc", n.iter = 500)
  27. ParaAna_t2<-fa.parallel(Cog_t2[,9:21], fa="pc", n.iter = 500)
  28. # rotated PCA
  29. PCs_t1<-principal(Cog_t1[,9:21], nfactors = 3, rotate="Varimax", eps=1e-7)
  30. PCs_t2<-principal(Cog_t2[,9:21], nfactors = 3, rotate="Varimax", eps=1e-7)
  31. # Visualise
  32. fa.diagram(PCs_t1)
  33. fa.diagram(PCs_t2)
  34. corrplot(PCs_t1$loadings,cl.ratio = 0.6,number.cex=0.8,number.digits=2, addCoef.col="black")
  35. corrplot(PCs_t2$loadings,cl.ratio = 0.6,number.cex=0.8,number.digits=2, addCoef.col="black")
  36. # Factor similarity
  37. fa.congruence(PCs_t1,PCs_t2)
  38. Cog_t1 <- cbind(Cog_t1,PCs_t1$scores)
  39. Cog_t2 <- cbind(Cog_t2,PCs_t2$scores) %>% rename(RC3=RC2,RC2=RC3)
  40. rm(ParaAna_t1,ParaAna_t2,PCs_t1,PCs_t2)
  41. Cog_t1$RC3_inv<-Cog_t1$RC3*(-1)
  42. Cog_t2$RC3_inv<-Cog_t2$RC3*(-1)
  43. # load functional data
  44. Seg_t1 <- read_excel("Segregation_Power214_noGSR.xlsx", sheet = "aucParameters_T1")
  45. Seg_t2 <- read_excel("Segregation_Power214_noGSR.xlsx", sheet = "aucParameters_T2")
  46. Seg_t1 <- inner_join(Seg_t1,Cog_t1,by="SubjID")
  47. Seg_t2 <- inner_join(Seg_t2,Cog_t2,by="SubjID")
  48. rm(Cog_t1,Cog_t2)
  49. # exclude participants with nodes less than
  50. Seg_t1<-Seg_t1[!(Seg_t1$No_Nodes_retained<214*0.8),]
  51. Seg_t2<-Seg_t2[!(Seg_t2$No_Nodes_retained<214*0.8),]
  52. # exclude participants with headmovement larger than
  53. Seg_t1<-Seg_t1[!(Seg_t1$meanFD>0.4),]
  54. Seg_t2<-Seg_t2[!(Seg_t2$meanFD>0.4),]
  55. # load brain struct data
  56. BrainStruc_t1 <- read_excel("BrainStruc_t1_t2.xlsx", sheet = "T1")
  57. BrainStruc_t2 <- read_excel("BrainStruc_t1_t2.xlsx", sheet = "T2")
  58. Seg_t1 <- inner_join(Seg_t1,BrainStruc_t1,by="SubjID")
  59. Seg_t2 <- inner_join(Seg_t2,BrainStruc_t2,by="SubjID")
  60. rm(BrainStruc_t1,BrainStruc_t2)
  61. Seg_t1<-Seg_t1%>%rename(TICV=EstimatedTotalIntraCranialVol)
  62. Seg_t2<-Seg_t2%>%rename(TICV=EstimatedTotalIntraCranialVol)
  63. # load number of retained brain nodes per network
  64. No_Nodes_Net_t1 <-read_excel("No_Nodes_Net.xlsx", sheet = "baseline")
  65. No_Nodes_Net_t2 <-read_excel("No_Nodes_Net.xlsx", sheet = "followup")
  66. Seg_t1 <- inner_join(Seg_t1,No_Nodes_Net_t1,by="SubjID")
  67. Seg_t2 <- inner_join(Seg_t2,No_Nodes_Net_t2,by="SubjID")
  68. rm(No_Nodes_Net_t1,No_Nodes_Net_t2)
  69. # code some data
  70. Seg_t1[Seg_t1$Sex == 'Male','SexC'] = -1
  71. Seg_t1[Seg_t1$Sex == 'Female','SexC'] = 1
  72. Seg_t1[Seg_t1$FH == 'FH-','FHC'] = -1
  73. Seg_t1[Seg_t1$FH == 'FH+','FHC'] = 1
  74. Seg_t1_clean <- Seg_t1 %>% filter(!is.na(apoe4))
  75. Seg_t1_clean[Seg_t1_clean$apoe4 == 'non-carriers','apoe4C'] = -1
  76. Seg_t1_clean[Seg_t1_clean$apoe4 == 'carriers','apoe4C'] = 1
  77. # risk effect on global segregation
  78. lm_model_apoe4_1 <- lm(scale(Pc_Global) ~ apoe4C + scale(Age) + SexC + scale(meanFD) + scale(No_Nodes_retained), data = Seg_t1_clean)
  79. summary(lm_model_apoe4_1)
  80. round(confint(lm_model_apoe4_1), 2)
  81. lm_model_apoe4_2 <- lm(scale(Pc_Global) ~ apoe4C + scale(Age) + SexC + scale(TotalGrayVol) + scale(TICV) + scale(meanFD) + scale(No_Nodes_retained), data = Seg_t1_clean)
  82. round(confint(lm_model_apoe4_2), 2)
  83. lm_model_FH <- lm(scale(Pc_Global) ~ FHC + scale(Age) + SexC + scale(meanFD) + scale(No_Nodes_retained), data = Seg_t1)
  84. summary(lm_model_FH)
  85. round(confint(lm_model_FH), 2)
  86. lm_model_CAIDE <- lm(scale(Pc_Global) ~ scale(CAIDE) + scale(meanFD) + scale(No_Nodes_retained), data = Seg_t1_clean)
  87. summary(lm_model_CAIDE)
  88. round(confint(lm_model_CAIDE), 2)
  89. # risk effect on network segregation
  90. lm_Pc5<-lm(scale(Pc_5) ~ apoe4C + scale(Age) + SexC + scale(meanFD) + scale(Network5), data=Seg_t1_clean) # DMN
  91. lm_Pc7<-lm(scale(Pc_7) ~ apoe4C + scale(Age) + SexC + scale(meanFD) + scale(Network7), data=Seg_t1_clean) # FPN
  92. lm_Pc8<-lm(scale(Pc_8) ~ apoe4C + scale(Age) + SexC + scale(meanFD) + scale(Network8), data=Seg_t1_clean) # SN
  93. models <- list(lm_Pc5, lm_Pc7, lm_Pc8)
  94. results <- lapply(models, function(model) {
  95. tidy(model, conf.int = TRUE) %>%
  96. filter(term == "apoe4C") %>%
  97. select(term, estimate, conf.low, conf.high)
  98. })
  99. results_df <- do.call(rbind, results) %>%
  100. mutate(Network = rep(c("DMN", "FPN", "SN"), each = 1)) %>%
  101. mutate(term = "apoe4C")
  102. results_df$Network<-factor(results_df$Network,levels = c("SN","DMN","FPN"))
  103. # PLOT baseline results
  104. Seg_t1_clean$resid_Pc <- resid(lm(Pc_Global ~ scale(Age) + SexC + scale(meanFD) + scale(No_Nodes_retained), data = Seg_t1_clean))
  105. Seg_t1_clean$resid_Pc_5 <- resid(lm(Pc_5 ~ scale(Age) + SexC + scale(meanFD) + scale(Network5), data = Seg_t1_clean))
  106. Seg_t1_clean$apoe4n<-as.numeric(Seg_t1_clean$apoe4) #noncarriers=1; carriers=2
  107. set.seed(123)
  108. Seg_t1_clean$apoe4nj<-jitter(Seg_t1_clean$apoe4n,amount=0.09)
  109. GPc_apoe4_SE <- summarySE(Seg_t1_clean, measurevar="resid_Pc", groupvars="apoe4n")
  110. Pc5_apoe4_SE <- summarySE(Seg_t1_clean, measurevar="resid_Pc_5", groupvars="apoe4n")
  111. ggplot(data=filter(Seg_t1_clean, !is.na(apoe4n)), aes(y = resid_Pc))+
  112. geom_point(data=Seg_t1_clean %>% filter(apoe4n=="1"),aes(x = apoe4nj),color = "cornflowerblue", size=2,alpha=.4)+
  113. geom_point(data=Seg_t1_clean %>% filter(apoe4n=="2"),aes(x = apoe4nj),color = "salmon",size=2, alpha=.6)+
  114. geom_errorbar(data=filter(GPc_apoe4_SE,!is.na(apoe4n)), aes(x=apoe4n, ymin=resid_Pc-ci, ymax=resid_Pc+ci), width=.1) +
  115. geom_point(data=filter(GPc_apoe4_SE,!is.na(apoe4n)) %>% filter(apoe4n=="1"),aes(x = apoe4n,y=resid_Pc),shape=21, color="black", fill="cornflowerblue", size=2, stroke=1)+
  116. geom_point(data=filter(GPc_apoe4_SE,!is.na(apoe4n)) %>% filter(apoe4n=="2"),aes(x = apoe4n,y=resid_Pc),shape=21, color="black", fill="salmon", size=2, stroke=1)+
  117. geom_half_violin(data=filter(Seg_t1_clean, !is.na(apoe4n)) %>% filter(apoe4n=="1"), aes(x = apoe4n, y = resid_Pc), #CHANGE
  118. position=position_nudge(x=-.2),side="l",width=.5, fill="cornflowerblue",alpha=.4)+
  119. geom_half_violin(data=filter(Seg_t1_clean, !is.na(apoe4n)) %>% filter(apoe4n=="2"), aes(x = apoe4n, y = resid_Pc), #CHANGE
  120. position=position_nudge(x=.2),side="r",width=.5, fill="salmon",alpha=.6)+
  121. scale_x_continuous(breaks = c(1, 2),labels=c("non-carriers","carriers"))+ #limits = c(0,3)
  122. ylab("Global Pc")+
  123. scale_y_continuous(labels = scales::number_format(accuracy = 0.01))+#,limits = c(-2,2),limits = c(-0.35,-0.25)
  124. theme(axis.text=element_text(size=12,colour = "black"),
  125. axis.title=element_text(size=12,colour = "black"),
  126. panel.border = element_blank(),
  127. panel.grid.major = element_blank(),
  128. panel.grid.minor = element_blank(),
  129. panel.background = element_blank(),
  130. axis.line = element_line(colour = "black",linewidth = 0.5),
  131. legend.position = "none",
  132. axis.title.x=element_blank())
  133. rm(GPc_apoe4_SE,Pc5_apoe4_SE)
  134. # segregation - cognition relationships at baseline
  135. lm_model_RC1_G <- lm(RC1 ~ scale(Pc_Global) + scale(Age) + SexC + scale(YeaoEdu) + scale(meanFD) + scale(No_Nodes_retained), data = Seg_t1)
  136. lm_model_RC2_G <- lm(RC2 ~ scale(Pc_Global) + scale(Age) + SexC + scale(YeaoEdu) + scale(meanFD) + scale(No_Nodes_retained), data = Seg_t1)
  137. lm_model_RC3_G <- lm(RC3_inv ~ scale(Pc_Global) + scale(Age) + SexC + scale(YeaoEdu) + scale(meanFD) + scale(No_Nodes_retained), data = Seg_t1)
  138. summary(lm_model_RC1_G)
  139. summary(lm_model_RC2_G)
  140. summary(lm_model_RC3_G)
  141. lm_model_RC1_DMN <- lm(RC1 ~ scale(Pc_5) + scale(Age) + SexC + scale(YeaoEdu) + scale(meanFD) + scale(Network5), data = Seg_t1)
  142. lm_model_RC2_DMN <- lm(RC2 ~ scale(Pc_5) + scale(Age) + SexC + scale(YeaoEdu) + scale(meanFD) + scale(Network5), data = Seg_t1)
  143. lm_model_RC3_DMN <- lm(RC3_inv ~ scale(Pc_5) + scale(Age) + SexC + scale(YeaoEdu) + scale(meanFD) + scale(Network5), data = Seg_t1)
  144. summary(lm_model_RC1_DMN)
  145. summary(lm_model_RC2_DMN)
  146. summary(lm_model_RC3_DMN)
  147. # plot Pc~Cog relationship
  148. Seg_t1 = Seg_t1[complete.cases(Seg_t1$RC1), ]
  149. Seg_t1$RC1_resids <- resid(lm(RC1 ~ scale(Age) + SexC + scale(YeaoEdu) + scale(meanFD) + scale(No_Nodes_retained), data = Seg_t1))
  150. Seg_t1$Pc_Global_resids <- resid(lm(Pc_Global ~ scale(Age) + SexC + scale(YeaoEdu) + scale(meanFD) + scale(No_Nodes_retained), data = Seg_t1))
  151. Seg_t1$RC1_resids2 <- resid(lm(RC1 ~ scale(Age) + SexC + scale(YeaoEdu) + scale(meanFD) + scale(Network5), data = Seg_t1))
  152. Seg_t1$Pc5_resids <- resid(lm(Pc_5 ~ scale(Age) + SexC + scale(YeaoEdu) + scale(meanFD) + scale(Network5), data = Seg_t1))
  153. ggplot(data=Seg_t1,#filter(Seg_t1, !is.na(apoe4.x)
  154. aes(x=Pc5_resids, y = RC1_resids2))+ #, color=apoe4.x
  155. geom_smooth(method=lm)+
  156. geom_jitter(size = 2, alpha=.6)+
  157. xlab("DMN Pc")+
  158. ylab("Episodic and relational memory")+ #∆ Response time in working memory
  159. scale_x_continuous(labels = scales::number_format(accuracy = 0.01))+#,limits=c(0.10,0.35)
  160. scale_y_continuous(labels = scales::number_format(accuracy = 0.01))+ #,limits=c(-12,16)
  161. theme(axis.text=element_text(size=12,colour = "black"),
  162. axis.title=element_text(size=12,colour = "black"),
  163. panel.border = element_blank(),
  164. panel.grid.major = element_blank(),
  165. panel.grid.minor = element_blank(),
  166. panel.background = element_blank(),
  167. axis.line = element_line(colour = "grey",linewidth = 1),
  168. legend.position = "right")
  169. # risk impact on longitudinal change of segregation
  170. Seg_all<-inner_join(Seg_t1_clean,Seg_t2,by="SubjID")
  171. Pc_Global<-gather(Seg_all[,c("SubjID","apoe4C","Age.x","SexC","Pc_Global.x","Pc_Global.y")], Time, Pc_Global, c("Pc_Global.x","Pc_Global.y"))
  172. Pc_Global$Time<-factor(Pc_Global$Time)
  173. levels(Pc_Global$Time)[levels(Pc_Global$Time)=="Pc_Global.x"] <- "Baseline"
  174. levels(Pc_Global$Time)[levels(Pc_Global$Time)=="Pc_Global.y"] <- "Follow_up"
  175. Pc_5<-gather(Seg_all[,c("SubjID","Pc_5.x","Pc_5.y")], Time, Pc_5, c("Pc_5.x","Pc_5.y"))
  176. Pc_5$Time<-factor(Pc_5$Time)
  177. levels(Pc_5$Time)[levels(Pc_5$Time)=="Pc_5.x"] <- "Baseline"
  178. levels(Pc_5$Time)[levels(Pc_5$Time)=="Pc_5.y"] <- "Follow_up"
  179. meanFD<-gather(Seg_all[,c("SubjID","meanFD.x","meanFD.y")], Time, meanFD, c("meanFD.x","meanFD.y"))
  180. meanFD$Time<-factor(meanFD$Time)
  181. levels(meanFD$Time)[levels(meanFD$Time)=="meanFD.x"] <- "Baseline"
  182. levels(meanFD$Time)[levels(meanFD$Time)=="meanFD.y"] <- "Follow_up"
  183. No_Nodes_retained<-gather(Seg_all[,c("SubjID","No_Nodes_retained.x","No_Nodes_retained.y")], Time, No_Nodes_retained, c("No_Nodes_retained.x","No_Nodes_retained.y"))
  184. No_Nodes_retained$Time<-factor(No_Nodes_retained$Time)
  185. levels(No_Nodes_retained$Time)[levels(No_Nodes_retained$Time)=="No_Nodes_retained.x"] <- "Baseline"
  186. levels(No_Nodes_retained$Time)[levels(No_Nodes_retained$Time)=="No_Nodes_retained.y"] <- "Follow_up"
  187. Network5<-gather(Seg_all[,c("SubjID","Network5.x","Network5.y")], Time, Network5, c("Network5.x","Network5.y"))
  188. Network5$Time<-factor(Network5$Time)
  189. levels(Network5$Time)[levels(Network5$Time)=="Network5.x"] <- "Baseline"
  190. levels(Network5$Time)[levels(Network5$Time)=="Network5.y"] <- "Follow_up"
  191. RC1<-gather(Seg_all[,c("SubjID","RC1.x","RC1.y")], Time, RC1, c("RC1.x","RC1.y"))
  192. RC1$Time<-factor(RC1$Time)
  193. levels(RC1$Time)[levels(RC1$Time)=="RC1.x"] <- "Baseline"
  194. levels(RC1$Time)[levels(RC1$Time)=="RC1.y"] <- "Follow_up"
  195. TotalGrayVol<-gather(Seg_all[,c("SubjID","TotalGrayVol.x","TotalGrayVol.y")], Time, TotalGrayVol, c("TotalGrayVol.x","TotalGrayVol.y"))
  196. TotalGrayVol$Time<-factor(TotalGrayVol$Time)
  197. levels(TotalGrayVol$Time)[levels(TotalGrayVol$Time)=="TotalGrayVol.x"] <- "Baseline"
  198. levels(TotalGrayVol$Time)[levels(TotalGrayVol$Time)=="TotalGrayVol.y"] <- "Follow_up"
  199. TICV<-gather(Seg_all[,c("SubjID","TICV.x","TICV.y")], Time, TICV, c("TICV.x","TICV.y"))
  200. TICV$Time<-factor(TICV$Time)
  201. levels(TICV$Time)[levels(TICV$Time)=="TICV.x"] <- "Baseline"
  202. levels(TICV$Time)[levels(TICV$Time)=="TICV.y"] <- "Follow_up"
  203. Pc<-left_join(Pc_Global,Pc_5)
  204. Pc<-left_join(Pc,meanFD)
  205. Pc<-left_join(Pc,No_Nodes_retained)
  206. Pc<-left_join(Pc,Network5)
  207. Pc<-left_join(Pc,RC1)
  208. Pc<-left_join(Pc,TotalGrayVol)
  209. Pc<-left_join(Pc,TICV)
  210. Pc[Pc$Time == 'Baseline','TimeC'] = -1
  211. Pc[Pc$Time == 'Follow_up','TimeC'] = 1
  212. model <- lmer(scale(Pc_Global) ~ TimeC*apoe4C + scale(Age.x) + SexC + scale(meanFD) + scale(No_Nodes_retained) + (1 | SubjID), data = Pc)
  213. model_5 <- lmer(scale(Pc_5) ~ TimeC*apoe4C+ scale(Age.x) + SexC + scale(meanFD) + scale(Network5) + (1 | SubjID), data = Pc)
  214. summary(model)
  215. round(confint(model), 2)
  216. summary(model_5)
  217. round(confint(model_5), 2)
  218. model_cog <- lmer(RC1 ~ TimeC*scale(Pc_Global) + scale(Age.x) + SexC + scale(meanFD) + scale(No_Nodes_retained) + (1 | SubjID), data = Pc)
  219. model_cog_5 <- lmer(RC1 ~ TimeC*scale(Pc_5)+ scale(Age.x) + SexC + scale(meanFD) + scale(Network5) + (1 | SubjID), data = Pc)
  220. summary(model_cog)
  221. summary(model_cog_5)
  222. # simple effects testing
  223. noncarriers<-filter(Seg_all,apoe4.x=="non-carriers")
  224. carriers<-filter(Seg_all,apoe4.x=="carriers")
  225. t.test(carriers$Pc_5.x,carriers$Pc_5.y,paired = T)#p=0.007
  226. t.test(noncarriers$Pc_5.x,noncarriers$Pc_5.y,paired = T)#p=0.49
  227. # plot longitudinal results
  228. Pc$resid_Pc <- resid(lmer(Pc_Global ~ scale(Age.x) + SexC + scale(meanFD) + scale(No_Nodes_retained) + (1 | SubjID), data = Pc))
  229. Pc$resid_Pc_5 <- resid(lmer(Pc_5 ~ scale(Age.x) + SexC + scale(meanFD) + scale(Network5) + (1 | SubjID), data = Pc))
  230. Pc$Timen<-as.numeric(Pc$Time)
  231. set.seed(123)
  232. Pc$Timenj<-jitter(Pc$Timen,amount=0.09)
  233. noncarriers<-filter(Pc,apoe4C==-1)
  234. carriers<-filter(Pc,apoe4C==1)
  235. library(Rmisc)
  236. noncarriers_SE <- summarySE(noncarriers, measurevar="resid_Pc", groupvars="Timen")
  237. carriers_SE <- summarySE(carriers, measurevar="resid_Pc", groupvars="Timen")
  238. ggplot(data=carriers, aes(y = resid_Pc))+ #CHANGE
  239. geom_point(data=carriers%>%filter(Timen=="1"), aes(x = Timenj), color = "salmon", size=2, alpha=.6)+
  240. geom_point(data=carriers%>%filter(Timen=="2"), aes(x = Timenj), color = "salmon", size=2, alpha=.6)+
  241. geom_line(data=carriers, aes(x=Timenj, group=SubjID), color='gray', alpha=.5)+
  242. geom_errorbar(data=carriers_SE, aes(x=Timen, ymin=resid_Pc-ci, ymax=resid_Pc+ci), width=.1) +
  243. geom_point(data=carriers_SE, aes(x=Timen, y=resid_Pc), shape=21, color="black", fill="salmon", size=2, stroke=1) +
  244. geom_line(data=carriers_SE, aes(x=Timen), color='salmon', linewidth=1, alpha=.5) +
  245. geom_half_violin(data=carriers %>% filter(Timen=="1"), aes(x = Timen, y = resid_Pc), #CHANGE
  246. position=position_nudge(x=1.3),side="r",width=.5, fill="salmon",alpha=.6)+
  247. geom_half_violin(data=carriers %>% filter(Timen=="2"), aes(x = Timen, y = resid_Pc), #CHANGE
  248. position=position_nudge(x=.3),side="r",width=.5, fill="salmon",alpha=.6)+
  249. scale_x_continuous(breaks = c(1,2),labels=c("Baseline","Follow-up"),limits = c(0,3))+ #,limits = c(0.5,3)
  250. scale_y_continuous(labels = scales::number_format(accuracy = 0.01),limits=c(-0.035,0.035))+ #,,limits=c(-0.35,-0.25)
  251. labs(title = "APOE ɛ4 carriers", y="Global Pc")+
  252. theme(axis.text=element_text(size=12,colour = "black"),
  253. axis.title=element_text(size=12,colour = "black"),
  254. panel.border = element_blank(),
  255. panel.grid.major = element_blank(),
  256. panel.grid.minor = element_blank(),
  257. panel.background = element_blank(),
  258. axis.line = element_line(colour = "black",linewidth = 0.5),
  259. legend.position = "none",
  260. axis.title.x=element_blank())
  261. ggplot(data=noncarriers, aes(y = resid_Pc))+ #CHANGE
  262. geom_point(data=noncarriers%>%filter(Timen=="1"), aes(x = Timenj), color = "cornflowerblue", size=2, alpha=.4)+
  263. geom_point(data=noncarriers%>%filter(Timen=="2"), aes(x = Timenj), color = "cornflowerblue", size=2, alpha=.4)+
  264. geom_line(data=noncarriers, aes(x=Timenj, group=SubjID), color='gray', alpha=.5)+
  265. geom_errorbar(data=noncarriers_SE, aes(x=Timen, ymin=resid_Pc-ci, ymax=resid_Pc+ci), width=.1) +
  266. geom_point(data=noncarriers_SE, aes(x=Timen, y=resid_Pc), shape=21, color="black", fill="cornflowerblue", size=2, stroke=1) +
  267. geom_line(data=noncarriers_SE, aes(x=Timen), color='cornflowerblue', linewidth=1, alpha=.5) +
  268. geom_half_violin(data=noncarriers %>% filter(Timen=="1"), aes(x = Timen, y = resid_Pc), #CHANGE
  269. position=position_nudge(x=-.3),side="l",width=.5, fill="cornflowerblue",alpha=.4)+
  270. geom_half_violin(data=noncarriers %>% filter(Timen=="2"), aes(x = Timen, y = resid_Pc), #CHANGE
  271. position=position_nudge(x=-1.3),side="l",width=.5, fill="cornflowerblue",alpha=.4)+
  272. scale_x_continuous(breaks = c(1,2),labels=c("Baseline","Follow-up"),limits = c(0,3))+ #,limits = c(0.5,3)
  273. scale_y_continuous(labels = scales::number_format(accuracy = 0.01),limits=c(-0.035,0.035))+ #,,limits=c(-0.35,-0.25) c(-0.35, -0.10)
  274. labs(title = "APOE ɛ4 non-carriers", y="Global Pc")+
  275. theme(axis.text=element_text(size=12,colour = "black"),
  276. axis.title=element_text(size=12,colour = "black"),
  277. panel.border = element_blank(),
  278. panel.grid.major = element_blank(),
  279. panel.grid.minor = element_blank(),
  280. panel.background = element_blank(),
  281. axis.line = element_line(colour = "black",linewidth = 0.5),
  282. legend.position = "none",
  283. axis.title.x=element_blank())

risk_on_segregation_PREVENT.R at commit 868dbc2, no license · at the source

Overview

Authors: Feng Deng1, Richard N. Henson2,3, Graciela Muniz-Terrera4,5, Paresh Malhotra6,7, John T. O’Brien3,8, Craig W. Ritchie4,9, Brian Lawlor10,11, Lorina Naci10,11
  1. School of Psychology, Shenzhen University,Shenzhen, China
  2. Medical Research Council Cognition and Brain Sciences Unit, University of Cambridge,Cambridge, UK
  3. Department of Psychiatry, School of Clinical Medicine, University of Cambridge,Cambridge, UK
  4. Edinburgh Dementia Prevention, University of Edinburgh,Edinburgh, UK
  5. Department of Social Medicine, Ohio University, Ohio,Athens, OH USA
  6. Department of Brain Science, Imperial College London,London, UK
  7. UK Dementia Research Institute Care Research and Technology Centre, Imperial College London and the University of Surrey,London, UK
  8. Cambridgeshire and Peterborough NHS Foundation Trust,Cambridge, UK
  9. Scottish Brain Sciences, Edinburgh, UK
  10. Trinity College Institute of Neuroscience, School of Psychology, Trinity College Dublin,Dublin, Ireland
  11. Global Brain Health Institute, Trinity College Dublin,Dublin, Ireland
Institutions: Shenzhen University (China); University of Cambridge (United Kingdom); University of Edinburgh (United Kingdom); Ohio University (United States); Imperial College London (United Kingdom); Cambridgeshire and Peterborough NHS Foundation Trust (United Kingdom); Trinity College Dublin (Ireland)
Journal: Communications biology, volume 9, issue 1, article 1067
Dates: received 11 June 2025; accepted 6 May 2026; published online 19 May 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s42003-026-10282-0 · PMID 42157001 · PMCID PMC13454165 · OpenAlex W7161748663
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: genetics / omics (modality), human (organism), Alzheimer's / dementia (population), clinical / translational (subfield)
Methods: Spectral & time-frequency, Statistics, Smoothing, state filtering, decompositions, Preprocessing, Connectivity, Graphs, fMRI & imaging
Keywords: Risk factors, Predictive markers, Alzheimer's disease, Cognitive ageing
MeSH: Alzheimer Disease*, Brain*, Genetic Predisposition to Disease*, Nerve Net*, Adolescent, Adult, Aged, Aged, 80 and over, Apolipoprotein E4, Cross-Sectional Studies, Female, Humans, Longitudinal Studies, Magnetic Resonance Imaging, Male, Middle Aged, Risk Factors, Young Adult (* major topic)
Topic: Functional Brain Connectivity Studies (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Citations: not cited yet (Europe PMC); 105 references in the paper

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repository

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

fengdeng315/Segregation_risk_age

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: 868dbc2431e114e03bbc09f7ab4ec2e21724b920, 1 April 2025
Languages: R (2)
Size: 3 files, 2 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: easystats (2 files), ggplot2 (2 files), tidyverse (2 files), broom (1 file), car (1 file), lme4 (1 file), lmerTest (1 file), psych (1 file), rstatix (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
3 files

Code availability statement

The paper has a code availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1038/s42003-026-10282-0.

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;
  • 2 scripts, each with its path and the digest of its content;
  • 1 match 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 statement

The paper has a data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

  • no repository, dataset or request procedure was recognized in it

Read it in the paper: doi.org/10.1038/s42003-026-10282-0.

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, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 8 authors, 4 keywords, 18 MeSH terms, 2 funders, 102 references.

Cite

This paper

Deng, F., Henson, R. N., Muniz-Terrera, G., Malhotra, P., O’Brien, J. T., Ritchie, C. W., Lawlor, B., & Naci, L. (2026). Genetic risk of Alzheimer's disease is associated with loss of brain network segregation in midlife. Communications biology, 9(1), 1067. https://doi.org/10.1038/s42003-026-10282-0

BibTeX

@article{deng2026genetic,
author = {Deng, Feng and Henson, Richard N. and Muniz-Terrera, Graciela and Malhotra, Paresh and O’Brien, John T. and Ritchie, Craig W. and Lawlor, Brian and Naci, Lorina},
title = {{Genetic risk of Alzheimer's disease is associated with loss of brain network segregation in midlife}},
journal = {Communications biology},
year = {2026},
month = may,
volume = {9},
number = {1},
pages = {1067},
publisher = {Nature Publishing Group},
issn = {2399-3642},
doi = {10.1038/s42003-026-10282-0},
url = {https://doi.org/10.1038/s42003-026-10282-0},
pmid = {42157001},
pmcid = {PMC13454165}
}

RIS

TY - JOUR
AU - Deng, Feng
AU - Henson, Richard N.
AU - Muniz-Terrera, Graciela
AU - Malhotra, Paresh
AU - O’Brien, John T.
AU - Ritchie, Craig W.
AU - Lawlor, Brian
AU - Naci, Lorina
TI - Genetic risk of Alzheimer's disease is associated with loss of brain network segregation in midlife
T2 - Communications biology
J2 - Commun Biol
PY - 2026
DA - 2026/05/19
VL - 9
IS - 1
SP - 1067
SN - 2399-3642
PB - Nature Publishing Group
DO - 10.1038/s42003-026-10282-0
UR - https://doi.org/10.1038/s42003-026-10282-0
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s42003-026-10282-0",
"type": "article-journal",
"title": "Genetic risk of Alzheimer's disease is associated with loss of brain network segregation in midlife",
"container-title": "Communications biology",
"author": [
{
"family": "Deng",
"given": "Feng"
},
{
"family": "Henson",
"given": "Richard N."
},
{
"family": "Muniz-Terrera",
"given": "Graciela"
},
{
"family": "Malhotra",
"given": "Paresh"
},
{
"family": "O’Brien",
"given": "John T."
},
{
"family": "Ritchie",
"given": "Craig W."
},
{
"family": "Lawlor",
"given": "Brian"
},
{
"family": "Naci",
"given": "Lorina"
}
],
"container-title-short": "Commun Biol",
"volume": "9",
"issue": "1",
"page": "1067",
"DOI": "10.1038/s42003-026-10282-0",
"PMID": "42157001",
"PMCID": "PMC13454165",
"ISSN": "2399-3642",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s42003-026-10282-0",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
19
]
]
}
}

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.1523/jneurosci.0579-23.2023 [code]
Dissociable Effects of Alzheimer's Disease-Related Cognitive Dysfunction and Aging on Functional Brain Network Segregation.
Journal: The Journal of neuroscience : the official journal of the Society for Neuroscience
In common: Alzheimer's / dementia, 20 references
[2] doi:10.1093/cercor/bhad506
Measures of resting-state brain network segregation and integration vary in relation to data quantity: implications for within and between subject comparisons of functional brain network organization.
Journal: Cerebral cortex (New York, N.Y. : 1991)
In common: 19 references
[3] doi:10.1093/cercor/bhac387 [code]
Age-related reorganization of functional network architecture in semantic cognition.
Journal: Cerebral cortex (New York, N.Y. : 1991)
In common: easystats, rstatix, psych, 2 other tools, 13 references
[4] doi:10.1016/j.neurobiolaging.2023.11.009 [code]
Does functional system segregation mediate the effects of lifestyle on cognition in older adults?
Journal: Neurobiology of aging
In common: broom, easystats, psych, 2 other tools, 12 references
[5] doi:10.1038/s43587-021-00125-4 [code]
Long-term prognosis and educational determinants of brain network decline in older adult individuals.
Journal: Nature aging
In common: Alzheimer's / dementia, clinical / translational, 16 references
[6] doi:10.1002/hbm.26650 [code]
Modeling the neurocognitive dynamics of language across the lifespan.
Journal: Human brain mapping
In common: easystats, rstatix, car, 2 other tools, 12 references
[7] doi:10.1002/alz.13733 [code]
Entorhinal-based path integration selectively predicts midlife risk of Alzheimer's disease.
Journal: Alzheimer's & dementia : the journal of the Alzheimer's Association
In common: Alzheimer's / dementia, 5 references, 2 authors
[8] doi:10.1186/s40337-026-01671-1 [code]
Aberrant large- and mesoscale network segregation and integration in bulimia nervosa.
Journal: Journal of eating disorders
In common: broom, easystats, car, 2 other tools, 9 references
[9] doi:10.64898/2026.03.20.713139 [code]
Dissociable contributions of cortical thickness and surface area to cognitive ageing: evidence from multiple longitudinal cohorts
Journal: bioRxiv (preprint)
In common: broom, easystats, psych, 5 other tools, 1 reference, author Richard N Henson
[10] doi:10.7554/elife.78076 [code]
Network segregation is associated with processing speed in the cognitively healthy oldest-old.
Journal: eLife
In common: ggplot2, tidyverse, 12 references

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.1038/s42003-026-10282-0.svg)](https://openscicode.org/badge/doi/10.1038/s42003-026-10282-0)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1038/s42003-026-10282-0.svg
   :target: https://openscicode.org/badge/doi/10.1038/s42003-026-10282-0
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s42003-026-10282-0"><img src="https://openscicode.org/badge/doi/10.1038/s42003-026-10282-0.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".

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)

Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.

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