OSCR

Shared subcortical-default mode morphological dysconnectivity in adolescent bipolar disorder, major depressive disorder and schizophrenia.

Code ↔ Paper

3 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 3 matches · 2 of them tie a paragraph to a whole file, not to given lines: weak matches, whose lines are not tinted
  1. [1] § Materials and methods › Statistics and reproducibility › Between-group differences in single-subject morphological brain networks ↔ gretna_TFNBS_ftest.m, lines 1–102 · score 0.81 · height enhancement parameters, permutation procedure, post hoc, matrix, TFNBS, threshold
  2. [2] § Materials and methods › Relationships between disorder-related alterations in single-subject morphological brain networks and neurotransmitter maps ↔ moran_randomization.m, the whole file · a weak match · score 0.60 · spectral randomization, Moran, space, models, correlation
  3. [3] § Materials and methods › Statistics and reproducibility › Between-group differences in single-subject morphological brain networks ↔ gretna_FDR.m, the whole file · a weak match · score 0.51 · discovery rate, nonparametric, FDR, threshold

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

MATLAB · 589 lines · 28 KB · CC-BY-4.0 · 1 match

  1. function [TFNBS_Result] = gretna_TFNBS_ftest(Data_path, File_filter, M, Mask_net, Pthr, E, H, Cova_path)
  2. %==========================================================================
  3. % This function is used to perform the TFNBS algorithm to search
  4. % connections that show significant group effects for one-way experimental
  5. % design (more than two groups). NB. 1) self-connections are allowed in this
  6. % analysis by setting diagnoal elements to be 1 in Mask_net; 2) only data
  7. % but not covariates are randomly relabeled by reshuffling group membership
  8. % in the permutation procedure.
  9. %
  10. %
  11. % Syntax: function [TFNBS_Result] = gretna_TFNBS_ftest(Data_path, File_filter, M, Mask_net, Pthr, E, H, Cova_path)
  12. %
  13. % Inputs:
  14. % Data_path:
  15. % N*1 cell with each cell denoting the directory where
  16. % connectivity matrices are sorted for each group.
  17. % File_filter:
  18. % N*1 cell with each cell denoting the prefix of those
  19. % connectivity matrices to be processed for each group.
  20. % M:
  21. % The number of permutations.
  22. % Mask_net:
  23. % The matrix mask containing 0 and 1 and only connections
  24. % corresponding to 1 are fed in the TFNBS computation.
  25. % Pthr:
  26. % The FWE-corrected p-value threshold.
  27. % E:
  28. % Extension enhancement parameters(default = 0.5).
  29. % H:
  30. % Height enhancement parameters(default = 2).
  31. % Cova_path (opt):
  32. % N*1 cell with each cell denoting the directory and filename
  33. % of covariates for each group. NB. the group order should
  34. % be the same to that of Data_path.
  35. %
  36. % Output:
  37. % TFNBS_Result.:
  38. % Fmat:
  39. % F values for each edge of interest.
  40. % P_Fmat:
  41. % P values of Fmat.
  42. % DF_Fmat:
  43. % Degree of freedom of Fmat.
  44. % Tmat:
  45. % Post hoc T values for each edge of interest. For n groups,
  46. % the order is: g(1)-g(2), g(1)-g(3), ..., g(1)-g(n),
  47. % g(2)-g(3), ..., g(2)-g(n), ..., g(n-1)-g(n).
  48. % P_Tmat:
  49. % P values of Tmat.
  50. % DF_Tmat:
  51. % Degree of freedom of Tmat.
  52. % TFNBS_f_score:
  53. % TFNBS-based F values for each edge of interest.
  54. % TFNBS_f_pval:
  55. % P values of TFNBS_f_score (FWE-corrected).
  56. % TFNBS_t_score:
  57. % Post hoc TFNBS-based T values for each edge of interest.
  58. % TFNBS_t_pval:
  59. % P values of TFNBS_t_score (un-corrected, two-tailed).
  60. % N_sig_edge:
  61. % The number of edges showing significant group effect.
  62. % Reg_sig_edge:
  63. % Nodal indices linked by those edges showing significant
  64. % group effect.
  65. % TFNBS_f_score_sig_edge:
  66. % TFNBS-based F values for those edges showing significant
  67. % group effect.
  68. % TFNBS_f_pval_sig_edge:
  69. % P values of TFNBS_f_score_sig_edge (FWE-corrected).
  70. % TFNBS_t_score_sig_edge:
  71. % Post hoc TFNBS-based T values for those edges showing
  72. % significant group effect.
  73. % TFNBS_t_pval_sig_edge:
  74. % P values of TFNBS_t_score_sig_edge (un-corrected, two-tailed).
  75. %
  76. % References:
  77. % Baggio et al., 2018, Statistical inference in brain graphs using threshold-free
  78. % network-based statistics.
  79. %
  80. % Rui WANG, IBRR, SCNU, Guangzhou, 2019/10/11, [email hidden]
  81. % Yuping YANG, IBRR, SCNU, Guangzhou, 2019/11/30, [email hidden]
  82. % Jinhui WANG, IBRR, SCNU, Guangzhou, 2019/11/30, [email hidden]
  83. %==========================================================================
  84. if nargin == 5
  85. E = 0.5; H = 2;
  86. end
  87. if nargin == 6
  88. H = 2;
  89. end
  90. Ind_mask = find(triu(Mask_net)); % to support functional network analysis, that is, allow within-network self-connections
  91. N_group = length(Data_path);
  92. if N_group == 2
  93. error('This function is used for comparison among more than two groups! For two groups, use gretna_TFNBS_ttest.m!');
  94. end
  95. N_sub = zeros(N_group,1);
  96. Data = cell(N_group,1);
  97. %% reorganize data
  98. for i_group = 1:N_group
  99. cd (Data_path{i_group})
  100. Mat_file = ls([File_filter{i_group} '*.mat']);
  101. if ~isempty(Mat_file)
  102. N_sub(i_group) = size(Mat_file,1);
  103. Data_igroup = zeros(N_sub(i_group),length(Ind_mask));
  104. for i_sub = 1:N_sub(i_group)
  105. Ind_mat = load(Mat_file(i_sub,:));
  106. Name_field = fieldnames(Ind_mat);
  107. Ind_mat = Ind_mat.(Name_field{1});
  108. Data_igroup(i_sub,:) = Ind_mat(Ind_mask);
  109. end
  110. else
  111. Mat_file = ls([File_filter{i_group} '*.txt']);
  112. N_sub(i_group) = size(Mat_file,1);
  113. Data_igroup = zeros(N_sub(i_group),length(Ind_mask));
  114. for i_sub = 1:N_sub(i_group)
  115. Ind_mat = load(Mat_file(i_sub,:));
  116. Data_igroup(i_sub,:) = Ind_mat(Ind_mask);
  117. end
  118. end
  119. Data{i_group} = Data_igroup;
  120. end
  121. %% ancova or anova for real data
  122. if nargin == 8
  123. N_cova = length(Cova_path);
  124. if N_cova ~= N_group
  125. error('The number of covariate files is not equal to the number of groups!');
  126. end
  127. Cova = cell(N_cova,1);
  128. for i_cova = 1:N_cova
  129. [~,~,ext] = fileparts(Cova_path{i_cova});
  130. switch ext
  131. case '.txt'
  132. Cova{i_cova} = load(Cova_path{i_cova});
  133. case '.mat'
  134. Ind_cova = load(Cova_path{i_cova});
  135. Name_field = fieldnames(Ind_cova);
  136. Cova{i_cova} = Ind_cova.(Name_field{1});
  137. end
  138. end
  139. [Fvec,P_Fvec,DF_Fvec,Post_Tvec, Post_P_Tvec, Post_DF_Tvec] = gretna_ancova1(Data,Cova);
  140. else
  141. [Fvec,P_Fvec,DF_Fvec,Post_Tvec, Post_P_Tvec, Post_DF_Tvec] = gretna_ancova1(Data);
  142. end
  143. %% TFNBS for real data
  144. % F test
  145. Fmat = zeros(size(Mask_net));
  146. P_Fmat = zeros(size(Mask_net));
  147. DF_Fmat.group = zeros(size(Mask_net));
  148. DF_Fmat.error = zeros(size(Mask_net));
  149. Fmat(Ind_mask) = Fvec;
  150. Fmat = Fmat + triu(Fmat,1)'; % to support functional network analysis, that is, allow within-network self-connections
  151. Fmat(isnan(Fmat)) = 0;
  152. P_Fmat(Ind_mask) = P_Fvec;
  153. P_Fmat = P_Fmat + triu(P_Fmat,1)'; % to support functional network analysis, that is, allow within-network self-connections
  154. DF_Fmat.group(Ind_mask) = DF_Fvec.group;
  155. DF_Fmat.group = DF_Fmat.group + triu(DF_Fmat.group,1)'; % to support functional network analysis, that is, allow within-network self-connections
  156. DF_Fmat.error(Ind_mask) = DF_Fvec.error;
  157. DF_Fmat.error = DF_Fmat.error + triu(DF_Fmat.error,1)'; % to support functional network analysis, that is, allow within-network self-connections
  158. F_thr = linspace(0,max(Fvec),101);
  159. TFNBS_f_score = zeros([size(Mask_net),101]);
  160. for i_thr = 1:101
  161. F_suprathres = Fmat;
  162. F_suprathres(F_suprathres >= F_thr(i_thr)) = nan;
  163. F_suprathres(~isnan(F_suprathres)) = 0;
  164. F_suprathres(isnan(F_suprathres)) = 1;
  165. [F_ci, F_n_node] = components(sparse(F_suprathres));
  166. F_n_com = length(F_n_node);
  167. for i_com = 1:F_n_com
  168. F_ind_subn = find(F_ci == i_com);
  169. F_subn = F_suprathres(F_ind_subn,F_ind_subn);
  170. F_subn = triu(F_subn); % to support functional network analysis, that is, allow within-network self-connections
  171. F_size = sum(F_subn(:)); % to support functional network analysis, that is, allow within-network self-connections
  172. F_subn(F_subn~=0) = (F_size^E)*(F_thr(i_thr)^H);
  173. F_subn = F_subn + triu(F_subn,1)';
  174. TFNBS_f_score(F_ind_subn,F_ind_subn,i_thr) = F_subn;
  175. end
  176. end
  177. TFNBS_f_score = sum(TFNBS_f_score,3);
  178. % post hoc T test
  179. Tmat = zeros([size(Mask_net),size(Post_Tvec,1)]);
  180. P_Tmat = zeros([size(Mask_net),size(Post_Tvec,1)]);
  181. DF_Tmat = zeros([size(Mask_net),size(Post_Tvec,1)]);
  182. for i_post = 1:size(Post_Tvec,1)
  183. Tmat_i_post = zeros(size(Mask_net));
  184. P_Tmat_i_post = zeros(size(Mask_net));
  185. DF_Tmat_i_post = zeros(size(Mask_net));
  186. Tmat_i_post(Ind_mask) = Post_Tvec(i_post,:);
  187. Tmat_i_post = Tmat_i_post + triu(Tmat_i_post,1)'; % to support functional network analysis, that is, allow within-network self-connections
  188. Tmat(:,:,i_post) = Tmat_i_post;
  189. Tmat(isnan(Tmat)) = 0;
  190. P_Tmat_i_post(Ind_mask) = Post_P_Tvec(i_post,:);
  191. P_Tmat_i_post = P_Tmat_i_post + triu(P_Tmat_i_post,1)'; % to support functional network analysis, that is, allow within-network self-connections
  192. P_Tmat(:,:,i_post) = P_Tmat_i_post;
  193. DF_Tmat_i_post(Ind_mask) = Post_DF_Tvec(i_post,:);
  194. DF_Tmat_i_post = DF_Tmat_i_post + triu(DF_Tmat_i_post,1)'; % to support functional network analysis, that is, allow within-network self-connections
  195. DF_Tmat(:,:,i_post) = DF_Tmat_i_post;
  196. end
  197. TFNBS_t_score = zeros([size(Mask_net),size(Post_Tvec,1)]);
  198. for i_post = 1:size(Post_Tvec,1)
  199. TFNBS_t_score_i_post = zeros([size(Mask_net),101]);
  200. % only positive
  201. if min(Post_Tvec(i_post,:)) >= 0
  202. T_thr_pos = linspace(0,max(Post_Tvec(i_post,:)),101);
  203. for i_thr = 1:101
  204. T_suprathres_pos = Tmat(:,:,i_post);
  205. T_suprathres_pos(T_suprathres_pos >= T_thr_pos(i_thr)) = nan;
  206. T_suprathres_pos(~isnan(T_suprathres_pos)) = 0;
  207. T_suprathres_pos(isnan(T_suprathres_pos)) = 1;
  208. [T_ci_pos, T_n_node_pos] = components(sparse(T_suprathres_pos));
  209. T_n_com_pos = length(T_n_node_pos);
  210. for i_com = 1:T_n_com_pos
  211. T_ind_subn_pos = find(T_ci_pos == i_com);
  212. T_subn_pos = T_suprathres_pos(T_ind_subn_pos,T_ind_subn_pos);
  213. T_subn_pos = triu(T_subn_pos); % to support functional network analysis, that is, allow within-network self-connections
  214. T_size_pos = sum(T_subn_pos(:)); % to support functional network analysis, that is, allow within-network self-connections
  215. T_subn_pos(T_subn_pos~=0) = (T_size_pos^E)*(T_thr_pos(i_thr)^H);
  216. T_subn_pos = T_subn_pos + triu(T_subn_pos,1)';
  217. TFNBS_t_score_i_post(T_ind_subn_pos,T_ind_subn_pos,i_thr) = T_subn_pos;
  218. end
  219. end
  220. TFNBS_t_score(:,:,i_post) = sum(TFNBS_t_score_i_post,3);
  221. % only negative
  222. elseif max(Post_Tvec(i_post,:)) <= 0
  223. T_thr_neg = -linspace(0,-min(Post_Tvec(i_post,:)),101);
  224. for i_thr = 1:101
  225. T_suprathres_neg = Tmat(:,:,i_post);
  226. T_suprathres_neg(T_suprathres_neg <= T_thr_neg(i_thr)) = nan;
  227. T_suprathres_neg(~isnan(T_suprathres_neg)) = 0;
  228. T_suprathres_neg(isnan(T_suprathres_neg)) = 1;
  229. [T_ci_neg, T_n_node_neg] = components(sparse(T_suprathres_neg));
  230. T_n_com_neg = length(T_n_node_neg);
  231. for i_com = 1:T_n_com_neg
  232. T_ind_subn_neg = find(T_ci_neg == i_com);
  233. T_subn_neg = T_suprathres_neg(T_ind_subn_neg,T_ind_subn_neg);
  234. T_subn_neg = triu(T_subn_neg); % to support functional network analysis, that is, allow within-network self-connections
  235. T_size_neg = sum(T_subn_neg(:)); % to support functional network analysis, that is, allow within-network self-connections
  236. T_subn_neg(T_subn_neg~=0) = -(T_size_neg^E)*(T_thr_neg(i_thr)^H);
  237. T_subn_neg = T_subn_neg + triu(T_subn_neg,1)';
  238. TFNBS_t_score_i_post(T_ind_subn_neg,T_ind_subn_neg,i_thr) = T_subn_neg;
  239. end
  240. end
  241. TFNBS_t_score(:,:,i_post) = sum(TFNBS_t_score_i_post,3);
  242. else
  243. T_thr_pos = linspace(0,max(Post_Tvec(i_post,:)),101);
  244. T_thr_neg = -linspace(0,-min(Post_Tvec(i_post,:)),101);
  245. for i_thr = 1:101
  246. % positive
  247. T_suprathres_pos = Tmat(:,:,i_post);
  248. T_suprathres_pos(T_suprathres_pos >= T_thr_pos(i_thr)) = nan;
  249. T_suprathres_pos(~isnan(T_suprathres_pos)) = 0;
  250. T_suprathres_pos(isnan(T_suprathres_pos)) = 1;
  251. [T_ci_pos, T_n_node_pos] = components(sparse(T_suprathres_pos));
  252. T_n_com_pos = length(T_n_node_pos);
  253. Tmp_pos = zeros(size(Mask_net));
  254. for i_com = 1:T_n_com_pos
  255. T_ind_subn_pos = find(T_ci_pos == i_com);
  256. T_subn_pos = T_suprathres_pos(T_ind_subn_pos,T_ind_subn_pos);
  257. T_subn_pos = triu(T_subn_pos); % to support functional network analysis, that is, allow within-network self-connections
  258. T_size_pos = sum(T_subn_pos(:)); % to support functional network analysis, that is, allow within-network self-connections
  259. T_subn_pos(T_subn_pos~=0) = (T_size_pos^E)*(T_thr_pos(i_thr)^H);
  260. T_subn_pos = T_subn_pos + triu(T_subn_pos,1)';
  261. Tmp_pos(T_ind_subn_pos,T_ind_subn_pos) = T_subn_pos;
  262. end
  263. % negative
  264. T_suprathres_neg = Tmat(:,:,i_post);
  265. T_suprathres_neg(T_suprathres_neg <= T_thr_neg(i_thr)) = nan;
  266. T_suprathres_neg(~isnan(T_suprathres_neg)) = 0;
  267. T_suprathres_neg(isnan(T_suprathres_neg)) = 1;
  268. [T_ci_neg, T_n_node_neg] = components(sparse(T_suprathres_neg));
  269. T_n_com_neg = length(T_n_node_neg);
  270. Tmp_neg = zeros(size(Mask_net));
  271. for i_com = 1:T_n_com_neg
  272. T_ind_subn_neg = find(T_ci_neg == i_com);
  273. T_subn_neg = T_suprathres_neg(T_ind_subn_neg,T_ind_subn_neg);
  274. T_subn_neg = triu(T_subn_neg); % to support functional network analysis, that is, allow within-network self-connections
  275. T_size_neg = sum(T_subn_neg(:)); % to support functional network analysis, that is, allow within-network self-connections
  276. T_subn_neg(T_subn_neg~=0) = -(T_size_neg^E)*(T_thr_neg(i_thr)^H);
  277. T_subn_neg = T_subn_neg + triu(T_subn_neg,1)';
  278. Tmp_neg(T_ind_subn_neg,T_ind_subn_neg) = T_subn_neg;
  279. end
  280. TFNBS_t_score_i_post(:,:,i_thr) = Tmp_pos + Tmp_neg;
  281. end
  282. TFNBS_t_score(:,:,i_post) = sum(TFNBS_t_score_i_post,3);
  283. end
  284. end
  285. %% permutation test
  286. Data = cell2mat(Data);
  287. Ind_start = zeros(N_group,1);
  288. Ind_start(1) = 1;
  289. for i_group = 1:N_group-1
  290. Ind_start(i_group+1) = sum(N_sub(1:i_group))+1;
  291. end
  292. max_TFNBS_f_score_rand = zeros(M,1);
  293. TFNBS_t_score_rand = zeros([size(Mask_net),size(Post_Tvec,1),M]);
  294. for i_per = 1:M
  295. Ind_rand = randperm(sum(N_sub));
  296. Data_rand = cell(N_group, 1);
  297. for i_group = 1:N_group
  298. Data_rand{i_group} = Data(Ind_rand(Ind_start(i_group):sum(N_sub(1:i_group))),:);
  299. end
  300. if nargin == 8
  301. [Fvec_rand,~,~,Post_Tvec_rand,~,~] = gretna_ancova1(Data_rand,Cova);
  302. else
  303. [Fvec_rand,~,~,Post_Tvec_rand,~,~] = gretna_ancova1(Data_rand);
  304. end
  305. % F test
  306. Fmat_rand = zeros(size(Mask_net));
  307. Fmat_rand(Ind_mask) = Fvec_rand;
  308. Fmat_rand = Fmat_rand + triu(Fmat_rand,1)'; % to support functional network analysis, that is, allow within-network self-connections
  309. Fmat_rand(isnan(Fmat_rand)) = 0;
  310. F_thr_rand = linspace(0, max(Fvec_rand), 101);
  311. TFNBS_f_score_rand = zeros([size(Mask_net),101]);
  312. for i_thr = 1:101
  313. F_suprathres_rand = Fmat_rand;
  314. F_suprathres_rand(F_suprathres_rand >= F_thr_rand(i_thr)) = nan;
  315. F_suprathres_rand(~isnan(F_suprathres_rand)) = 0;
  316. F_suprathres_rand(isnan(F_suprathres_rand)) = 1;
  317. [F_ci_rand, F_n_node_rand] = components(sparse(F_suprathres_rand));
  318. F_n_com_rand = length(F_n_node_rand);
  319. for i_com = 1:F_n_com_rand
  320. F_ind_subn_rand = find(F_ci_rand == i_com);
  321. F_subn_rand = F_suprathres_rand(F_ind_subn_rand,F_ind_subn_rand);
  322. F_subn_rand = triu(F_subn_rand); % to support functional network analysis, that is, allow within-network self-connections
  323. F_size_rand = sum(F_subn_rand(:)); % to support functional network analysis, that is, allow within-network self-connections
  324. F_subn_rand(F_subn_rand~=0) = (F_size_rand^E)*(F_thr_rand(i_thr)^H);
  325. F_subn_rand = F_subn_rand + triu(F_subn_rand,1)';
  326. TFNBS_f_score_rand(F_ind_subn_rand,F_ind_subn_rand,i_thr) = F_subn_rand;
  327. end
  328. end
  329. TFNBS_f_score_rand = sum(TFNBS_f_score_rand,3);
  330. max_TFNBS_f_score_rand(i_per) = max(TFNBS_f_score_rand(:));
  331. % for post hoc T test
  332. for i_post = 1:size(Post_Tvec_rand,1)
  333. Tmat_rand = zeros(size(Mask_net));
  334. Tmat_rand(Ind_mask) = Post_Tvec_rand(i_post,:);
  335. Tmat_rand = Tmat_rand + triu(Tmat_rand,1)'; % to support functional network analysis, that is, allow within-network self-connections
  336. Tmat_rand(isnan(Tmat_rand)) = 0;
  337. TFNBS_t_score_ipost_rand = zeros([size(Mask_net),101]);
  338. % only positive
  339. if min(Post_Tvec_rand(i_post,:)) >= 0
  340. T_thr_pos_rand = linspace(0,max(Post_Tvec_rand(i_post,:)),101);
  341. for i_thr = 1:101
  342. T_suprathres_pos_rand = Tmat_rand;
  343. T_suprathres_pos_rand(T_suprathres_pos_rand >= T_thr_pos_rand(i_thr)) = nan;
  344. T_suprathres_pos_rand(~isnan(T_suprathres_pos_rand)) = 0;
  345. T_suprathres_pos_rand(isnan(T_suprathres_pos_rand)) = 1;
  346. [T_ci_pos_rand, T_n_node_pos_rand] = components(sparse(T_suprathres_pos_rand));
  347. T_n_com_pos_rand = length(T_n_node_pos_rand);
  348. for i_com = 1:T_n_com_pos_rand
  349. T_ind_subn_pos_rand = find(T_ci_pos_rand == i_com);
  350. T_subn_pos_rand = T_suprathres_pos_rand(T_ind_subn_pos_rand,T_ind_subn_pos_rand);
  351. T_subn_pos_rand = triu(T_subn_pos_rand); % to support functional network analysis, that is, allow within-network self-connections
  352. T_size_pos_rand = sum(T_subn_pos_rand(:)); % to support functional network analysis, that is, allow within-network self-connections
  353. T_subn_pos_rand(T_subn_pos_rand~=0) = (T_size_pos_rand^E)*(T_thr_pos_rand(i_thr)^H);
  354. T_subn_pos_rand = T_subn_pos_rand + triu(T_subn_pos_rand,1)';
  355. TFNBS_t_score_ipost_rand(T_ind_subn_pos_rand,T_ind_subn_pos_rand,i_thr) = T_subn_pos_rand;
  356. end
  357. end
  358. TFNBS_t_score_rand(:,:,i_post,i_per) = sum(TFNBS_t_score_ipost_rand,3);
  359. % only negative
  360. elseif max(Post_Tvec_rand(i_post,:)) <= 0
  361. T_thr_neg_rand = -linspace(0,-min(Post_Tvec_rand(i_post,:)),101);
  362. for i_thr = 1:101
  363. T_suprathres_neg_rand = Tmat_rand;
  364. T_suprathres_neg_rand(T_suprathres_neg_rand <= T_thr_neg_rand(i_thr)) = nan;
  365. T_suprathres_neg_rand(~isnan(T_suprathres_neg_rand)) = 0;
  366. T_suprathres_neg_rand(isnan(T_suprathres_neg_rand)) = 1;
  367. [T_ci_neg_rand, T_n_node_neg_rand] = components(sparse(T_suprathres_neg_rand));
  368. T_n_com_neg_rand = length(T_n_node_neg_rand);
  369. for i_com = 1:T_n_com_neg_rand
  370. T_ind_subn_neg_rand = find(T_ci_neg_rand == i_com);
  371. T_subn_neg_rand = T_suprathres_neg_rand(T_ind_subn_neg_rand,T_ind_subn_neg_rand);
  372. T_subn_neg_rand = triu(T_subn_neg_rand); % to support functional network analysis, that is, allow within-network self-connections
  373. T_size_neg_rand = sum(T_subn_neg_rand(:)); % to support functional network analysis, that is, allow within-network self-connections
  374. T_subn_neg_rand(T_subn_neg_rand~=0) = -(T_size_neg_rand^E)*(T_thr_neg_rand(i_thr)^H);
  375. T_subn_neg_rand = T_subn_neg_rand + triu(T_subn_neg_rand,1)';
  376. TFNBS_t_score_ipost_rand(T_ind_subn_neg_rand,T_ind_subn_neg_rand,i_thr) = T_subn_neg_rand;
  377. end
  378. end
  379. TFNBS_t_score_rand(:,:,i_post,i_per) = sum(TFNBS_t_score_ipost_rand,3);
  380. else
  381. T_thr_pos_rand = linspace(0,max(Post_Tvec_rand(i_post,:)),101);
  382. T_thr_neg_rand = -linspace(0,-min(Post_Tvec_rand(i_post,:)),101);
  383. for i_thr = 1:101
  384. % positive
  385. T_suprathres_pos_rand = Tmat_rand;
  386. T_suprathres_pos_rand(T_suprathres_pos_rand >= T_thr_pos_rand(i_thr)) = nan;
  387. T_suprathres_pos_rand(~isnan(T_suprathres_pos_rand)) = 0;
  388. T_suprathres_pos_rand(isnan(T_suprathres_pos_rand)) = 1;
  389. [T_ci_pos_rand, T_n_node_pos_rand] = components(sparse(T_suprathres_pos_rand));
  390. T_n_com_pos_rand = length(T_n_node_pos_rand);
  391. Tmp_pos_rand = zeros(size(Mask_net));
  392. for i_com = 1:T_n_com_pos_rand
  393. T_ind_subn_pos_rand = find(T_ci_pos_rand == i_com);
  394. T_subn_pos_rand = T_suprathres_pos_rand(T_ind_subn_pos_rand,T_ind_subn_pos_rand);
  395. T_subn_pos_rand = triu(T_subn_pos_rand); % to support functional network analysis, that is, allow within-network self-connections
  396. T_size_pos_rand = sum(T_subn_pos_rand(:)); % to support functional network analysis, that is, allow within-network self-connections
  397. T_subn_pos_rand(T_subn_pos_rand~=0) = (T_size_pos_rand^E)*(T_thr_pos_rand(i_thr)^H);
  398. T_subn_pos_rand = T_subn_pos_rand + triu(T_subn_pos_rand,1)';
  399. Tmp_pos_rand(T_ind_subn_pos_rand,T_ind_subn_pos_rand) = T_subn_pos_rand;
  400. end
  401. % negative
  402. T_suprathres_neg_rand = Tmat_rand;
  403. T_suprathres_neg_rand(T_suprathres_neg_rand <= T_thr_neg_rand(i_thr)) = nan;
  404. T_suprathres_neg_rand(~isnan(T_suprathres_neg_rand)) = 0;
  405. T_suprathres_neg_rand(isnan(T_suprathres_neg_rand)) = 1;
  406. [T_ci_neg_rand, T_n_node_neg_rand] = components(sparse(T_suprathres_neg_rand));
  407. T_n_com_neg_rand = length(T_n_node_neg_rand);
  408. Tmp_neg_rand = zeros(size(Mask_net));
  409. for i_com = 1:T_n_com_neg_rand
  410. T_ind_subn_neg_rand = find(T_ci_neg_rand == i_com);
  411. T_subn_neg_rand = T_suprathres_neg_rand(T_ind_subn_neg_rand,T_ind_subn_neg_rand);
  412. T_subn_neg_rand = triu(T_subn_neg_rand); % to support functional network analysis, that is, allow within-network self-connections
  413. T_size_neg_rand = sum(T_subn_neg_rand(:)); % to support functional network analysis, that is, allow within-network self-connections
  414. T_subn_neg_rand(T_subn_neg_rand~=0) = -(T_size_neg_rand^E)*(T_thr_neg_rand(i_thr)^H);
  415. T_subn_neg_rand = T_subn_neg_rand + triu(T_subn_neg_rand,1)';
  416. Tmp_neg_rand(T_ind_subn_neg_rand,T_ind_subn_neg_rand) = T_subn_neg_rand;
  417. end
  418. TFNBS_t_score_ipost_rand(:,:,i_thr) = Tmp_pos_rand + Tmp_neg_rand;
  419. end
  420. TFNBS_t_score_rand(:,:,i_post,i_per) = sum(TFNBS_t_score_ipost_rand,3);
  421. end
  422. end
  423. fprintf('%d permutation test(s) have been done\n', i_per);
  424. end
  425. %% calculate p values
  426. % FWE-corrected p values for TFNBS_f_score
  427. TFNBS_f_pval = zeros(size(Mask_net));
  428. for i_edge = 1:length(Ind_mask)
  429. TFNBS_f_pval(Ind_mask(i_edge)) = sum(max_TFNBS_f_score_rand > TFNBS_f_score(Ind_mask(i_edge)))/(M+1);
  430. end
  431. TFNBS_f_pval = TFNBS_f_pval + triu(TFNBS_f_pval,1)'; % to support functional network analysis, that is, allow within-network self-connections
  432. % calculate uncorrected, two-tailed p value for post hoc TFNBS_t_score
  433. TFNBS_t_pval = zeros([size(Mask_net),size(Post_Tvec,1)]);
  434. for i_post = 1:size(Post_Tvec,1)
  435. TFNBS_t_pval_i_post = zeros(size(Mask_net));
  436. for i_edge = 1:length(Ind_mask)
  437. [Row,Col] = ind2sub(size(Mask_net),Ind_mask(i_edge));
  438. TFNBS_t_score_rand_i_post_i_edge = squeeze(TFNBS_t_score_rand(Row,Col,i_post,:));
  439. TFNBS_t_pval_i_post(Row,Col) = sum(abs(TFNBS_t_score_rand_i_post_i_edge)>abs(TFNBS_t_score(Row,Col,i_post)))/(M+1);
  440. end
  441. TFNBS_t_pval_i_post = TFNBS_t_pval_i_post + triu(TFNBS_t_pval_i_post,1)'; % to support functional network analysis, that is, allow within-network self-connections
  442. TFNBS_t_pval(:,:,i_post) = TFNBS_t_pval_i_post;
  443. end
  444. % determine edges showing significant group effect
  445. Ind_sig_edge = find(TFNBS_f_pval(Ind_mask) < Pthr);
  446. N_sig_edge = length(Ind_sig_edge);
  447. [Reg_sig_edge(:,1),Reg_sig_edge(:,2)] = ind2sub(size(Mask_net),Ind_mask(Ind_sig_edge));
  448. TFNBS_f_score_sig_edge = TFNBS_f_score(Ind_mask(Ind_sig_edge));
  449. TFNBS_f_pval_sig_edge = TFNBS_f_pval(Ind_mask(Ind_sig_edge));
  450. TFNBS_t_score_sig_edge = zeros(N_sig_edge,size(Post_Tvec,1));
  451. TFNBS_t_pval_sig_edge = zeros(N_sig_edge,size(Post_Tvec,1));
  452. for i_post = 1:size(Post_Tvec,1)
  453. TFNBS_t_score_i_post = TFNBS_t_score(:,:,i_post);
  454. TFNBS_t_pval_i_post = TFNBS_t_pval(:,:,i_post);
  455. for i_edge = 1:N_sig_edge
  456. TFNBS_t_score_sig_edge(:,i_post) = TFNBS_t_score_i_post(Ind_mask(Ind_sig_edge));
  457. TFNBS_t_pval_sig_edge(:,i_post) = TFNBS_t_pval_i_post(Ind_mask(Ind_sig_edge));
  458. end
  459. end
  460. TFNBS_Result.Fmat = Fmat;
  461. TFNBS_Result.P_Fmat = P_Fmat;
  462. TFNBS_Result.DF_Fmat = DF_Fmat;
  463. TFNBS_Result.Tmat = Tmat;
  464. TFNBS_Result.P_Tmat = P_Tmat;
  465. TFNBS_Result.DF_Tmat = DF_Tmat;
  466. TFNBS_Result.TFNBS_f_score = TFNBS_f_score;
  467. TFNBS_Result.TFNBS_f_pval = TFNBS_f_pval;
  468. TFNBS_Result.TFNBS_t_score = TFNBS_t_score;
  469. TFNBS_Result.TFNBS_t_pval = TFNBS_t_pval;
  470. TFNBS_Result.N_sig_edge = N_sig_edge;
  471. TFNBS_Result.Reg_sig_edge = Reg_sig_edge;
  472. TFNBS_Result.TFNBS_f_score_sig_edge = TFNBS_f_score_sig_edge;
  473. TFNBS_Result.TFNBS_f_pval_sig_edge = TFNBS_f_pval_sig_edge;
  474. TFNBS_Result.TFNBS_t_score_sig_edge = TFNBS_t_score_sig_edge;
  475. TFNBS_Result.TFNBS_t_pval_sig_edge = TFNBS_t_pval_sig_edge;
  476. return

