OSCR

The role of network connectivity and transcriptomic vulnerability in shaping gray matter atrophy in multiple sclerosis.

Code ↔ Paper

11 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.

10 blocks of code here have 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 11 matches · 1 of them tie a paragraph to a whole file without given lines: a weak match, whose lines are not tinted
  1. [1] § MATERIALS AND METHODS › Network-based atrophy modeling ↔ scripts/01.group/AtrophyModelling_cross.py, lines 501 to 534 · score 0.71 · transcriptomic neighborhood atrophy, transcriptomic vulnerability, subcortico cortical, spatial correlation, CGE, distance · block oscr:b:N6BVCFJ0PZ0E1-S · Report a mismatch
  2. [2] § RESULTS › Network mechanisms shape GM atrophy ↔ scripts/06.stats/R_NAM_stats.qmd, lines 515 to 572 · score 0.68 · structural cortico cortical, functional cortico cortical, functional subcortico cortical, structural subcortico cortical, strength centrality, nodal stress · block oscr:b:GMZNPPP3NW8X5-U · Report a mismatch
  3. [3] § MATERIALS AND METHODS › Network-based atrophy modeling ↔ scripts/06.stats/R_NAM_stats.qmd, lines 273 to 308 · score 0.65 · strength centrality, Gene expression, subcortico cortical, transcriptomic, atrophy · block oscr:b:Q4TSA5H5N2RBP-N · Report a mismatch
  4. [4] § MATERIALS AND METHODS › Network-based atrophy modeling ↔ scripts/R_NAM_stats.qmd, lines 223 to 258 · score 0.65 · strength centrality, Gene expression, subcortico cortical, transcriptomic, atrophy · block oscr:b:5Z09CYAYCZ84R-Z · Report a mismatch
  5. [5] § RESULTS › Patient- and subgroup-tailored atrophy modeling ↔ scripts/06.stats/OrganizeData.Rmd, lines 941 to 1008 · score 0.64 · disease duration, clinical phenotype, PP, SP, ER, LR · block oscr:b:AKP1SB1PJT9MT-O · Report a mismatch
  6. [6] § MATERIALS AND METHODS › Patient- and subgroup-tailored atrophy modeling ↔ scripts/06.stats/OrganizeData.Rmd, lines 1010 to 1139 · score 0.63 · adjusted Rand, ARI, atrophy patterns, clusters, subtype, HYDRA · block oscr:b:YGDK8ER7ZYJED-3 · Report a mismatch
  7. [7] § RESULTS › Study population ↔ scripts/01.group/AtrophyModelling_cross.py, lines 129 to 215 · score 0.58 · NeuroImage, human brain, spin permutation, Network, maps, Atrophy · block oscr:b:5ED63YBJFHBYD-L · Report a mismatch
  8. [8] § RESULTS › Network mechanisms shape GM atrophy ↔ scripts/R1/probability_maps.sh, the whole file · a weak match · score 0.56 · lesion probability, disconnection probability, overlapped, space · block oscr:b:9R37TYDHWSDM6-2 · Report a mismatch
  9. [9] § MATERIALS AND METHODS › Spatial permutation tests ↔ scripts/01.group/AtrophyModelling_cross.py, lines 129 to 215 · score 0.55 · spin permutation, rotations, spheres, permuted, surface, brain · block oscr:b:5ED63YBJFHBYD-L · Report a mismatch
  10. [10] § RESULTS › Patient- and subgroup-tailored atrophy modeling ↔ scripts/06.stats/R_NAM_stats.qmd, lines 171 to 219 · score 0.55 · disease duration, clinical phenotype, S3, DD, sex, HYDRA · block oscr:b:C00DS3W1JMDC2-5 · Report a mismatch
  11. [11] § MATERIALS AND METHODS › Network-based explanation of atrophy progression ↔ scripts/04.GAM/GAM_modelling.Rmd, lines 171 to 191 · score 0.52 · REML, bam, GAMs, AIC, fit, neighborhood atrophy · block oscr:b:DMAA2H62RZHET-M · 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

