OSCR

Brain Aging Mediating Heart Imaging-Derived Phenotypes and Mental and Nervous System Disorders.

Code ↔ Paper

2 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 2 matches
  1. [1] § Methods › Statistical Analysis › Brain Biological Age Prediction Model ↔ s1_predict_BA.R, lines 92–179 · score 0.83 · covariates regression model, training folds, age prediction, GLMnet, alpha, optimal
  2. [2] § Results › Brain Age Models and Associations of Heart IDPs With BAG ↔ s1_predict_BA.R, lines 92–179 · score 0.57 · LASSO model, regression model, MAE, predictive, S1, trained

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 · 181 lines · 7.7 KB · no license · 2 matches

  1. library(dplyr)
  2. library(readr)
  3. library(caret)
  4. library(glmnet)
  5. library(Metrics)
  6. # Define paths
  7. cova_data_path <- "cova.csv"
  8. cova_data <- read.csv(cova_data_path)
  9. eid_data_path <- "BA_health_eid.csv"
  10. allSiteInfo <- read.table('AllSiteInfo.csv', sep=',' ,header=T, check.names=F)
  11. HeightInfo <- read.table("AllHeightInfo.csv", sep=',', header=T, check.names=F)
  12. HeightInfo <- HeightInfo[,c('eid','50-0.0')]
  13. colnames(HeightInfo) <- c('eid', 'Height')
  14. # Define organs and their respective data files
  15. organs <- c('Brain_WM')
  16. ########################## model traning and testing on normal controls
  17. for (i in 1:length(organs)) {
  18. organ <- organs[i]
  19. # Load data
  20. df_GM <- read.csv("Brain_GM_clean.csv")
  21. df_WM <- read.csv("Brain_WM_clean.csv")
  22. df <- merge(df_GM, df_WM, by=c('eid'))
  23. # using only normal controls
  24. eid <- read.csv(eid_data_path)
  25. df <- inner_join(df, eid['eid'], by = 'eid')
  26. age <- read.csv(cova_data_path)
  27. age <- age[,c('eid','age2')]
  28. df <- inner_join(df, age, by = 'eid')
  29. df <- rename(df, Age = age2)
  30. # get confounding info
  31. df <- merge(df, allSiteInfo[,c('eid','54-2.0')])
  32. colnames(df)[which(colnames(df) == "54-2.0")] <- "Site"
  33. df$Site <- as.character(df$Site)
  34. df <- fastDummies::dummy_cols(df, select_columns = "Site", remove_first_dummy = TRUE)
  35. SiteCols <- unlist(sapply(colnames(df),function(x) if(grepl('Site_',x)) x),use.names = F)
  36. TIV <- cova_data
  37. TIV <- TIV[,c('eid','eTIV','Sex')]
  38. df <- merge(df, TIV, by = 'eid')
  39. df <- na.omit(df)
  40. table(df$Site)
  41. # Split data into training and testing sets
  42. set.seed(12345)
  43. folds <- createFolds(df$Age, k = 10)
  44. list_mae <- list()
  45. list_r <- list()
  46. list_models <- list()
  47. list_correctionModel <- list()
  48. list_lambda <- list()
  49. list_scaler <- list()
  50. list_plots <- list()
  51. list_coef <- list()
  52. list_covModles <- list()
  53. alldata <- df
  54. for (k in 1:10) {
  55. print(k)
  56. test_indices <- folds[[k]]
  57. train_indices <- setdiff(1:nrow(alldata), test_indices)
  58. x_train_data <- alldata[train_indices,]
  59. x_test_data <- alldata[test_indices,]
  60. data_matrix <- x_train_data
  61. data_matrix_test <- x_test_data
  62. residuals_matrix <- matrix(NA, nrow = nrow(data_matrix), ncol = ncol(data_matrix))
  63. residuals_matrix_test <- matrix(NA, nrow = nrow(data_matrix_test), ncol = ncol(data_matrix_test))
  64. colnames(residuals_matrix) <- colnames(data_matrix)
  65. colnames(residuals_matrix_test) <- colnames(data_matrix_test)
  66. covModels <- list()
  67. for (cc in 1:ncol(data_matrix)) {
  68. temp_data <- cbind(dependent_variable = data_matrix[, cc], x_train_data[,c('eTIV',SiteCols)])
  69. testing_data <- cbind(dependent_variable = data_matrix_test[, cc], x_test_data[,c('eTIV',SiteCols)])
  70. model <- lm(as.formula(paste0('dependent_variable ~ eTIV +',paste(SiteCols,collapse ='+'))), data = temp_data)
  71. residuals_matrix[, cc] <- residuals(model)
  72. # Predict the effect of covariates on the testing data using the training model
  73. predicted_values_test <- predict(model, newdata = testing_data)
  74. # Calculate residuals for the testing data
  75. residuals_matrix_test[,cc] <- testing_data$dependent_variable - predicted_values_test
  76. covModels[[cc]] <- model
  77. }
  78. list_covModles[[k]] <- covModels
  79. X_train_fold <- residuals_matrix
  80. y_train_fold <- alldata[train_indices, 'Age']
  81. X_test_fold <- residuals_matrix_test
  82. y_test_fold <- alldata[test_indices, 'Age']
  83. # normalizaion and standardziation
  84. library(caret)
  85. normParam <- preProcess(X_train_fold)
  86. X_train_fold <- predict(normParam, X_train_fold)
  87. X_test_fold <- predict(normParam, X_test_fold)
  88. list_scaler[[k]] <- normParam
  89. set.seed(1010)
  90. lasso_reg = glmnet(as.matrix(X_train_fold), y_train_fold, alpha = 1)
  91. cv_lasso <- cv.glmnet(as.matrix(X_train_fold), y_train_fold, lambda = 10^seq(5, -8, by = -.1), alpha = 1, type.measure = 'mae',nfolds = 10,parallel = T)
  92. plot(cv_lasso)
  93. list_plots[[k]] <- recordPlot()
  94. optimal_lambda <- cv_lasso$lambda.min
  95. lasso_model = predict(lasso_reg, type = "coefficients", s = optimal_lambda)
  96. lasso_model_nonzero <- lasso_model[(lasso_model[,1]!= 0),]
  97. list_lambda[[k]] <- optimal_lambda
  98. lasso_predict <- predict(lasso_reg, newx = as.matrix(X_test_fold), s = optimal_lambda)
  99. df[test_indices, 'pre_age'] <- as.numeric(lasso_predict)
  100. # Age bias correction
  101. train_predicted_y <- predict(lasso_reg, newx = as.matrix(X_train_fold), s = optimal_lambda)
  102. model <- lm(train_predicted_y ~ y_train_fold)
  103. test <- data.frame(TrueAge = as.numeric(y_test_fold), age_LASSO = as.numeric(lasso_predict))
  104. test$age_correct_LASSO <- (test$age_LASSO - coef(model)[1]) / coef(model)[2]
  105. df[test_indices, 'delta_corrected'] <- unlist(test$age_correct_LASSO - test$TrueAge)
  106. df[test_indices, 'pre_age_corrected'] <- test$age_correct_LASSO
  107. list_mae[[k]] <- mae(test$TrueAge, test$age_LASSO)
  108. list_r[[k]] <- cor(test$TrueAge, test$age_LASSO)
  109. }
  110. best_model_index <- which.min(list_mae)
  111. ##################### Model evaluation
  112. r <- cor(df$Age, df$pre_age)
  113. r_corrected <- cor(df$Age, df$pre_age_corrected)
  114. mae <- mae(df$Age, df$pre_age)
  115. mae_corrected <- mae(df$Age, df$pre_age_corrected)
  116. corrdata <- data.frame(df$Age, df$pre_age)
  117. write.table(corrdata, 'brain_age_prediction_evaluation.csv', sep=',', row.names=F)
  118. # Get weights of the predictors
  119. brain_traits <- data.frame(rownames(best_coef),as.matrix(best_coef))
  120. colnames(brain_traits) <- c('field','coef')
  121. write_csv(brain_traits, 'Age_LASSO_weights.csv')
  122. ##################### Apply the trained model to other subjects (excluding normal controls)
  123. df <- merge(df_GM, df_WM, by=c('eid'))
  124. # exclude only normal controls
  125. eid <- read.csv(eid_data_path)
  126. df <- df[!(df$eid %in% eid$eid),]
  127. cnt <- rowSums(!is.na(df))
  128. df <- df[cnt == ncol(df), ]
  129. # apply the covariate regression model to other subjs
  130. x_test_data <- df
  131. data_matrix_test <- x_test_data[,unlist(sapply(colnames(x_test_data),function(x) grepl('^X',x)), use.names = F)]
  132. # Initialize a matrix to store residuals
  133. residuals_matrix_test <- matrix(NA, nrow = nrow(data_matrix_test), ncol = ncol(data_matrix_test))
  134. colnames(residuals_matrix_test) <- colnames(data_matrix_test)
  135. for (cc in 1:ncol(data_matrix_test)) {
  136. testing_data <- cbind(dependent_variable = data_matrix_test[, cc], x_test_data[,c('eTIV',SiteCols)])
  137. # Predict the effect of covariates on the testing data using the training model
  138. predicted_values_test <- predict(best_covModel[[cc]], newdata = testing_data)
  139. # Calculate residuals for the testing data
  140. residuals_matrix_test[,cc] <- testing_data$dependent_variable - predicted_values_test
  141. }
  142. df[,unlist(sapply(colnames(df),function(x) grepl('^X',x)), use.names = F)] <- residuals_matrix_test
  143. df <- df[, !(names(df) %in% c(unlist(sapply(colnames(df),function(x) {if(grepl('Site',x)) x}), use.names = F),'eTIV','Height','Sex'))]
  144. # normalization and standardization
  145. df[,2:ncol(df)-1] <- predict(best_scaler, df[,2:ncol(df)-1])
  146. X_all <- df[, -c(1, ncol(df))]
  147. y_all_pred <- as.numeric(predict(best_model, newx = as.matrix(X_all), s = best_lambda))
  148. y_all_pred_corrected <- (y_all_pred - coef(best_correction_model)[1]) / coef(best_correction_model)[2]
  149. all_delta_corrected <- y_all_pred_corrected - df$Age
  150. df$pre_age <- y_all_pred
  151. df$pre_age_corrected <- y_all_pred_corrected
  152. df$delta_corrected <- all_delta_corrected
  153. df_all <- rbind(df_HC, df)
  154. write_csv(data.frame(df_all), 'brain_age_prediction_all.csv')
  155. }
  156. selected_df_agegap <- df_all[, c("eid", "Age", "pre_age", "pre_age_corrected", "delta_corrected")]
  157. write_csv(data.frame(selected_df_agegap), 'agegap.csv')