gretna_TFNBS_ftest.m, under CC-BY-4.0 · at the source

Overview

Authors: Jing Wang1, Jianshan Chen2,3, Ruilan Yang2, Junle Li1, Qiuxia Wu2, Jiaqi Sun2, Xiaofei Zhang2,3, Chanjuan Yang2, Jinhui Wang1,4,5,6,7, Liping Cao2,3
  1. Institute for Brain Research and Rehabilitation, South China Normal University, Guangzhou, China
  2. Department of Child and Adolescent Psychiatry, The Affiliated Brain Hospital, Guangzhou Medical University, Guangzhou, China
  3. Guangdong Engineering Technology Research Center for Translational Medicine of Mental Disorders, Guangzhou, China
  4. Key Laboratory of Brain, Cognition and Education Sciences (South China Normal University), Ministry of Education, Guangzhou, China
  5. Center for Studies of Psychological Application, South China Normal University, Guangzhou, China
  6. Guangdong Key Laboratory of Mental Health and Cognitive Science, South China Normal University, Guangzhou, China
  7. Philosophy and Social Science Laboratory of Reading and Development in Children and Adolescents (South China Normal University), Ministry of Education, Guangzhou, China
Journal: Communications biology, volume 9, issue 1, article 1003
Dates: received 15 September 2025; accepted 29 April 2026; published online 12 May 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s42003-026-10237-5 · PMID 42115418 · PMCID PMC13389048 · OpenAlex W7160829493
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: human (organism), depression (population), schizophrenia / psychosis (population), bipolar (population), developmental (subfield)
Methods: Statistics, Preprocessing, Connectivity, Graphs, fMRI & imaging
Keywords: Psychiatric disorders, Computational neuroscience
MeSH: Bipolar Disorder*, Brain*, Default Mode Network*, Major Depressive Disorder*, Schizophrenia*, Adolescent, Female, Humans, Magnetic Resonance Imaging, Male (* major topic)
Topic: Bipolar Disorder and Treatment (Psychiatry and Mental health, Medicine), according to OpenAlex
Funding: National Natural Science Foundation of China (National Science Foundation of China) (82371538, 82472092)
Citations: cited by 1 paper (Europe PMC); 91 references in the paper