Python · 911 lines · 47 KB · MIT · 3 matches

  1. #!/data/anw/knw-work/g.pontillo/predictive_modelling/python-env/atrophymodelling/bin/python
  2. #authors: [email hidden]
  3. #updates: 22 Jan 2024
  4. #%%
  5. import os
  6. import numpy as np
  7. import pandas as pd
  8. import pingouin as pg
  9. import matplotlib.pyplot as plt
  10. from enigmatoolbox.datasets import load_sc, load_fc
  11. from enigmatoolbox.utils.parcellation import parcel_to_surface
  12. from enigmatoolbox.plotting import plot_cortical
  13. from enigmatoolbox.plotting import plot_subcortical
  14. from enigmatoolbox.permutation_testing import spin_test#, shuf_test
  15. from enigmatoolbox.permutation_testing import centroid_extraction_sphere, rotate_parcellation
  16. from enigmatoolbox.datasets import load_fsa5
  17. root_pth = "/data/anw/knw-work/g.pontillo/predictive_modelling/code/stats/AtrophyModelling/repos/ENIGMA/enigmatoolbox/permutation_testing"
  18. #%%
  19. #==============================================================================
  20. # FUNCTIONS
  21. #==============================================================================
  22. def partial_perm_sphere_p(x, y, z, perm_id, corr_type='pearson', null_dist=False):
  23. """
  24. Generate a p-value for the partial spatial correlation between two cortical maps (x, y),
  25. controlling for a third covariate map (z), using spherical spin permutations.
  26. Parameters
  27. ----------
  28. x : ndarray
  29. Map 1 (e.g., connectivity-weighted neighbourhood atrophy map)
  30. y : ndarray
  31. Map 2 (e.g., atrophy map)
  32. z : ndarray
  33. Map 3 (Covariate map to be controlled for, e.g., proximity​-weighted neighbourhood atrophy map)
  34. perm_id : ndarray
  35. Array of permutations from rotate_parcellation, shape = (n_regions, n_rot)
  36. corr_type : string, optional
  37. Correlation type {'pearson', 'spearman'}. Default is 'pearson'.
  38. null_dist : bool, optional
  39. Output null correlations. Default is False.
  40. """
  41. #nroi = perm_id[0] # number of regions
  42. #nperm = perm_id[1] # number of permutations
  43. nroi, nperm= perm_id.shape
  44. print(nroi, nperm)
  45. print("x shape:", np.shape(x))
  46. print("y shape:", np.shape(y))
  47. print("z shape:", np.shape(z))
  48. # 1. Empirical partial correlation (The real world baseline)
  49. df_emp = pd.DataFrame({'X': x, 'Y': y, 'Z': z})
  50. rho_emp = pg.partial_corr(data=df_emp, x='X', y='Y', covar='Z', method=corr_type).at[corr_type, 'r']
  51. # 2. Pre-generate all spun permutations for the maps
  52. x_perm = np.empty((0, nroi))
  53. y_perm = np.empty((0, nroi))
  54. z_perm = np.empty((0, nroi))
  55. for rr in range(nperm):
  56. x_perm2 = []
  57. y_perm2 = []
  58. z_perm2 = []
  59. #print(rr)
  60. for ii in range(nroi):
  61. idx = int(perm_id[ii, rr])
  62. #idx = int(ii)
  63. #print(idx)
  64. x_perm2 = np.append(x_perm2, x[idx])
  65. y_perm2 = np.append(y_perm2, y[idx])
  66. z_perm2 = np.append(z_perm2, z[idx])
  67. x_perm = np.vstack((x_perm, x_perm2))
  68. y_perm = np.vstack((y_perm, y_perm2))
  69. z_perm = np.vstack((z_perm, z_perm2))
  70. x_perm = np.transpose(x_perm)
  71. y_perm = np.transpose(y_perm)
  72. z_perm = np.transpose(z_perm)
  73. # 3. Dual-null framework loops
  74. rho_null_xy = [] # Version A: Rotate only Y
  75. rho_null_yx = [] # Version B: Rotate X and Z together
  76. for rr in range(nperm):
  77. # ------------------------------------------------------------------
  78. # Version A: Map 1 (X) and Covariate (Z) are FIXED. Only Map 2 (Y) is SPUN.
  79. # ------------------------------------------------------------------
  80. df_null_A = pd.DataFrame({
  81. 'X_static': x,
  82. 'Y_rot': y_perm[:, rr],
  83. 'Z_static': z
  84. })
  85. r_A = pg.partial_corr(data=df_null_A, x='X_static', y='Y_rot', covar='Z_static', method=corr_type).at[corr_type, 'r']
  86. rho_null_xy = np.append(rho_null_xy, r_A)
  87. # ------------------------------------------------------------------
  88. # Version B: Map 2 (Y) is FIXED. Map 1 (X) and Covariate (Z) are SPUN together.
  89. # ------------------------------------------------------------------
  90. df_null_B = pd.DataFrame({
  91. 'X_rot': x_perm[:, rr],
  92. 'Y_static': y,
  93. 'Z_rot': z_perm[:, rr]
  94. })
  95. r_B = pg.partial_corr(data=df_null_B, x='X_rot', y='Y_static', covar='Z_rot', method=corr_type).at[corr_type, 'r']
  96. rho_null_yx = np.append(rho_null_yx, r_B)
  97. # 4. Calculate directional two-tailed p-values
  98. if rho_emp >= 0:
  99. p_perm_xy = np.sum((rho_null_xy > rho_emp).astype(int)) / nperm
  100. p_perm_yx = np.sum((rho_null_yx > rho_emp).astype(int)) / nperm
  101. elif rho_emp < 0:
  102. p_perm_xy = np.sum((rho_null_xy < rho_emp).astype(int)) / nperm
  103. p_perm_yx = np.sum((rho_null_yx < rho_emp).astype(int)) / nperm
  104. # Combine the dual-null tracks into an averaged, robust p-value
  105. p_perm = (p_perm_xy + p_perm_yx) / 2
  106. if null_dist:
  107. return p_perm, rho_emp, np.append(rho_null_xy, rho_null_yx)
  108. return p_perm, rho_emp
  109. def spin_test_partial(map1, map2, map3, surface_name='fsa5', parcellation_name='aparc', n_rot=1000,
  110. type='pearson', null_dist=False, ventricles=False):
  111. """Spin permutation (author: @saratheriver)
  112. Parameters
  113. ----------
  114. map1 : narray, ndarray, or pandas.Series
  115. One of two map to be correlated
  116. map2 : narray, ndarray, or pandas.Series
  117. The other map to be correlated
  118. surface_name : string, optional
  119. Surface name {'fsa5', 'fsa5_with_sctx'}. Use 'fsa5' for Conte69. Default is 'fsa5'.
  120. parcellation_name : string, optional
  121. Parcellation name {'aparc', 'aparc_aseg'}. Default is 'aparc'.
  122. n_rot : int, optional
  123. Number of spin rotations. Default is 1000.
  124. type : string, optional
  125. Correlation type {'pearson', 'spearman'}. Default is 'pearson'.
  126. null_dist : bool, optional
  127. Output null correlations. Default is False.
  128. ventricles : bool, optional
  129. Whether ventricles are present in map1, map2. Only used when ``parcellation_name is 'aparc_aseg'``.
  130. Default is False.
  131. Returns
  132. -------
  133. p_spin : float
  134. Permutation p-value
  135. r_dist : 1D ndarray
  136. Null correlations, shape = (n_rot*2,). Only if ``null_dist is True``.
  137. See Also
  138. --------
  139. :func:`centroid_extraction_sphere`
  140. :func:`rotate_parcellation`
  141. :func:`perm_sphere_p`
  142. References
  143. ----------
  144. * Alexander-Bloch A, Shou H, Liu S, Satterthwaite TD, Glahn DC,
  145. Shinohara RT, Vandekar SN and Raznahan A (2018). On testing for spatial
  146. correspondence between maps of human brain structure and function.
  147. NeuroImage, 178:540-51.
  148. * Váša F, Seidlitz J, Romero-Garcia R, Whitaker KJ, Rosenthal G, Vértes PE,
  149. Shinn M, Alexander-Bloch A, Fonagy P, Dolan RJ, Goodyer IM, the NSPN consortium,
  150. Sporns O, Bullmore ET (2017). Adolescent tuning of association cortex in human
  151. structural brain networks. Cerebral Cortex, 28(1):281–294.
  152. """
  153. if surface_name == "fsa5":
  154. sphere_lh, sphere_rh = load_fsa5(as_sphere=True)
  155. elif surface_name == "fsa5_with_sctx":
  156. sphere_lh, sphere_rh = load_fsa5(as_sphere=True, with_sctx=True)
  157. #root_pth = os.path.dirname(__file__)
  158. # get sphere coordinates of parcels
  159. if surface_name == "fsa5_with_sctx" and parcellation_name =="aparc_aseg":
  160. annotfile_lh = os.path.join(root_pth, 'annot', surface_name + '_lh_' + parcellation_name + '.csv')
  161. annotfile_rh = os.path.join(root_pth, 'annot', surface_name + '_rh_' + parcellation_name + '.csv')
  162. lh_centroid = centroid_extraction_sphere(sphere_lh.Points, annotfile_lh, ventricles=ventricles)
  163. rh_centroid = centroid_extraction_sphere(sphere_rh.Points, annotfile_rh, ventricles=ventricles)
  164. else:
  165. annotfile_lh = os.path.join(root_pth, 'annot', surface_name + '_lh_' + parcellation_name + '.annot')
  166. annotfile_rh = os.path.join(root_pth, 'annot', surface_name + '_rh_' + parcellation_name + '.annot')
  167. lh_centroid = centroid_extraction_sphere(sphere_lh.Points, annotfile_lh)
  168. rh_centroid = centroid_extraction_sphere(sphere_rh.Points, annotfile_rh)
  169. # generate permutation maps
  170. perm_id = rotate_parcellation(lh_centroid, rh_centroid, n_rot)
  171. # generate spin permuted p-value
  172. if isinstance(map1, pd.DataFrame) or isinstance(map1, pd.Series):
  173. map1 = map1.to_numpy()
  174. if isinstance(map2, pd.DataFrame) or isinstance(map2, pd.Series):
  175. map2 = map2.to_numpy()
  176. if isinstance(map3, pd.DataFrame) or isinstance(map3, pd.Series):
  177. map3 = map3.to_numpy()
  178. p_spin, r_emp, r_dist = partial_perm_sphere_p(map1, map2, map3, perm_id, type, null_dist=True)
  179. if null_dist is True:
  180. return p_spin, r_emp, r_dist
  181. elif null_dist is not True:
  182. return p_spin, r_emp
  183. #%%
  184. def shuf_test_1(map1, map2, n_rot=10000, type='pearson', null_dist=False):
  185. """Shuf permuation (author: @saratheriver)
  186. Parameters
  187. ----------
  188. map1 : narray, ndarray, or pandas.Series
  189. One of two map to be correlated
  190. map2 : narray, ndarray, or pandas.Series
  191. The other map to be correlated
  192. n_rot : int, optional
  193. Number of shuffles. Default is 1000.
  194. type : string, optional
  195. Correlation type {'pearson', 'spearman'}. Default is 'pearson'.
  196. null_dist : bool, optional
  197. Output null correlations. Default is False.
  198. Returns
  199. -------
  200. p_shuf : float
  201. Permutation p-value
  202. r_dist : 1D ndarray
  203. Null correlations, shape = (n_rot*2,). Only if ``null_dist is True``.
  204. """
  205. r = 0 # count successful (r) iterations unsuccessful (c) iterations
  206. c = 0 # count unsuccessful (c) iterations
  207. nroi = map1.shape[0] # number of regions
  208. # generate random permutations
  209. perm_id = np.zeros((nroi, n_rot))
  210. while (r < n_rot):
  211. rot_lr_sort = np.random.permutation(nroi)
  212. # verify that permutation does not map to itself
  213. if np.all(rot_lr_sort == range(nroi)) is not True:
  214. perm_id[:, r] = rot_lr_sort
  215. r = r + 1
  216. elif np.all(rot_lr_sort == range(nroi)) is True:
  217. c = c + 1
  218. print('map to itself n.' + str(c))
  219. # track progress
  220. if np.mod(r, 100) == 0:
  221. print('permutation ' + str(r) + ' of ' + str(n_rot))
  222. # empirical correlation
  223. #rho_emp = pd.Series(map1).corr(pd.Series(map2), method=type)
  224. rho_emp = np.corrcoef(map1, map2)[0,1]
  225. # permutation of measures
  226. x_perm = np.empty((0, nroi))
  227. y_perm = np.empty((0, nroi))
  228. for rr in range(n_rot):
  229. x_perm2 = []
  230. y_perm2 = []
  231. for ii in range(nroi):
  232. x_perm2 = np.append(x_perm2, map1[int(perm_id[ii, rr])])
  233. y_perm2 = np.append(y_perm2, map2[int(perm_id[ii, rr])])
  234. x_perm = np.vstack((x_perm, x_perm2))
  235. y_perm = np.vstack((y_perm, y_perm2))
  236. x_perm = np.transpose(x_perm)
  237. y_perm = np.transpose(y_perm)
  238. # correlation to unpermuted measures
  239. rho_null_xy = []
  240. rho_null_yx = []
  241. for rr in range(n_rot):
  242. #rho_null_xy = np.append(rho_null_xy, pd.Series(x_perm[:, rr]).corr(map2, method=type))
  243. #rho_null_yx = np.append(rho_null_yx, pd.Series(map1).corr(pd.Series(y_perm[:, rr]), method=type))
  244. rho_null_xy = np.append(rho_null_xy, np.corrcoef(x_perm[:, rr], map2)[0,1])
  245. rho_null_yx = np.append(rho_null_yx, np.corrcoef(map1, y_perm[:, rr])[0,1])
  246. # p-value definition depends on the sign of the empirical correlation
  247. if rho_emp >= 0:
  248. p_perm_xy = np.sum((rho_null_xy > rho_emp).astype(int)) / n_rot
  249. p_perm_yx = np.sum((rho_null_yx > rho_emp).astype(int)) / n_rot
  250. else:
  251. p_perm_xy = np.sum((rho_null_xy < rho_emp).astype(int)) / n_rot
  252. p_perm_yx = np.sum((rho_null_yx < rho_emp).astype(int)) / n_rot
  253. # average p-values
  254. p_shuf = (p_perm_xy + p_perm_yx) / 2
  255. # null distribution
  256. r_dist = np.append(rho_null_xy, rho_null_yx)
  257. if null_dist is True:
  258. return p_shuf, r_dist
  259. elif null_dist is not True:
  260. return p_shuf
  261. def load_csv_to_numpy(file_mapping, base_path):
  262. "reads multiple csv files into numpy arrays"
  263. arrays = {}
  264. for key, filename in file_mapping.items():
  265. arrays[key] = pd.read_csv(f"{base_path}/{filename}", header=None).to_numpy()
  266. return arrays
  267. def compute_dc(fc_ctx, sc_ctx, fc_sctx, sc_sctx):
  268. "computes degree centrality for fmri & dmri"
  269. fc_ctx_dc = np.sum(fc_ctx, axis = 0)
  270. sc_ctx_dc = np.sum(sc_ctx, axis = 0)
  271. fc_sctx_dc = np.sum(fc_sctx, axis =1)
  272. sc_sctx_dc = np.sum(sc_sctx, axis =1)
  273. return fc_ctx_dc, sc_ctx_dc, fc_sctx_dc, sc_sctx_dc
  274. def plot_cortical_atrophy(atrophy, atlas, output_folder, filename, color_range=(0,20), cmap="RdBu_r"):
  275. #atrophy_ctx = atrophy.iloc[:,:-14] #remove subcortical
  276. #atrophy_ctx.to_numpy()
  277. atrophy_surf = parcel_to_surface(atrophy, atlas)
  278. plot_cortical(array_name=atrophy_surf, surface_name="fsa5", size=(2000,1500),
  279. cmap=cmap, color_bar=True, color_range=color_range,
  280. #label_text={'left': ['left']},
  281. screenshot=True, transparent_bg=False,
  282. filename=f"{output_folder}/{filename}.png")
  283. def plot_subcortical_atrophy(atrophy, output_folder, filename, color_range=(0,10), cmap="RdBu_r"):
  284. #atrophy_sctx = atrophy.iloc[:,-14:] #remove cortical
  285. #atrophy_sctx = atrophy_sctx.to_numpy().T.squeeze()
  286. plot_subcortical(array_name=atrophy, ventricles=False,
  287. size=(2000,1500), cmap=cmap, color_bar=True, color_range=color_range,
  288. screenshot=True, transparent_bg=False,
  289. filename=f"{output_folder}/{filename}.png")
  290. def nodal_stress(fc_ctx_dc, fc_sctx_dc, sc_ctx_dc, sc_sctx_dc, atrophy, parcellation):
  291. " performs spatial correlation between funtional/structural hubs and atrophy z-scores "
  292. ################# spatial correlation #################
  293. atrophy_ctx = atrophy.iloc[:,:-14].reset_index(drop=True).squeeze()
  294. atrophy_sctx = atrophy.iloc[:,-14:].reset_index(drop=True).squeeze()
  295. fc_ctx_r = np.corrcoef(fc_ctx_dc, atrophy_ctx)[0,1]
  296. fc_sctx_r = np.corrcoef(fc_sctx_dc, atrophy_sctx)[0,1]
  297. sc_ctx_r = np.corrcoef(sc_ctx_dc, atrophy_ctx)[0,1]
  298. sc_sctx_r = np.corrcoef(sc_sctx_dc, atrophy_sctx)[0,1]
  299. #store correlation coefficients
  300. rvals = {'functional cortico-cortical degree centrality': fc_ctx_r,
  301. 'functional subcortico-cortical degree centrality': fc_sctx_r,
  302. 'structural cortico-cortical degree centrality': sc_ctx_r,
  303. 'structural subcortico-cortical degree centrality': sc_sctx_r}
  304. ################# premutation testing #################
  305. fc_ctx_p, fc_ctx_d = spin_test(fc_ctx_dc, atrophy_ctx,
  306. surface_name='fsa5', parcellation_name=parcellation,
  307. type='pearson', n_rot=10000, null_dist=True)
  308. sc_ctx_p, sc_ctx_d = spin_test(sc_ctx_dc, atrophy_ctx,
  309. surface_name='fsa5', parcellation_name=parcellation,
  310. type='pearson', n_rot=10000, null_dist=True)
  311. # Shuf permutation testing for two subcortical maps
  312. fc_sctx_p, fc_sctx_d = shuf_test_1(fc_sctx_dc, atrophy_sctx, n_rot=10000,
  313. type='pearson', null_dist=True)
  314. sc_sctx_p, sc_sctx_d = shuf_test_1(sc_sctx_dc, atrophy_sctx, n_rot=10000,
  315. type='pearson', null_dist=True)
  316. # Store p-values and null distributions
  317. p_and_d = {'functional cortico-cortical degree centrality': [fc_ctx_p, fc_ctx_d],
  318. 'functional subcortico-cortical degree centrality': [fc_sctx_p, fc_sctx_d],
  319. 'structural cortico-cortical degree centrality': [sc_ctx_p, sc_ctx_d],
  320. 'structural subcortico-cortical degree centrality': [sc_sctx_p, sc_sctx_d]}
  321. # Store meas
  322. meas = {('functional cortico-cortical degree centrality', "cortical atrophy (cohen's d)"): [fc_ctx_dc, atrophy_ctx],
  323. ('functional subcortico-cortical degree centrality', "subcortical atrophy (cohen's d)"): [fc_sctx_dc, atrophy_sctx],
  324. ('structural cortico-cortical degree centrality', "cortical atrophy (cohen's d)"): [sc_ctx_dc, atrophy_ctx],
  325. ('structural subcortico-cortical degree centrality', "subcortical atrophy (cohen's d)"): [sc_sctx_dc, atrophy_sctx]}
  326. return rvals, p_and_d, meas
  327. def neighbour_atrophy(fc_ctx_ngh, fc_sctx_ngh, sc_ctx_ngh, sc_sctx_ngh, atrophy, parcellation):
  328. """
  329. performs spatial correlation between atrophy z-scores and neighbour atrophy
  330. weighted by funtional/structural connection strenght
  331. """
  332. ################# spatial correlation #################
  333. atrophy_ctx = atrophy.iloc[:,:-14].reset_index(drop=True).squeeze()
  334. atrophy_sctx = atrophy.iloc[:,-14:].reset_index(drop=True).squeeze()
  335. fc_ctx_r = np.corrcoef(fc_ctx_ngh, atrophy_ctx)[0,1]
  336. fc_sctx_r = np.corrcoef(fc_sctx_ngh, atrophy_sctx)[0,1]
  337. sc_ctx_r = np.corrcoef(sc_ctx_ngh, atrophy_ctx)[0,1]
  338. sc_sctx_r = np.corrcoef(sc_sctx_ngh, atrophy_sctx)[0,1]
  339. #store correlation coefficients
  340. rvals = {'functional cortico-cortical neighbour atrophy': fc_ctx_r,
  341. 'functional subcortico-cortical neighbour atrophy': fc_sctx_r,
  342. 'structural cortico-cortical neighbour atrophy': sc_ctx_r,
  343. 'structural subcortico-cortical neighbour atrophy': sc_sctx_r}
  344. ################# premutation testing #################
  345. fc_ctx_p, fc_ctx_d = spin_test(fc_ctx_ngh, atrophy_ctx,
  346. surface_name='fsa5', parcellation_name=parcellation,
  347. type='pearson', n_rot=10000, null_dist=True)
  348. sc_ctx_p, sc_ctx_d = spin_test(sc_ctx_ngh, atrophy_ctx,
  349. surface_name='fsa5', parcellation_name=parcellation,
  350. type='pearson', n_rot=10000, null_dist=True)
  351. # Shuf permutation testing for two subcortical maps
  352. fc_sctx_p, fc_sctx_d = shuf_test_1(fc_sctx_ngh, atrophy_sctx, n_rot=10000,
  353. type='pearson', null_dist=True)
  354. sc_sctx_p, sc_sctx_d = shuf_test_1(sc_sctx_ngh, atrophy_sctx, n_rot=10000,
  355. type='pearson', null_dist=True)
  356. # Store p-values and null distributions
  357. p_and_d = {'functional cortico-cortical neighbour atrophy': [fc_ctx_p, fc_ctx_d],
  358. 'functional subcortico-cortical neighbour atrophy': [fc_sctx_p, fc_sctx_d],
  359. 'structural cortico-cortical neighbour atrophy': [sc_ctx_p, sc_ctx_d],
  360. 'structural subcortico-cortical neighbour atrophy': [sc_sctx_p, sc_sctx_d]}
  361. meas = {('functional cortico-cortical neighbour atrophy', "cortical atrophy (cohen's d)"): [fc_ctx_ngh, atrophy_ctx],
  362. ('functional subcortico-cortical neighbour atrophy', "subcortical atrophy (cohen's d)"): [fc_sctx_ngh, atrophy_sctx],
  363. ('structural cortico-cortical neighbour atrophy', "cortical atrophy (cohen's d)"): [sc_ctx_ngh, atrophy_ctx],
  364. ('structural subcortico-cortical neighbour atrophy', "subcortical atrophy (cohen's d)"): [sc_sctx_ngh, atrophy_sctx]}
  365. return rvals, p_and_d, meas
  366. def neighbour_atrophy_partial(fc_ctx_ngh, sc_ctx_ngh, ecd_ctx_ngh, atrophy, parcellation):
  367. """
  368. performs spatial correlation between atrophy z-scores and neighbour atrophy
  369. weighted by funtional/structural connection strenght
  370. """
  371. ################# spatial correlation #################
  372. atrophy_ctx = atrophy.iloc[:,:-14].reset_index(drop=True).squeeze()
  373. ################# premutation testing #################
  374. fc_ctx_p, fc_ctx_r, fc_ctx_d = spin_test_partial(fc_ctx_ngh, atrophy_ctx, ecd_ctx_ngh,
  375. surface_name='fsa5', parcellation_name=parcellation,
  376. type='pearson', n_rot=10000, null_dist=True)
  377. sc_ctx_p, sc_ctx_r, sc_ctx_d = spin_test_partial(sc_ctx_ngh, atrophy_ctx, ecd_ctx_ngh,
  378. surface_name='fsa5', parcellation_name=parcellation,
  379. type='pearson', n_rot=10000, null_dist=True)
  380. #store correlation coefficients
  381. rvals = {'functional cortico-cortical neighbour atrophy': fc_ctx_r,
  382. 'structural cortico-cortical neighbour atrophy': sc_ctx_r}
  383. # Store p-values and null distributions
  384. p_and_d = {'functional cortico-cortical neighbour atrophy': [fc_ctx_p, fc_ctx_d],
  385. 'structural cortico-cortical neighbour atrophy': [sc_ctx_p, sc_ctx_d]}
  386. meas = {('functional cortico-cortical neighbour atrophy', "cortical atrophy (cohen's d)"): [fc_ctx_ngh, atrophy_ctx],
  387. ('structural cortico-cortical neighbour atrophy', "cortical atrophy (cohen's d)"): [sc_ctx_ngh, atrophy_ctx]}
  388. return rvals, p_and_d, meas
  389. def axonal_disc(sc_ctx_dc, sc_sctx_dc, atrophy, parcellation):
  390. " performs spatial correlation between funtional/structural hubs and atrophy z-scores "
  391. ################# spatial correlation #################
  392. atrophy_ctx = atrophy.iloc[:,:-14].reset_index(drop=True).squeeze()
  393. atrophy_sctx = atrophy.iloc[:,-14:].reset_index(drop=True).squeeze()
  394. sc_ctx_r = np.corrcoef(sc_ctx_dc, atrophy_ctx)[0,1]
  395. sc_sctx_r = np.corrcoef(sc_sctx_dc, atrophy_sctx)[0,1]
  396. #store correlation coefficients
  397. rvals = {'structural cortico-cortical disconnection': sc_ctx_r,
  398. 'structural subcortico-cortical disconnection': sc_sctx_r}
  399. ################# premutation testing #################
  400. sc_ctx_p, sc_ctx_d = spin_test(sc_ctx_dc, atrophy_ctx,
  401. surface_name='fsa5', parcellation_name=parcellation,
  402. type='pearson', n_rot=10000, null_dist=True)
  403. # Shuf permutation testing for two subcortical maps
  404. sc_sctx_p, sc_sctx_d = shuf_test_1(sc_sctx_dc, atrophy_sctx, n_rot=10000,
  405. type='pearson', null_dist=True)
  406. # Store p-values and null distributions
  407. p_and_d = {'structural cortico-cortical disconnection': [sc_ctx_p, sc_ctx_d],
  408. 'structural subcortico-cortical disconnection': [sc_sctx_p, sc_sctx_d]}
  409. meas = {('structural cortico-cortical disconnection', "cortical atrophy (cohen's d)"): [sc_ctx_dc, atrophy_ctx],
  410. ('structural subcortico-cortical disconnection', "subcortical atrophy (cohen's d)"): [sc_sctx_dc, atrophy_sctx]}
  411. return rvals, p_and_d, meas
  412. def transcriptomic_vulnerablity(cge_ctx, cge_sctx, atrophy, parcellation):
  413. """
  414. performs spatial correlation between atrophy z-scores and neighbour atrophy
  415. weighted by funtional/structural connection strenght
  416. """
  417. ################# spatial correlation #################
  418. atrophy_ctx = atrophy.iloc[:,:-14].reset_index(drop=True).squeeze()
  419. atrophy_sctx = atrophy.iloc[:,-14:].reset_index(drop=True).squeeze()
  420. cge_ctx_r = np.corrcoef(cge_ctx, atrophy_ctx)[0,1]
  421. cge_sctx_r = np.corrcoef(cge_sctx, atrophy_sctx)[0,1]
  422. #store correlation coefficients
  423. rvals = {'cortico-cortical transcriptomic neighbour atrophy': cge_ctx_r,
  424. 'subcortico-cortical transcriptomic neighbour atrophy': cge_sctx_r}
  425. ################# premutation testing #################
  426. fc_ctx_p, fc_ctx_d = spin_test(cge_ctx, atrophy_ctx,
  427. surface_name='fsa5', parcellation_name=parcellation,
  428. type='pearson', n_rot=10000, null_dist=True)
  429. # Shuf permutation testing for two subcortical maps
  430. fc_sctx_p, fc_sctx_d = shuf_test_1(cge_sctx, atrophy_sctx, n_rot=10000,
  431. type='pearson', null_dist=True)
  432. # Store p-values and null distributions
  433. p_and_d = {'cortico-cortical transcriptomic neighbour atrophy': [fc_ctx_p, fc_ctx_d],
  434. 'subcortico-cortical transcriptomic neighbour atrophy': [fc_sctx_p, fc_sctx_d]}
  435. meas = {('cortico-cortical transcriptomic neighbour atrophy', "cortical atrophy (cohen's d)"): [cge_ctx, atrophy_ctx],
  436. ('subcortico-cortical transcriptomic neighbour atrophy', "subcortical atrophy (cohen's d)"): [cge_sctx, atrophy_sctx]}
  437. return rvals, p_and_d, meas
  438. def plot_null_distributions(p_and_d, rvals, filename):
  439. fig, axs = plt.subplots(1, 4, figsize=(15, 3))
  440. for k, (fn, dd) in enumerate(p_and_d.items()):
  441. # Define plot colors
  442. if k <= 1:
  443. col = '#A8221C' # red for functional hubs
  444. else:
  445. col = '#324F7D' # blue for structural hubs
  446. # Plot null distributions
  447. axs[k].hist(dd[1], bins=50, density=True, color=col, edgecolor='white', lw=0.5)
  448. axs[k].axvline(rvals[fn], lw=1.5, ls='--', color='k', dashes=(2, 3),
  449. label='$r$={:.2f}'.format(rvals[fn]) + '\n$p$={:.3f}'.format(dd[0]))
  450. axs[k].set_xlabel('Null correlations \n ({})'.format(fn))
  451. axs[k].set_ylabel('Density')
  452. axs[k].spines['top'].set_visible(False)
  453. axs[k].spines['right'].set_visible(False)
  454. axs[k].legend(loc=1, frameon=False)
  455. fig.tight_layout()
  456. fig.savefig(f"{output_folder}/{filename}.png", dpi=300, bbox_inches='tight')
  457. plt.show()
  458. def plot_hubs_vs_atrophy(p_and_d, rvals, meas, filename):
  459. fig, axs = plt.subplots(1, 4, figsize=(17, 4))
  460. for k, (fn, dd) in enumerate(meas.items()):
  461. # Define scatter colors
  462. if k <= 1:
  463. col = '#A8221C'
  464. else:
  465. col = '#324F7D'
  466. # Plot relationships between hubs and atrophy
  467. axs[k].scatter(meas[fn][0], meas[fn][1], color=col,
  468. label='$r$={:.2f}'.format(rvals[fn[0]]) + '\n$p$={:.3f}'.format(p_and_d[fn[0]][0]))
  469. m, b = np.polyfit(meas[fn][0], meas[fn][1], 1)
  470. axs[k].plot(meas[fn][0], m * meas[fn][0] + b, color=col)
  471. axs[k].set_ylim((-1, 1))
  472. axs[k].set_xlabel('{}'.format(fn[0].capitalize()))
  473. axs[k].set_ylabel('{}'.format(fn[1].capitalize()))
  474. axs[k].spines['top'].set_visible(False)
  475. axs[k].spines['right'].set_visible(False)
  476. axs[k].legend(loc=1, frameon=False, markerscale=0)
  477. fig.tight_layout()
  478. fig.savefig(f"{output_folder}/{filename}.png", dpi=300, bbox_inches='tight')
  479. plt.show()
  480. #%%
  481. #==============================================================================
  482. # IMPORT DATA
  483. #==============================================================================
  484. # ################# NORMATIVE DATA HUMAN CONNECTOME PROJECT #################
  485. sc_ctx_100, sc_ctx_labels_100, sc_sctx_100, sc_sctx_labels_100 = load_sc(parcellation="schaefer_100")
  486. fc_ctx_100, fc_ctx_labels_100, fc_sctx_100, fc_sctx_labels_100 = load_fc(parcellation="schaefer_100")
  487. sc_ctx_400, sc_ctx_labels_400, sc_sctx_400, sc_sctx_labels_400 = load_sc(parcellation="schaefer_400")
  488. fc_ctx_400, fc_ctx_labels_400, fc_sctx_400, fc_sctx_labels_400 = load_fc(parcellation="schaefer_400")
  489. # structural subcortical are [14,X14], remove 14 subcortical regions
  490. sc_sctx_100 = sc_sctx_100[:,:-14]
  491. sc_sctx_400 = sc_sctx_400[:,:-14]
  492. #normative enigma data
  493. fc_ctx_dc_100, sc_ctx_dc_100, fc_sctx_dc_100, sc_sctx_dc_100 = compute_dc(fc_ctx_100, sc_ctx_100, fc_sctx_100, sc_sctx_100)
  494. fc_ctx_dc_400, sc_ctx_dc_400, fc_sctx_dc_400, sc_sctx_dc_400 = compute_dc(fc_ctx_400, sc_ctx_400, fc_sctx_400, sc_sctx_400)
  495. #%%
  496. # ################# ATROPHY CROSS DATA FROM AMSTERDAM #################
  497. dir = "/data/anw/knw-work/g.pontillo/predictive_modelling/code/stats/AtrophyModelling"
  498. atrophycross_dir = f'{dir}/data/atrophy_cross'
  499. atrophy_cross_group_100_fdr = pd.read_csv(f"{atrophycross_dir}/atrophy_baseline_SchaeferSubcortex114Parcels_group_pfdr.csv")
  500. atrophy_cross_group_400_fdr = pd.read_csv(f"{atrophycross_dir}/atrophy_baseline_SchaeferSubcortex414Parcels_group_pfdr.csv")
  501. atrophy_cross_group_100 = pd.read_csv(f"{atrophycross_dir}/atrophy_baseline_SchaeferSubcortex114Parcels_group_cohend.csv")
  502. atrophy_cross_group_400 = pd.read_csv(f"{atrophycross_dir}/atrophy_baseline_SchaeferSubcortex414Parcels_group_cohend.csv")
  503. #%%
  504. mean_val = atrophy_cross_group_100.mean(axis=1).iloc[0]
  505. std_val = atrophy_cross_group_100.std(axis=1, ddof=1).iloc[0]
  506. #%%
  507. # ################# NEIGHBOUR DATA FROM AMSTERDAM #################
  508. neighdir = f'{dir}/data/neighbourhood_atrophy'
  509. neighcross_group_100_fc_ctx = pd.read_csv(f"{neighdir}/neighbourhood_atrophy_cross_SchaeferSubcortex114Parcels_group_fc_ctx.csv")
  510. neighcross_group_100_fc_sctx = pd.read_csv(f"{neighdir}/neighbourhood_atrophy_cross_SchaeferSubcortex114Parcels_group_fc_sctx.csv")
  511. neighcross_group_100_sc_ctx = pd.read_csv(f"{neighdir}/neighbourhood_atrophy_cross_SchaeferSubcortex114Parcels_group_sc_ctx.csv")
  512. neighcross_group_100_sc_sctx = pd.read_csv(f"{neighdir}/neighbourhood_atrophy_cross_SchaeferSubcortex114Parcels_group_sc_sctx.csv")
  513. neighcross_group_400_fc_ctx = pd.read_csv(f"{neighdir}/neighbourhood_atrophy_cross_SchaeferSubcortex414Parcels_group_fc_ctx.csv")
  514. neighcross_group_400_fc_sctx = pd.read_csv(f"{neighdir}/neighbourhood_atrophy_cross_SchaeferSubcortex414Parcels_group_fc_sctx.csv")
  515. neighcross_group_400_sc_ctx = pd.read_csv(f"{neighdir}/neighbourhood_atrophy_cross_SchaeferSubcortex414Parcels_group_sc_ctx.csv")
  516. neighcross_group_400_sc_sctx = pd.read_csv(f"{neighdir}/neighbourhood_atrophy_cross_SchaeferSubcortex414Parcels_group_sc_sctx.csv")
  517. #%%
  518. # ################# DISCONNECTOME DATA FROM AMSTERDAM #################
  519. discdir = f'{dir}/data/disc'
  520. disc_group_100_ctx = pd.read_csv(f"{discdir}/disc_SchaeferSubcortex114Parcels_group_ctx.csv", header=None)
  521. disc_group_100_sctx = pd.read_csv(f"{discdir}/disc_SchaeferSubcortex114Parcels_group_sctx.csv", header=None)
  522. disc_group_400_ctx = pd.read_csv(f"{discdir}/disc_SchaeferSubcortex414Parcels_group_ctx.csv", header=None)
  523. disc_group_400_sctx = pd.read_csv(f"{discdir}/disc_SchaeferSubcortex414Parcels_group_sctx.csv", header=None)
  524. #%%
  525. # ################# NEIGHBOUR DATA WEIGHTED BY GENE #################
  526. cge_group_100_ctx = pd.read_csv(f"{neighdir}/neighbourhood_atrophy_cross_SchaeferSubcortex114Parcels_group_cge_ctx.csv")
  527. cge_group_100_sctx = pd.read_csv(f"{neighdir}/neighbourhood_atrophy_cross_SchaeferSubcortex114Parcels_group_cge_sctx.csv")
  528. cge_group_400_ctx = pd.read_csv(f"{neighdir}/neighbourhood_atrophy_cross_SchaeferSubcortex414Parcels_group_cge_ctx.csv")
  529. cge_group_400_sctx = pd.read_csv(f"{neighdir}/neighbourhood_atrophy_cross_SchaeferSubcortex414Parcels_group_cge_sctx.csv")
  530. #%%
  531. # ################# NEIGHBOUR DATA WEIGHTED BY EUCLIDEAN DISTANCE #################
  532. ecd_group_ctx = pd.read_csv(f"{neighdir}/neighbourhood_atrophy_cross_SchaeferSubcortex114Parcels_group_ecd_ctx.csv")
  533. ecd_group_sctx = pd.read_csv(f"{neighdir}/neighbourhood_atrophy_cross_SchaeferSubcortex114Parcels_group_ecd_sctx.csv")
  534. #%%
  535. # =============================================================================
  536. # #Load functional data from programs
  537. # dir = "/data/anw/knw-work/g.pontillo/predictive_modelling/code/stats/AtrophyModelling"
  538. # fc = f'{dir}/data/fc'
  539. #
  540. # connectivities = ["fc"]
  541. # regions = ["ctx", "sctx"]
  542. # atlas = ["114", "414"]
  543. # groups = ["HC", "MS"]
  544. #
  545. # file_mapping = {
  546. # f"{conn}_{region}_{res}_{group}": f"PrograMS_{conn}_SchaeferSubcortex{res}Parcels_{group}_{region}.csv"
  547. # for conn in connectivities
  548. # for region in regions
  549. # for res in atlas
  550. # for group in groups
  551. # }
  552. #
  553. # fcp = load_csv_to_numpy(file_mapping, fc)
  554. #
  555. # #programs data
  556. # fc_ctx_dc_MS100, sc_ctx_dc_100, fc_sctx_dc_MS100, sc_sctx_dc_100 = compute_dc(fcp["fc_ctx_114_MS"], sc_ctx_100, fcp["fc_sctx_114_MS"], sc_sctx_100)
  557. # fc_ctx_dc_MS400, sc_ctx_dc_400, fc_sctx_dc_MS400, sc_sctx_dc_400 = compute_dc(fcp["fc_ctx_414_MS"], sc_ctx_400, fcp["fc_sctx_414_MS"], sc_sctx_400)
  558. #
  559. # fc_ctx_dc_HC100, sc_ctx_dc_100, fc_sctx_dc_HC100, sc_sctx_dc_100 = compute_dc(fcp["fc_ctx_114_HC"], sc_ctx_100, fcp["fc_sctx_114_HC"], sc_sctx_100)
  560. # fc_ctx_dc_HC400, sc_ctx_dc_400, fc_sctx_dc_HC400, sc_sctx_dc_400 = compute_dc(fcp["fc_ctx_414_HC"], sc_ctx_400, fcp["fc_sctx_414_HC"], sc_sctx_400)
  561. #
  562. # =============================================================================
  563. #%%
  564. #==============================================================================
  565. # PLOT DATA
  566. #==============================================================================
  567. output_folder = f"{dir}/output/may/cross_group_results_ecd"
  568. os.makedirs(output_folder, exist_ok=True)
  569. # ################# ATROPHY CROSS DATA FROM AMSTERDAM #################
  570. atrophy_d100_ctx = atrophy_cross_group_100.iloc[:,:-14].to_numpy() #remove sctx
  571. atrophy_d400_ctx = atrophy_cross_group_400.iloc[:,:-14].to_numpy() #remove sctx
  572. atrophy_d100_sctx = atrophy_cross_group_100.iloc[:,-14:].to_numpy().T.squeeze() #remove cortical
  573. atrophy_d400_sctx = atrophy_cross_group_100.iloc[:,-14:].to_numpy().T.squeeze() #remove cortical
  574. #%%
  575. plot_cortical_atrophy(atrophy_d100_ctx, "schaefer_100_fsa5", output_folder, "atrophy_cross_group_100_ctx_map", color_range=(-0.8,0.8), cmap="RdBu_r")
  576. plot_cortical_atrophy(atrophy_d400_ctx, "schaefer_400_fsa5", output_folder, "atrophy_cross_group_400_ctx_map", color_range=(-0.8,0.8), cmap="RdBu_r")
  577. plot_subcortical_atrophy(atrophy_d100_sctx, output_folder, "atrophy_cross_group_100_sctx_map", color_range=(-0.8, 0.8), cmap="RdBu_r")
  578. plot_subcortical_atrophy(atrophy_d400_sctx, output_folder, "atrophy_cross_group_400_sctx_map", color_range=(-0.8, 0.8), cmap="RdBu_r")
  579. #%%
  580. # ################# ATROPHY CROSS DATA FROM AMSTERDAM #################
  581. atrophy_pfdr100_ctx = atrophy_cross_group_100_fdr.iloc[:,:-14].to_numpy() #remove sctx
  582. atrophy_pfdr400_ctx = atrophy_cross_group_400_fdr.iloc[:,:-14].to_numpy() #remove sctx
  583. atrophy_pfdr100_sctx = atrophy_cross_group_100_fdr.iloc[:,-14:].to_numpy().T.squeeze() #remove cortical
  584. atrophy_pfdr400_sctx = atrophy_cross_group_400_fdr.iloc[:,-14:].to_numpy().T.squeeze() #remove cortical
  585. log_atrophy_pfdr100_ctx = -np.log(atrophy_pfdr100_ctx)
  586. log_atrophy_pfdr400_ctx = -np.log(atrophy_pfdr400_ctx)
  587. log_atrophy_pfdr100_sctx = -np.log(atrophy_pfdr100_sctx)
  588. log_atrophy_pfdr400_sctx = -np.log(atrophy_pfdr400_sctx)
  589. plot_cortical_atrophy(log_atrophy_pfdr100_ctx, "schaefer_100_fsa5", output_folder, "atrophy_cross_group_100_ctx_pfdr_map", color_range=(1.3,20), cmap="Reds")
  590. plot_cortical_atrophy(log_atrophy_pfdr400_ctx, "schaefer_400_fsa5", output_folder, "atrophy_cross_group_400_ctx_pfdr_map", color_range=(1.3,20), cmap="Reds")
  591. plot_subcortical_atrophy(log_atrophy_pfdr100_sctx, output_folder, "atrophy_cross_group_100_sctx_pfdr_map", color_range=(1.3,20), cmap="Reds")
  592. plot_subcortical_atrophy(log_atrophy_pfdr400_sctx, output_folder, "atrophy_cross_group_400_sctx_pfdr_map", color_range=(1.3,20), cmap="Reds")
  593. #%%
  594. # ################# NORMATIVE DATA HUMAN CONNECTOME PROJECT #################
  595. plot_cortical_atrophy(fc_ctx_dc_100, "schaefer_100_fsa5", output_folder, "fc_ctx_dc_100_cortical_map", color_range=(-40,40), cmap="RdBu_r")
  596. plot_cortical_atrophy(sc_ctx_dc_100, "schaefer_100_fsa5", output_folder, "sc_ctx_dc_100_cortical_map", color_range=(-340,340), cmap="RdBu")
  597. plot_subcortical_atrophy(fc_sctx_dc_100, output_folder, "fc_sctx_dc_100_subcortical_map", color_range=(-20,20), cmap="RdBu_r")
  598. plot_subcortical_atrophy(sc_sctx_dc_100, output_folder, "sc_sctx_dc_100_subcortical_map", color_range=(-410,410), cmap="RdBu")
  599. plot_cortical_atrophy(fc_ctx_dc_400, "schaefer_400_fsa5", output_folder, "fc_ctx_dc_400_cortical_map", color_range=(-40,40), cmap="RdBu_r")
  600. plot_cortical_atrophy(sc_ctx_dc_400, "schaefer_400_fsa5", output_folder, "sc_ctx_dc_400_cortical_map", color_range=(-340,340), cmap="RdBu")
  601. plot_subcortical_atrophy(fc_sctx_dc_400, output_folder, "fc_sctx_dc_400_subcortical_map", color_range=(-20,20), cmap="RdBu_r")
  602. plot_subcortical_atrophy(sc_sctx_dc_400, output_folder, "sc_sctx_dc_400_subcortical_map", color_range=(-410,410), cmap="RdBu")
  603. #%%
  604. # ################# NEIGHBOURHOOD DATA #################
  605. neighcross_group_100_fc_ctx=neighcross_group_100_fc_ctx.T.squeeze().astype(np.float64)
  606. neighcross_group_100_sc_ctx=neighcross_group_100_sc_ctx.T.squeeze().astype(np.float64)
  607. neighcross_group_100_fc_sctx=neighcross_group_100_fc_sctx.T.squeeze().astype(np.float64)
  608. neighcross_group_100_sc_sctx=neighcross_group_100_sc_sctx.T.squeeze().astype(np.float64)
  609. neighcross_group_400_fc_ctx=neighcross_group_400_fc_ctx.T.squeeze().astype(np.float64)
  610. neighcross_group_400_sc_ctx=neighcross_group_400_sc_ctx.T.squeeze().astype(np.float64)
  611. neighcross_group_400_fc_sctx=neighcross_group_400_fc_sctx.T.squeeze().astype(np.float64)
  612. neighcross_group_400_sc_sctx=neighcross_group_400_sc_sctx.T.squeeze().astype(np.float64)
  613. #%%
  614. plot_cortical_atrophy(neighcross_group_100_fc_ctx, "schaefer_100_fsa5", output_folder, "neighcross_group_100_fc_ctx_map", color_range=(-0.2,0.2), cmap="RdBu_r")
  615. plot_cortical_atrophy(neighcross_group_100_sc_ctx, "schaefer_100_fsa5", output_folder, "neighcross_group_100_sc_ctx_map", color_range=(-4,4), cmap="RdBu")
  616. plot_cortical_atrophy(neighcross_group_400_fc_ctx, "schaefer_400_fsa5", output_folder, "neighcross_group_400_fc_ctx_map", color_range=(-0.2,0.2), cmap="RdBu_r")
  617. plot_cortical_atrophy(neighcross_group_400_sc_ctx, "schaefer_400_fsa5", output_folder, "neighcross_group_400_sc_ctx_map", color_range=(-4,4), cmap="RdBu")
  618. plot_subcortical_atrophy(neighcross_group_100_fc_sctx, output_folder, "neighcross_group_100_fc_sctx_map", color_range=(-0.1,0.1), cmap="RdBu_r")
  619. plot_subcortical_atrophy(neighcross_group_100_sc_sctx, output_folder, "neighcross_group_100_sc_sctx_map", color_range=(-3,3), cmap="RdBu")
  620. plot_subcortical_atrophy(neighcross_group_400_fc_sctx, output_folder, "neighcross_group_400_fc_sctx_map", color_range=(-0.1,0.1), cmap="RdBu_r")
  621. plot_subcortical_atrophy(neighcross_group_400_sc_sctx, output_folder, "neighcross_group_400_sc_sctx_map", color_range=(-3,3), cmap="RdBu")
  622. #%%
  623. # ################# DISCONNECTOME DATA #################
  624. disc_ctx_dc_100, disc_ctx_dc_400, disc_sctx_dc_100, disc_sctx_dc_400 = compute_dc(disc_group_100_ctx, disc_group_400_ctx, disc_group_100_sctx, disc_group_400_sctx)
  625. plot_cortical_atrophy(disc_ctx_dc_100, "schaefer_100_fsa5", output_folder, "disc_group_100_ctx_map", color_range=(0,1600), cmap="Reds")
  626. plot_cortical_atrophy(disc_ctx_dc_400, "schaefer_400_fsa5", output_folder, "disc_group_400_ctx_map", color_range=(0,1600), cmap="Reds")
  627. plot_subcortical_atrophy(disc_sctx_dc_100, output_folder, "disc_group_100_sctx_map", color_range=(0,1200), cmap="Reds")
  628. plot_subcortical_atrophy(disc_sctx_dc_400, output_folder, "disc_group_400_sctx_map", color_range=(0,1200), cmap="Reds")
  629. #%%
  630. # ################# ALTERNATIVE DISCONNECTOME DATA #################
  631. parcel_group_100_ctx = pd.read_csv(f"{discdir}/parcel_disc_SchaeferSubcortex114Parcels_group_ctx.csv", header=None)
  632. parcel_group_100_sctx = pd.read_csv(f"{discdir}/parcel_disc_SchaeferSubcortex114Parcels_group_sctx.csv", header=None)
  633. parcel_group_400_ctx = pd.read_csv(f"{discdir}/parcel_disc_SchaeferSubcortex414Parcels_group_ctx.csv", header=None)
  634. parcel_group_400_sctx = pd.read_csv(f"{discdir}/parcel_disc_SchaeferSubcortex414Parcels_group_sctx.csv", header=None)
  635. plot_cortical_atrophy(parcel_group_100_ctx.squeeze(), "schaefer_100_fsa5", output_folder, "parcel_group_100_ctx_map", color_range=(0,0.3), cmap="Reds")
  636. plot_cortical_atrophy(parcel_group_400_ctx.squeeze(), "schaefer_400_fsa5", output_folder, "parcel_group_400_ctx_map", color_range=(0,0.3), cmap="Reds")
  637. plot_subcortical_atrophy(parcel_group_100_sctx.squeeze(), output_folder, "parcel_group_100_sctx_map", color_range=(0,0.3), cmap="Reds")
  638. plot_subcortical_atrophy(parcel_group_400_sctx.squeeze(), output_folder, "parcel_group_400_sctx_map", color_range=(0,0.3), cmap="Reds")
  639. #%%
  640. # ################# TRANSCRIPTOMIC DATA #################
  641. cge_group_100_ctx.fillna(0, inplace=True)
  642. cge_group_100_sctx.fillna(0, inplace=True)
  643. cge_group_400_ctx.fillna(0, inplace=True)
  644. cge_group_400_sctx.fillna(0, inplace=True)
  645. cge_group_100_ctx=cge_group_100_ctx.T.squeeze().astype(np.float64)
  646. cge_group_400_ctx=cge_group_400_ctx.T.squeeze().astype(np.float64)
  647. cge_group_100_sctx=cge_group_100_sctx.T.squeeze().astype(np.float64)
  648. cge_group_400_sctx=cge_group_400_sctx.T.squeeze().astype(np.float64)
  649. plot_cortical_atrophy(cge_group_100_ctx, "schaefer_100_fsa5", output_folder, "cge_group_100_ctx_map", color_range=(0,0.2), cmap="Reds")
  650. plot_cortical_atrophy(cge_group_400_ctx, "schaefer_400_fsa5", output_folder, "cge_group_400_ctx_map", color_range=(0,0.2), cmap="Reds")
  651. plot_subcortical_atrophy(cge_group_100_sctx, output_folder, "cge_group_100_sctx_map", color_range=(-0.2,0), cmap="Reds_r")
  652. plot_subcortical_atrophy(cge_group_400_sctx, output_folder, "cge_group_400_sctx_map", color_range=(-0.2,0), cmap="Reds_r")
  653. #%%
  654. # ################# NEIGHBOUR DATA WEIGHTED BY EUCLIDEAN DISTANCE #################
  655. ecd_group_ctx=ecd_group_ctx.T.squeeze().astype(np.float64)
  656. ecd_group_sctx=ecd_group_sctx.T.squeeze().astype(np.float64)
  657. plot_cortical_atrophy(ecd_group_ctx, "schaefer_100_fsa5", output_folder, "neighcross_group_100_ecd_ctx_map", color_range=(-0.005,0.005), cmap="RdBu_r")
  658. plot_subcortical_atrophy(ecd_group_sctx, output_folder, "neighcross_group_100_ecd_sctx_map", color_range=(-0.005,0.005), cmap="RdBu_r")
  659. #%%
  660. #==============================================================================
  661. # NODAL STRESS
  662. #==============================================================================
  663. rvals_crossgroup_100, p_and_d_crossgroup_100, meas_crossgroup_100 = nodal_stress(fc_ctx_dc_100, fc_sctx_dc_100, sc_ctx_dc_100, sc_sctx_dc_100, atrophy_cross_group_100, "schaefer_100")
  664. rvals_crossgroup_400, p_and_d_crossgroup_400, meas_crossgroup_400 = nodal_stress(fc_ctx_dc_400, fc_sctx_dc_400, sc_ctx_dc_400, sc_sctx_dc_400, atrophy_cross_group_400, "schaefer_400")
  665. plot_null_distributions(p_and_d_crossgroup_100, rvals_crossgroup_100, "plot_nodalstress_group_cross_100_null" )
  666. plot_null_distributions(p_and_d_crossgroup_400, rvals_crossgroup_400, "plot_nodalstress_group_cross_400_null")
  667. plot_hubs_vs_atrophy(p_and_d_crossgroup_100, rvals_crossgroup_100, meas_crossgroup_100, "plot_nodalstress_group_cross_100")
  668. plot_hubs_vs_atrophy(p_and_d_crossgroup_400, rvals_crossgroup_400, meas_crossgroup_400, "plot_nodalstress_group_cross_400")
  669. #%%
  670. #==============================================================================
  671. # TRANSNEURONAL DEGENERATION (neighbour atrophy)
  672. #==============================================================================
  673. #neighcross_group_100_fc_ctx_dc, neighcross_group_100_sc_ctx_dc, neighcross_group_100_fc_sctx_dc, neighcross_group_100_sc_sctx_dc = compute_dc(neighcross_group_100_fc_ctx, neighcross_group_100_sc_ctx, neighcross_group_100_fc_sctx, neighcross_group_100_sc_sctx)
  674. rvals_neighcross_100, p_and_d_neighcross_100, meas_neighcross_100 = neighbour_atrophy(neighcross_group_100_fc_ctx, neighcross_group_100_fc_sctx, neighcross_group_100_sc_ctx, neighcross_group_100_sc_sctx, atrophy_cross_group_100, "schaefer_100")
  675. rvals_neighcross_400, p_and_d_neighcross_400, meas_neighcross_400 = neighbour_atrophy(neighcross_group_400_fc_ctx, neighcross_group_400_fc_sctx, neighcross_group_400_sc_ctx, neighcross_group_400_sc_sctx, atrophy_cross_group_400, "schaefer_400")
  676. plot_null_distributions(p_and_d_neighcross_100, rvals_neighcross_100, "plot_neigh_group_cross_100_null")
  677. plot_null_distributions(p_and_d_neighcross_400, rvals_neighcross_400, "plot_neigh_group_cross_400_null")
  678. plot_hubs_vs_atrophy(p_and_d_neighcross_100, rvals_neighcross_100, meas_neighcross_100, "plot_neigh_group_cross_100")
  679. plot_hubs_vs_atrophy(p_and_d_neighcross_400, rvals_neighcross_400, meas_neighcross_400, "plot_neigh_group_cross_400")
  680. #%%
  681. #==============================================================================
  682. # TRANSNEURONAL DEGENERATION (euclidean distance)
  683. #==============================================================================
  684. #neighcross_group_100_fc_ctx_dc, neighcross_group_100_sc_ctx_dc, neighcross_group_100_fc_sctx_dc, neighcross_group_100_sc_sctx_dc = compute_dc(neighcross_group_100_fc_ctx, neighcross_group_100_sc_ctx, neighcross_group_100_fc_sctx, neighcross_group_100_sc_sctx)
  685. rvals_ecd_100, p_and_d_ecd_100, meas_ecd_100 = neighbour_atrophy(ecd_group_ctx, ecd_group_sctx, ecd_group_ctx, ecd_group_sctx, atrophy_cross_group_100, "schaefer_100")
  686. #rvals_neighcross_400, p_and_d_neighcross_400, meas_neighcross_400 = neighbour_atrophy(neighcross_group_400_fc_ctx, neighcross_group_400_fc_sctx, neighcross_group_400_sc_ctx, neighcross_group_400_sc_sctx, atrophy_cross_group_400, "schaefer_400")
  687. plot_null_distributions(p_and_d_ecd_100, rvals_ecd_100, "plot_ecd_group_cross_100_null")
  688. #plot_null_distributions(p_and_d_ecd_400, rvals_ecd_400, "plot_neigh_group_cross_400_null")
  689. plot_hubs_vs_atrophy(p_and_d_ecd_100, rvals_ecd_100, meas_ecd_100, "plot_ecd_group_cross_100")
  690. #plot_hubs_vs_atrophy(p_and_d_neighcross_400, rvals_neighcross_400, meas_neighcross_400, "plot_neigh_group_cross_400")
  691. #%%
  692. #==============================================================================
  693. # TRANSNEURONAL DEGENERATION (neighbourhood atrophy controling for distance)
  694. #==============================================================================
  695. ## test with spatial
  696. rvals_ecd_100, p_and_d_ecd_100, meas_ecd_100 = neighbour_atrophy_partial(neighcross_group_100_fc_ctx, neighcross_group_100_sc_ctx, ecd_group_ctx, atrophy_cross_group_100, "schaefer_100")
  697. #%%
  698. #==============================================================================
  699. # AXONAL TRANSECTION
  700. #==============================================================================
  701. rvals_disc_100, p_and_d_disc_100, meas_disc_100 = axonal_disc(disc_ctx_dc_100, disc_sctx_dc_100, atrophy_cross_group_100, "schaefer_100")
  702. rvals_disc_400, p_and_d_disc_400, meas_disc_400 = axonal_disc(disc_ctx_dc_400, disc_sctx_dc_100, atrophy_cross_group_400, "schaefer_400")
  703. plot_null_distributions(p_and_d_disc_100, rvals_disc_100, "plot_disc_group_cross_100_null")
  704. plot_null_distributions(p_and_d_disc_400, rvals_disc_400, "plot_disc_group_cross_400_null")
  705. plot_hubs_vs_atrophy(p_and_d_disc_100, rvals_disc_100, meas_disc_100, "plot_disc_group_cross_100")
  706. plot_hubs_vs_atrophy(p_and_d_disc_400, rvals_disc_400, meas_disc_400, "plot_disc_group_cross_400")
  707. #%%
  708. rvals_parcel_100, p_and_d_parcel_100, meas_parcel_100 = axonal_disc(parcel_group_100_ctx.squeeze(), parcel_group_100_sctx.squeeze(), atrophy_cross_group_100, "schaefer_100")
  709. rvals_parcel_400, p_and_d_parcel_400, meas_parcel_400 = axonal_disc(parcel_group_400_ctx.squeeze(), parcel_group_400_sctx.squeeze(), atrophy_cross_group_400, "schaefer_400")
  710. plot_null_distributions(p_and_d_parcel_100, rvals_parcel_100, "plot_parcel_group_cross_100_null")
  711. plot_null_distributions(p_and_d_parcel_400, rvals_parcel_400, "plot_parcel_group_cross_400_null")
  712. plot_hubs_vs_atrophy(p_and_d_parcel_100, rvals_parcel_100, meas_parcel_100, "plot_parcel_group_cross_100")
  713. plot_hubs_vs_atrophy(p_and_d_parcel_400, rvals_parcel_400, meas_parcel_400, "plot_parcel_group_cross_400")
  714. #%%
  715. #==============================================================================
  716. # TRANSCRIPTOMIC VULNERABILITY
  717. #==============================================================================
  718. rvals_cge_100, p_and_d_cge_100, meas_cge_100 = transcriptomic_vulnerablity(cge_group_100_ctx, cge_group_100_sctx, atrophy_cross_group_100, "schaefer_100")
  719. rvals_cge_400, p_and_d_cge_400, meas_cge_400 = transcriptomic_vulnerablity(cge_group_400_ctx, cge_group_400_sctx, atrophy_cross_group_400, "schaefer_400")
  720. plot_null_distributions(p_and_d_cge_100, rvals_cge_100, "plot_cge_group_cross_100_null")
  721. plot_null_distributions(p_and_d_cge_400, rvals_cge_400, "plot_cge_group_cross_400_null")
  722. plot_hubs_vs_atrophy(p_and_d_cge_100, rvals_cge_100, meas_cge_100, "plot_cge_group_cross_100")
  723. plot_hubs_vs_atrophy(p_and_d_cge_400, rvals_cge_400, meas_cge_400, "plot_cge_group_cross_400")