s1_predict_BA.R at commit a31a811, no license · at the source

Overview

Authors: Zairen Zhou1, Wenjing Su1, Yuna Li1,2, Bei Zhang3, Fang Lan1, Dawei Lin4, Jin‐Tai Yu1, Jianfeng Feng1,5,6,7, Yifei Jin1, Peng Ren1,5, Wei Cheng1,5,8
ORCID iDs: Peng Ren, Wei Cheng
  1. Institute of Science and Technology for Brain‐Inspired Intelligence, Department of Neurology, Huashan Hospital, State Key Laboratory of Brain Function and Disorders and MOE Frontiers Center for Brain Science, Fudan University, Shanghai, China
  2. Department of Radiology, Beijing Tiantan Hospital, Capital Medical University, Beijing, China
  3. Brain Health Institute, National Center for Mental Disorders, Shanghai Mental Health Center, Shanghai Jiao Tong University School of Medicine and School of Psychology, Shanghai, China
  4. Department of Cardiology, Zhongshan Hospital, Fudan University, Shanghai, China
  5. Key Laboratory of Computational Neuroscience and Brain Inspired Intelligence (Fudan University), Ministry of Education, Shanghai, China
  6. School of Data Science, Fudan University, Shanghai, China
  7. Department of Computer Science, University of Warwick, Coventry, UK
  8. Fudan ISTBI—ZJNU Algorithm Centre for Brain‐Inspired Intelligence, Zhejiang Normal University, Jinhua, China