Abstract

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

Repository

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

figshare 32049330

License: CC-BY-4.0
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Languages: MATLAB (13)
Size: 13 files, 13 scripts
Software Heritage: not checked
Found in: “Code availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: Statistics and Machine Learning Toolbox (4 files), SPM (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers (HTTP 200)
  • 28 September 2026: the link answers (HTTP 200)
13 files
At the source:

Code availability statement

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

  • it points to the authors' code: figshare 32049330
  • it says that the code is available on request

Read it in the paper: doi.org/10.1038/s42003-026-10237-5.

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;
  • 13 scripts, each with its path and the digest of its content;
  • 3 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

Datasets cited

Data availability statement

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

  • it points to a dataset: figshare 32034771
  • it says that the data are available on request

Read it in the paper: doi.org/10.1038/s42003-026-10237-5.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 1, 28 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 10 authors, 2 keywords, 10 MeSH terms, 1 funder, 89 references.

Cite

This paper

Wang, J., Chen, J., Yang, R., Li, J., Wu, Q., Sun, J., Zhang, X., Yang, C., Wang, J., & Cao, L. (2026). Shared subcortical-default mode morphological dysconnectivity in adolescent bipolar disorder, major depressive disorder and schizophrenia. Communications biology, 9(1), 1003. https://doi.org/10.1038/s42003-026-10237-5

BibTeX

@article{wang2026shared,
author = {Wang, Jing and Chen, Jianshan and Yang, Ruilan and Li, Junle and Wu, Qiuxia and Sun, Jiaqi and Zhang, Xiaofei and Yang, Chanjuan and Wang, Jinhui and Cao, Liping},
title = {{Shared subcortical-default mode morphological dysconnectivity in adolescent bipolar disorder, major depressive disorder and schizophrenia}},
journal = {Communications biology},
year = {2026},
month = may,
volume = {9},
number = {1},
pages = {1003},
publisher = {Nature Publishing Group},
issn = {2399-3642},
doi = {10.1038/s42003-026-10237-5},
url = {https://doi.org/10.1038/s42003-026-10237-5},
pmid = {42115418},
pmcid = {PMC13389048}
}

RIS

TY - JOUR
AU - Wang, Jing
AU - Chen, Jianshan
AU - Yang, Ruilan
AU - Li, Junle
AU - Wu, Qiuxia
AU - Sun, Jiaqi
AU - Zhang, Xiaofei
AU - Yang, Chanjuan
AU - Wang, Jinhui
AU - Cao, Liping
TI - Shared subcortical-default mode morphological dysconnectivity in adolescent bipolar disorder, major depressive disorder and schizophrenia
T2 - Communications biology
J2 - Commun Biol
PY - 2026
DA - 2026/05/12
VL - 9
IS - 1
SP - 1003
SN - 2399-3642
PB - Nature Publishing Group
DO - 10.1038/s42003-026-10237-5
UR - https://doi.org/10.1038/s42003-026-10237-5
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s42003-026-10237-5",
"type": "article-journal",
"title": "Shared subcortical-default mode morphological dysconnectivity in adolescent bipolar disorder, major depressive disorder and schizophrenia",
"container-title": "Communications biology",
"author": [
{
"family": "Wang",
"given": "Jing"
},
{
"family": "Chen",
"given": "Jianshan"
},
{
"family": "Yang",
"given": "Ruilan"
},
{
"family": "Li",
"given": "Junle"
},
{
"family": "Wu",
"given": "Qiuxia"
},
{
"family": "Sun",
"given": "Jiaqi"
},
{
"family": "Zhang",
"given": "Xiaofei"
},
{
"family": "Yang",
"given": "Chanjuan"
},
{
"family": "Wang",
"given": "Jinhui"
},
{
"family": "Cao",
"given": "Liping"
}
],
"container-title-short": "Commun Biol",
"volume": "9",
"issue": "1",
"page": "1003",
"DOI": "10.1038/s42003-026-10237-5",
"PMID": "42115418",
"PMCID": "PMC13389048",
"ISSN": "2399-3642",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s42003-026-10237-5",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
12
]
]
}
}

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.1002/gps3.70014 [code]
Correspondence between morphological similarity of the left lateral orbitofrontal cortex and neurotransmitter systems in adolescent males with autism.
Journal: General psychiatry
In common: SPM, Statistics and Machine Learning Toolbox, developmental, 8 references
[2] doi:10.1017/s0033291726104711
Cell-type and spatiotemporal transcriptional signatures of white matter morphometric similarity network alterations in major depressive disorder.
Journal: Psychological medicine
In common: depression, 8 references
[3] doi:10.1038/s41398-026-03965-z [code]
Disentangling individual heterogeneity reveals robust network and molecular signatures of major depressive disorder with suicidal ideation.
Journal: Translational psychiatry
In common: SPM, Statistics and Machine Learning Toolbox, depression, 6 references
[4] doi:10.1162/netn.a.553 [code]
MIND versus MSN: A systematic evaluation of test-retest reliability and age sensitivity for T1-weighted structural similarity networks.
Journal: Network neuroscience (Cambridge, Mass.)
In common: 7 references
[5] doi:10.1038/s41398-026-04025-2 [code]
Brain energetic landscapes shape state dysregulation in major depressive disorder: a morphological network controllability perspective.
Journal: Translational psychiatry
In common: SPM, Statistics and Machine Learning Toolbox, depression, 5 references
[6] doi:10.1038/s42003-026-10276-y [code]
The cellular correlates and adolescent reorganisation of cortical myelination networks in the common marmoset.
Journal: Communications biology
In common: SPM, Statistics and Machine Learning Toolbox, 5 references
[7] doi:10.1002/hbm.70605 [code]
BrainEnrich: Revealing Biological Insights for Imaging-Derived Phenotypes Through Transcriptomic Enrichment.
Journal: Human brain mapping
In common: SPM, Statistics and Machine Learning Toolbox, depression, 5 references
[8] doi:10.1038/s41398-026-04073-8 [code]
Functional connectivity density alterations in obsessive-compulsive disorder are associated with neurotransmitter and genetic profiles.
Journal: Translational psychiatry
In common: SPM, Statistics and Machine Learning Toolbox, 6 references
[9] doi:10.1038/s41593-026-02359-0 [code]
The cross-site reproducibility of MRI morphometric phenotypes in psychiatric disorders.
Journal: Nature neuroscience
In common: SPM, Statistics and Machine Learning Toolbox, schizophrenia / psychosis, 4 references
[10] doi:10.1038/s41531-026-01417-5 [code]
Correlation of thalamic functional organization disturbances and genetic architecture in motor subtypes of Parkinson's disease.
Journal: NPJ Parkinson's disease
In common: SPM, Statistics and Machine Learning Toolbox, 5 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.