AtrophyModelling_cross.py at commit 85266b3, under MIT · at the source

Overview

Authors: Mar Barrantes-Cepas1,2, Mario Tranfa1,2,3,4, David R van Nederpelt2,5, Ismail Koubiyr1,2, Luigi Lorenzini2,3,6, Birgit Helmlinger1,2,7, Stefan Ropele8, Daniela Pinter7, Christian Enzinger9, Tomas Uher10, Manuela Vaneckova11, Joep Killestein2,12, Eva M M Strijbis2,12, Martijn D Steenwijk1,2, Hugo Vrenken2,5, Frederik Barkhof2,5,13, Menno M Schoonheim1,2, Giuseppe Pontillo1,2,4,5,13
13 affiliations
  1. MS Center Amsterdam, Amsterdam UMC location Vrije Universiteit Amsterdam, Anatomy and Neurosciences, Amsterdam, Netherlands
  2. Amsterdam Neuroscience, Neuroinfection and Neuroinflammation, Brain Imaging, Amsterdam, Netherlands
  3. Department of Radiology and Nuclear Medicine, Amsterdam University Medical Center, Vrije Universiteit, Amsterdam, Netherlands
  4. Department of Advanced Biomedical Sciences, University “Federico II,” Naples, Italy
  5. MS Center Amsterdam, Amsterdam UMC location Vrije Universiteit Amsterdam, Radiology and Nuclear Medicine, Amsterdam, Netherlands
  6. Department of Neuroscience, Rehabilitation, Ophthalmology, Genetics, Maternal and Child Health (DiNOGMI), University of Genoa, Genoa, Italy
  7. Department of Neurology, Research Unit for Neuronal Plasticity and Repair, Medical University of Graz, Graz, Austria
  8. Department of Neurology, Neuroimaging Research Unit, Medical University of Graz, Graz, Austria
  9. Department of Neurology, Medical University of Graz, Graz, Austria
  10. Department of Neurology and Centre of Clinical Neuroscience, First Faculty of Medicine, Charles University in Prague and General University Hospital, Prague, Czechia
  11. Department of Radiology, First Faculty of Medicine, Charles University in Prague and General University Hospital, Prague, Czechia
  12. MS Center Amsterdam, Amsterdam UMC location Vrije Universiteit Amsterdam, Neurology, Amsterdam, Netherlands
  13. Queen Square Institute of Neurology and Centre for Medical Imaging Computing, University College London, London, UK