Journal: Aging cell, volume 25, issue 5, article e70499
Dates: received 19 August 2025; accepted 10 April 2026; published online 23 April 2026; in print May 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1111/acel.70499 · PMID 42021636 · PMCID PMC13103654 · OpenAlex W7155399711
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: structural MRI / diffusion (modality), human (organism)
Methods: Statistics, Machine learning, fMRI & imaging, Preprocessing
Keywords: brain age, brain disorder, heart, MRI
MeSH: Aging*, Brain*, Heart*, Mental Disorders*, Nervous System Diseases*, Aged, Female, Humans, Male, Middle Aged, Phenotype, UK Biobank (* major topic)
Topic: Functional Brain Connectivity Studies (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: Higher Education Discipline Innovation Project (B18015); National Key Research and Development Program of China (2023YFC3605400); Noncommunicable Chronic Diseases-National Science and Technology Major Project (2025ZD0546300); Shanghai Science and Technology Commission Program (23JS1410100); Shanghai Pilot Program for Basic Research-Fudan University (25TQ010, 21TQ1400100); National Natural Science Foundation of China (82530047, 82271471, 82588301, 62433008, 82472055); Brain Science and Brain-like Intelligence Technology - National Science and Technology Major Project (2022ZD0211600); Shanghai Academy of Natural Sciences, New Cornerstone Science Foundation; Zhangjiang Lab; the State Key Laboratory of Brain Function and Disorders of Ministry of Education, Fudan University; Changping Laboratory (2025B-07-35, 2025B‐07‐35); China Postdoctoral Science Foundation (2025M772197); the Shanghai Center for Brain Science and Brain-Inspired Technology; National Key R&amp;D Program of China (2023YFC3605400); Leading Project of the Discipline Breakthrough Plan of the Ministry of Education (JYB2025XDXM604); Lin Gang Laboratory (LGL-3241-PDA030200); Program of Shanghai Academic Research Leader (23XD1420400); the 111 Project (B18015); Tianqiao and Chrissy Chen Institute
Citations: not cited yet (Europe PMC); 84 references in the paper

Abstract

Mental and nervous system disorders often co‐occur with cardiovascular diseases in aging populations, yet the biological relationships underlying these associations remain incompletely understood. Using heart and brain imaging data from 33,573 UK Biobank (UKB) participants, we developed a brain age prediction model to estimate the brain age gap (BAG), an imaging‐based marker of brain aging. We then examined BAG as a mediator between 82 cardiac imaging‐derived phenotypes (IDPs) and 11 disorders. Sixty‐one cardiac IDPs, particularly those related to the atria and left ventricle, were significantly associated with BAG, with several also related to mental and nervous system disorders. Mediation analyses revealed that BAG significantly mediated 18 associations between heart and substance abuse, mood, and neurotic disorders. Furthermore, we observed a total of 49 significant associations, where lifestyle factors, including smoking and physical activity, were related to heart‐brain aging‐disorder relationships. These findings highlight brain aging as a potential pathway linking cardiovascular health to diverse brain disorders in aging populations.

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 2 matches between paragraphs and lines of code.

WenJSu/Heart-brain-aging-disorders-pathways

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: a31a811414b5f9ed7f39c7a2ff03e9c89f293a19, 21 July 2025
Languages: R (6)
Size: 7 files, 6 scripts
Software Heritage: not archived
Found in: “Data Availability Statement”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: lavaan (2 files), caret (1 file), data.table (1 file), glmnet (1 file), survival (1 file), tidyverse (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
7 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;
  • 2 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 Statement

The individual level data analyzed in this study are available from the UK Biobank (https://biobank.ctsu.ox.ac.uk) upon application and approval. The code for the main analysis of this study is publicly available at https://github.com/WenJSu/Heart‐brain‐aging‐disorders‐pathways (https://github.com/WenJSu/Heart-brain-aging-disorders-pathways).

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, 11 authors, 4 keywords, 12 MeSH terms, 19 funders, 84 references.

Cite

This paper

Zhou, Z., Su, W., Li, Y., Zhang, B., Lan, F., Lin, D., Yu, J., Feng, J., Jin, Y., Ren, P., & Cheng, W. (2026). Brain Aging Mediating Heart Imaging-Derived Phenotypes and Mental and Nervous System Disorders. Aging cell, 25(5), e70499. https://doi.org/10.1111/acel.70499

BibTeX

@article{zhou2026brain,
author = {Zhou, Zairen and Su, Wenjing and Li, Yuna and Zhang, Bei and Lan, Fang and Lin, Dawei and Yu, Jin‐Tai and Feng, Jianfeng and Jin, Yifei and Ren, Peng and Cheng, Wei},
title = {{Brain Aging Mediating Heart Imaging-Derived Phenotypes and Mental and Nervous System Disorders}},
journal = {Aging cell},
year = {2026},
month = may,
volume = {25},
number = {5},
pages = {e70499},
publisher = {Wiley},
issn = {1474-9718},
doi = {10.1111/acel.70499},
url = {https://doi.org/10.1111/acel.70499},
pmid = {42021636},
pmcid = {PMC13103654}
}

RIS

TY - JOUR
AU - Zhou, Zairen
AU - Su, Wenjing
AU - Li, Yuna
AU - Zhang, Bei
AU - Lan, Fang
AU - Lin, Dawei
AU - Yu, Jin‐Tai
AU - Feng, Jianfeng
AU - Jin, Yifei
AU - Ren, Peng
AU - Cheng, Wei
TI - Brain Aging Mediating Heart Imaging-Derived Phenotypes and Mental and Nervous System Disorders
T2 - Aging cell
J2 - Aging Cell
PY - 2026
DA - 2026/05/01
VL - 25
IS - 5
SP - e70499
SN - 1474-9718
PB - Wiley
DO - 10.1111/acel.70499
UR - https://doi.org/10.1111/acel.70499
LA - en
ER -

CSL-JSON

{
"id": "10.1111/acel.70499",
"type": "article-journal",
"title": "Brain Aging Mediating Heart Imaging-Derived Phenotypes and Mental and Nervous System Disorders",
"container-title": "Aging cell",
"author": [
{
"family": "Zhou",
"given": "Zairen"
},
{
"family": "Su",
"given": "Wenjing"
},
{
"family": "Li",
"given": "Yuna"
},
{
"family": "Zhang",
"given": "Bei"
},
{
"family": "Lan",
"given": "Fang"
},
{
"family": "Lin",
"given": "Dawei"
},
{
"family": "Yu",
"given": "Jin‐Tai"
},
{
"family": "Feng",
"given": "Jianfeng"
},
{
"family": "Jin",
"given": "Yifei"
},
{
"family": "Ren",
"given": "Peng"
},
{
"family": "Cheng",
"given": "Wei"
}
],
"container-title-short": "Aging Cell",
"volume": "25",
"issue": "5",
"page": "e70499",
"DOI": "10.1111/acel.70499",
"PMID": "42021636",
"PMCID": "PMC13103654",
"ISSN": "1474-9718",
"publisher": "Wiley",
"URL": "https://doi.org/10.1111/acel.70499",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
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.1073/pnas.2516601123 [code]
Unveiling the glymphatic system's role in brain aging: A comprehensive biomarker and modifiable intervention target.
Journal: Proceedings of the National Academy of Sciences of the United States of America
In common: survival, data.table, tidyverse, structural MRI / diffusion, 6 references
[2] doi:10.3390/ijms27156925 [code]
XGBoost-SHAP Interpretable Modeling Identifies and Validates an Eight-Gene Biomarker for Hepatic Encephalopathy Risk Prediction in Cirrhosis.
Journal: International journal of molecular sciences
In common: lavaan, glmnet, survival, 3 other tools
[3] doi:10.1038/s42003-026-10957-8 [code]
Brain defence by the extracellular matrix protein Cochlin.
Journal: Communications biology
In common: glmnet, survival, caret, 2 other tools
[4] 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-oncology
In common: glmnet, survival, caret, 2 other tools
[5] doi:10.1080/20002297.2026.2705667 [code]
Oral microbiota dysbiosis related to the cortical thinning and cognitive impairment in cerebral small vessel disease.
Journal: Journal of oral microbiology
In common: glmnet, survival, caret, 1 other tool, structural MRI / diffusion
[6] doi:10.1016/j.isci.2026.117031 [code]
Plasma metabolomic signatures of migraine in 479,760 adults.
Journal: iScience
In common: lavaan, survival, data.table, 1 other tool, 1 reference
[7] doi:10.7717/peerj.21426 [code]
Integrated transcriptomic identification and validation reveal key autophagy-associated biomarkers in sleep deprivation.
Journal: PeerJ
In common: glmnet, caret, data.table, 1 other tool, 1 reference
[8] doi:10.1038/s43856-026-01510-z [code]
Mapping genetic convergence across brain structure, mental health, and cardiometabolic disease.
Journal: Communications medicine
In common: lavaan, data.table, tidyverse, 2 references
[9] doi:10.1093/braincomms/fcag146 [code]
Convergent structural brain alterations in chronic pain: a multi-metric individual participant data meta-analysis.
Journal: Brain communications
In common: glmnet, caret, data.table, 1 other tool, structural MRI / diffusion
[10] doi:10.34133/research.1298 [code]
Multisite Chronic Pain Reveals Neuro-Immune-Metabolic Dysregulation across Rheumatoid Arthritis and Depression.
Journal: Research (Washington, D.C.)
In common: survival, data.table, tidyverse, 2 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.

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.