Journal: Science advances, volume 12, issue 46, article eaeg3412
Dates: received 13 February 2026; accepted 7 October 2026; published online 11 November 2026; in print November 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1126/sciadv.aeg3412 · PMID 43013671 · PMCID PMC13754032 · OpenAlex W7129100046
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: genetics / omics (modality), structural MRI / diffusion (modality), human (organism), multiple sclerosis (population), systems (subfield)
Methods: Statistics, Machine learning, Preprocessing, fMRI & imaging
MeSH: Gray Matter*, Multiple Sclerosis*, Nerve Net*, Transcriptome*, Adult, Atrophy, Disease Progression, Female, Humans, Magnetic Resonance Imaging, Male, Middle Aged (* major topic)
Topic: Multiple Sclerosis Research Studies (Clinical Neurology, Medicine), according to OpenAlex
Funding: Czech Ministry of Health (NU22-04-00193, MH CZ-DRO-VFN64165); European Committee for Treatment and Research in Multiple Sclerosis; ZonMW VENI (09150162410185); Dutch MS Research Foundation; Charles University Cooperation Program in Neuroscience; ZonMw VIDI (09150172010056); MSCA Postdoctoral Fellowship (101204296); European Union&apos;s Horizon Widera programme (101159624 TACTIX)
Citations: not cited yet (Europe PMC); 68 references in the paper

Abstract

Clinical progression is strongly linked to gray matter atrophy in multiple sclerosis (MS), detectable early on MRI and progressing nonrandomly across the brain. However, the mechanisms driving its spatiotemporal progression and individual variability remain unclear. Using MRIs from 2187 participants, alongside normative data, we systematically investigated network-based mechanisms underlying MS-related atrophy. Regional atrophy was associated with functional cortical hubness, supporting the nodal stress hypothesis, and was constrained by anatomical and functional connections, consistent with transneuronal degeneration. Lesional disconnection and transcriptomic vulnerability played marginal roles. Patient- and subgroup-level analyses revealed that network-based mechanisms are specifically linked to MS-related neurodegeneration and may operate differently in distinct subtypes or disease phases. Atrophy patterns were anchored to the connectivity profiles of disease epicenters involving the visual, sensorimotor, and temporal cortices, as well as the hippocampi, amygdalae, and thalami. Network-based measures enhanced the explanation of future atrophy progression in people with MS, providing a mechanistic framework to understand neurodegeneration in MS.

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

Repositories

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

Zenodo 21281372

License: CC-BY-4.0
State: the link answers, verified on 14 November 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: “Data, code, and materials availability:”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: NumPy (24 files), pandas (21 files), ggplot2 (5 files), Matplotlib (5 files), tidyverse (5 files), nlme (3 files), cowplot (2 files), NiBabel (2 files), patchwork (2 files), psych (2 files), reticulate (2 files), rstatix (2 files), SciPy (2 files), statsmodels (2 files), broom (1 file), FSL (1 file), igraph (1 file), mgcv (1 file), Pingouin (1 file)
Availability: 1 check, the latest on 14 November 2026: the link answers (HTTP 200)
  • 14 November 2026: the link answers (HTTP 200)
42 files

giupontillo/AtrophyModellingMS

License: MIT
State: the link answers, verified on 14 November 2026
Evidence: files inventoried
Commit: 85266b335118c96f77d7c7f46296243f743ebbda, 10 July 2026
Languages: Python (25), Shell (9), R (4), Quarto (2)
Size: 153 files, 40 scripts
Software Heritage: not archived
Found in: “Data, code, and materials availability:”
Holds: README, license file, 5 notebooks
Not found: CITATION.cff, environment file, tests, continuous integration, documentation
Tools: NumPy (24 files), pandas (21 files), ggplot2 (5 files), Matplotlib (5 files), tidyverse (5 files), nlme (3 files), cowplot (2 files), NiBabel (2 files), patchwork (2 files), psych (2 files), reticulate (2 files), rstatix (2 files), SciPy (2 files), statsmodels (2 files), broom (1 file), FSL (1 file), igraph (1 file), mgcv (1 file), Pingouin (1 file)
Availability: 1 check, the latest on 14 November 2026: the link answers
  • 14 November 2026: the link answers
42 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:

  • 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 80 scripts, each with its path and the digest of its content;
  • 11 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, code, and materials availability

All data and code needed to evaluate and reproduce the results in the paper are present in the paper and/or the Supplementary Materials. Group-level data are available at https://zenodo.org/records/21281372. Because of the explicit terms of the informed consent signed by the study participants, and in compliance with GDPR regulations, individual-level participant metrics cannot be hosted in an open public repository. However, pseudonymized datasets can be made available to qualified researchers for noncommercial research replication purposes. Requests for data access must be submitted to the MS Center Amsterdam (contact via email: ) and are subject to the approval of a formal material transfer agreement. The code used for the analyses is available on GitHub (https://github.com/giupontillo/AtrophyModellingMS) and Zenodo (https://zenodo.org/records/21281372). All additional resources are cited in the manuscript and/or the Supplementary Materials. No new materials were generated for this study.

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

Recorded: type, language, journal, volume, issue, pages, dates, 18 authors, 12 MeSH terms, 8 funders, 67 references.

Cite

This paper

Barrantes-Cepas, M., Tranfa, M., van Nederpelt, D. R., Koubiyr, I., Lorenzini, L., Helmlinger, B., Ropele, S., Pinter, D., Enzinger, C., Uher, T., Vaneckova, M., Killestein, J., Strijbis, E. M. M., Steenwijk, M. D., Vrenken, H., Barkhof, F., Schoonheim, M. M., & Pontillo, G. (2026). The role of network connectivity and transcriptomic vulnerability in shaping gray matter atrophy in multiple sclerosis. Science advances, 12(46), eaeg3412. https://doi.org/10.1126/sciadv.aeg3412

BibTeX

@article{barrantescepas2026role,
author = {Barrantes-Cepas, Mar and Tranfa, Mario and van Nederpelt, David R and Koubiyr, Ismail and Lorenzini, Luigi and Helmlinger, Birgit and Ropele, Stefan and Pinter, Daniela and Enzinger, Christian and Uher, Tomas and Vaneckova, Manuela and Killestein, Joep and Strijbis, Eva M M and Steenwijk, Martijn D and Vrenken, Hugo and Barkhof, Frederik and Schoonheim, Menno M and Pontillo, Giuseppe},
title = {{The role of network connectivity and transcriptomic vulnerability in shaping gray matter atrophy in multiple sclerosis}},
journal = {Science advances},
year = {2026},
month = nov,
volume = {12},
number = {46},
pages = {eaeg3412},
publisher = {American Association for the Advancement of Science},
issn = {2375-2548},
doi = {10.1126/sciadv.aeg3412},
url = {https://doi.org/10.1126/sciadv.aeg3412},
pmid = {43013671},
pmcid = {PMC13754032}
}

RIS

TY - JOUR
AU - Barrantes-Cepas, Mar
AU - Tranfa, Mario
AU - van Nederpelt, David R
AU - Koubiyr, Ismail
AU - Lorenzini, Luigi
AU - Helmlinger, Birgit
AU - Ropele, Stefan
AU - Pinter, Daniela
AU - Enzinger, Christian
AU - Uher, Tomas
AU - Vaneckova, Manuela
AU - Killestein, Joep
AU - Strijbis, Eva M M
AU - Steenwijk, Martijn D
AU - Vrenken, Hugo
AU - Barkhof, Frederik
AU - Schoonheim, Menno M
AU - Pontillo, Giuseppe
TI - The role of network connectivity and transcriptomic vulnerability in shaping gray matter atrophy in multiple sclerosis
T2 - Science advances
J2 - Sci Adv
PY - 2026
DA - 2026/11/11
VL - 12
IS - 46
SP - eaeg3412
SN - 2375-2548
PB - American Association for the Advancement of Science
DO - 10.1126/sciadv.aeg3412
UR - https://doi.org/10.1126/sciadv.aeg3412
LA - en
ER -

CSL-JSON

{
"id": "10.1126/sciadv.aeg3412",
"type": "article-journal",
"title": "The role of network connectivity and transcriptomic vulnerability in shaping gray matter atrophy in multiple sclerosis",
"container-title": "Science advances",
"author": [
{
"family": "Barrantes-Cepas",
"given": "Mar"
},
{
"family": "Tranfa",
"given": "Mario"
},
{
"family": "van Nederpelt",
"given": "David R"
},
{
"family": "Koubiyr",
"given": "Ismail"
},
{
"family": "Lorenzini",
"given": "Luigi"
},
{
"family": "Helmlinger",
"given": "Birgit"
},
{
"family": "Ropele",
"given": "Stefan"
},
{
"family": "Pinter",
"given": "Daniela"
},
{
"family": "Enzinger",
"given": "Christian"
},
{
"family": "Uher",
"given": "Tomas"
},
{
"family": "Vaneckova",
"given": "Manuela"
},
{
"family": "Killestein",
"given": "Joep"
},
{
"family": "Strijbis",
"given": "Eva M M"
},
{
"family": "Steenwijk",
"given": "Martijn D"
},
{
"family": "Vrenken",
"given": "Hugo"
},
{
"family": "Barkhof",
"given": "Frederik"
},
{
"family": "Schoonheim",
"given": "Menno M"
},
{
"family": "Pontillo",
"given": "Giuseppe"
}
],
"container-title-short": "Sci Adv",
"volume": "12",
"issue": "46",
"page": "eaeg3412",
"DOI": "10.1126/sciadv.aeg3412",
"PMID": "43013671",
"PMCID": "PMC13754032",
"ISSN": "2375-2548",
"publisher": "American Association for the Advancement of Science",
"URL": "https://doi.org/10.1126/sciadv.aeg3412",
"language": "en",
"issued": {
"date-parts": [
[
2026,
11,
11
]
]
}
}

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.1016/j.ynirp.2025.100252 [code]
Repeatability and reproducibility of brain age estimates in multiple sclerosis for three publicly available models.
Journal: Neuroimage. Reports
In common: FSL, NiBabel, tidyverse, 3 other tools, multiple sclerosis, structural MRI / diffusion, 2 references, 3 authors
[2] doi:10.1002/hbm.70480 [code]
Time-Varying Brain Functional Reconfiguration Patterns Associated With Fatigue in Multiple Sclerosis.
Journal: Human brain mapping
In common: multiple sclerosis, structural MRI / diffusion, 1 reference, 4 authors
[3] doi:10.1038/s43856-026-01707-2 [code]
Decreased amyloid-related structure-function coupling in preclinical Alzheimer's disease.
Journal: Communications medicine
In common: NiBabel, pandas, SciPy, 2 other tools, 1 reference, 4 authors
[4] doi:10.1002/hbm.26144 [code]
Benchmarking the generalizability of brain age models: Challenges posed by scanner variance and prediction bias.
Journal: Human brain mapping
In common: mgcv, nlme, broom, 10 other tools, structural MRI / diffusion, 3 references
[5] doi:10.1093/brain/awac180 [code]
Regional healthy brain activity, glioma occurrence and symptomatology.
Journal: Brain : a journal of neurology
In common: nlme, Pingouin, rstatix, 9 other tools, author Menno M Schoonheim
[6] doi:10.1371/journal.pbio.3002710 [code]
The multiscale brain structural re-organization that occurs from childhood to adolescence correlates with cortical morphology maturation and functional specialization.
Journal: PLoS biology
In common: mgcv, nlme, rstatix, 8 other tools, structural MRI / diffusion, 4 references
[7] doi:10.1038/s41467-025-60556-0 [code]
Cell-specific mechanisms drive connectivity across the time course of Huntington's disease.
Journal: Nature communications
In common: statsmodels, NiBabel, ggplot2, 5 other tools, structural MRI / diffusion, 8 references
[8] doi:10.1093/braincomms/fcae234 [code]
Longitudinal network-based brain grey matter MRI measures are clinically relevant and sensitive to treatment effects in multiple sclerosis.
Journal: Brain communications
In common: NiBabel, pandas, NumPy, multiple sclerosis, structural MRI / diffusion, 5 references, author Frederik Barkhof
[9] doi:10.1002/alz.70762 [code]
Cortical thickness subtypes in cognitively unimpaired individuals: Differential network and transcriptomic vulnerability to cortical thinning.
Journal: Alzheimer's & dementia : the journal of the Alzheimer's Association
In common: NiBabel, pandas, SciPy, 1 other tool, structural MRI / diffusion, genetics / omics, 3 references, 2 authors
[10] doi:10.1186/s12916-025-04099-7 [code]
Normative structural connectome constrains spreading transient brain activity in generalized epilepsy.
Journal: BMC medicine
In common: mgcv, FSL, NiBabel, 4 other tools, structural MRI / diffusion, 7 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.1126/sciadv.aeg3412.svg)](https://openscicode.org/badge/doi/10.1126/sciadv.aeg3412)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1126/sciadv.aeg3412.svg
   :target: https://openscicode.org/badge/doi/10.1126/sciadv.aeg3412
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1126/sciadv.aeg3412"><img src="https://openscicode.org/badge/doi/10.1126/sciadv.aeg3412.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.