├── aux
├── header.jpg
└── header.pdf
├── brain-network-models
├── 2-node-model-Python
│ ├── HRF_200Hz.mat
│ └── 2-node-model.py
├── large-scale-BNM-Python
│ └── HRF_200Hz.mat
├── MurrayJaramilloWang2017-Matlab
│ └── MurrayJaramilloWang2017_input_amplitude_correlation.m
└── multiscale-BNM-DM-Python
│ └── multiscale-BNM-DM.ipynb
├── data-preprocessing
├── demographics-behavioral-FC-SC
│ ├── excluded_subjects
│ │ ├── bvals_stats.mat
│ │ ├── excluded_subjects
│ │ └── fMRI_ERROR_subjects.txt
│ ├── SC
│ │ ├── step4_extractSC.m
│ │ ├── step1_generate_scripts.m
│ │ ├── step3_aggregateSC.m
│ │ ├── step2_generate_diffusion_mask.m
│ │ ├── subject_list.txt
│ │ └── region_sorting.txt
│ ├── BNM-input
│ │ ├── Generate_BNM_input_LREFFI.m
│ │ └── preprocess_HCP_data.m
│ └── FC
│ │ ├── step2_extract_FC.m
│ │ ├── step1_generate_scripts.m
│ │ ├── subject_list.txt
│ │ └── region_sorting.txt
└── g-factor
│ └── Dubois-etal
│ └── compute_g_factor_Dubois.ipynb
├── README.md
└── LICENSE
/aux/header.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrainModes/fast-slow/HEAD/aux/header.jpg
--------------------------------------------------------------------------------
/aux/header.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrainModes/fast-slow/HEAD/aux/header.pdf
--------------------------------------------------------------------------------
/brain-network-models/2-node-model-Python/HRF_200Hz.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrainModes/fast-slow/HEAD/brain-network-models/2-node-model-Python/HRF_200Hz.mat
--------------------------------------------------------------------------------
/brain-network-models/large-scale-BNM-Python/HRF_200Hz.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrainModes/fast-slow/HEAD/brain-network-models/large-scale-BNM-Python/HRF_200Hz.mat
--------------------------------------------------------------------------------
/data-preprocessing/demographics-behavioral-FC-SC/excluded_subjects/bvals_stats.mat:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrainModes/fast-slow/HEAD/data-preprocessing/demographics-behavioral-FC-SC/excluded_subjects/bvals_stats.mat
--------------------------------------------------------------------------------
/data-preprocessing/demographics-behavioral-FC-SC/excluded_subjects/excluded_subjects:
--------------------------------------------------------------------------------
1 | 105014 was excluded b/c response function parameters for WM, GM, CSF were heavy outliers
2 |
3 | ~113 subjects (see bvals_stats.mat) needed to be excluded because of missing or too few DWI gradient directions - only 787 subjects had the full 3 DWI shells
4 |
--------------------------------------------------------------------------------
/data-preprocessing/demographics-behavioral-FC-SC/excluded_subjects/fMRI_ERROR_subjects.txt:
--------------------------------------------------------------------------------
1 | 101410
2 | 116221
3 | 119732
4 | 119833
5 | 129937
6 | 140420
7 | 146634
8 | 150019
9 | 155231
10 | 159946
11 | 160931
12 | 168745
13 | 169747
14 | 170934
15 | 179548
16 | 179952
17 | 183337
18 | 193441
19 | 200210
20 | 284646
21 | 317332
22 | 351938
23 | 473952
24 | 492754
25 | 571548
26 | 751550
27 | 766563
28 | 786569
29 | 856463
30 | 972566
31 |
32 |
--------------------------------------------------------------------------------
/data-preprocessing/demographics-behavioral-FC-SC/SC/step4_extractSC.m:
--------------------------------------------------------------------------------
1 | function step4_extractSC(file_idx)
2 |
3 | connectome_folder = '/homeb/slns/slns019/HCP_MMP_Connectomes/SC/SC/';
4 | output_connectome_folder = '/homeb/slns/slns019/HCP_MMP_Connectomes/SC/SC_mat/';
5 |
6 | cd(connectome_folder)
7 | connectome_files = dir('*_SC.csv');
8 |
9 | connectome_w = load(connectome_files(file_idx).name);
10 | connectome_l = load([connectome_files(file_idx).name(1:end-4) '_len.csv']);
11 |
12 | SC.id = connectome_files(file_idx).name(1:6);
13 | SC.weights = zeros(size(connectome_w));
14 | SC.distances = zeros(size(connectome_w));
15 |
16 | for i1 = 1:size(connectome_w,1)
17 | for i2 = i1+1:size(connectome_w,2)
18 | SC.weights(i1,i2) = connectome_w(i1,i2);
19 | SC.weights(i2,i1) = connectome_w(i1,i2);
20 |
21 |
22 | SC.distances(i1,i2) = connectome_l(i1,i2);
23 | SC.distances(i2,i1) = connectome_l(i1,i2);
24 | end
25 | end
26 |
27 | output_file = [output_connectome_folder connectome_files(file_idx).name(1:end-4) '.mat'];
28 | save('-7',output_file,'SC')
29 |
30 |
31 | end
32 |
--------------------------------------------------------------------------------
/data-preprocessing/demographics-behavioral-FC-SC/SC/step1_generate_scripts.m:
--------------------------------------------------------------------------------
1 | clear
2 | close all
3 | clc
4 |
5 |
6 | subjects = load('subject_list.txt');
7 | cd('scripts')
8 | delete('*')
9 |
10 |
11 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
12 | % Step 1: Convert labels to volumes
13 | % wb_command -label-to-volume-mapping MMP_CORTEX_LEFT.label.gii 116726.L.white_MSMAll.32k_fs_LR.surf.gii T1w_acpc_dc_restore_brain.nii.gz CORTEX_LEFT_vol.nii -ribbon-constrained 116726.L.white_MSMAll.32k_fs_LR.surf.gii 116726.L.pial_MSMAll.32k_fs_LR.surf.gii
14 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15 |
16 | initstring = ['#!/bin/bash -x\n#SBATCH --nodes=1\n#SBATCH --ntasks=1\n#SBATCH --time=00:10:00\n#SBATCH --partition=batch\n'];
17 |
18 | connectome_folder = '/homeb/slns/slns019/HCP_MMP_Connectomes/SC/';
19 | hcp_data_folder = '/homec/hbu23/hbu231/_data/hcp_data/hcp/';
20 | label_folder = '/homeb/slns/slns019/HCP_MMP_Connectomes/SC/label_to_volume_mapping/';
21 | surf_folder = '/homeb/slns/slns019/hcp_data/';
22 | mmp_left_labels = [connectome_folder 'MMP_CORTEX_LEFT.label.gii'];
23 | mmp_right_labels = [connectome_folder 'MMP_CORTEX_RIGHT.label.gii'];
24 |
25 | break_counter = 0;
26 | preproc_patch = 0;
27 | fileID_batch = fopen('step1_label2volume','w');
28 | for ii = 1:length(subjects)
29 | if break_counter == 0
30 | command = initstring;
31 | end
32 | break_counter = break_counter + 2;
33 |
34 | white_left = [surf_folder num2str(subjects(ii)) '.L.white_MSMAll.32k_fs_LR.surf.gii'];
35 | white_right = [surf_folder num2str(subjects(ii)) '.R.white_MSMAll.32k_fs_LR.surf.gii'];
36 | pial_left = [surf_folder num2str(subjects(ii)) '.L.pial_MSMAll.32k_fs_LR.surf.gii'];
37 | pial_right = [surf_folder num2str(subjects(ii)) '.R.pial_MSMAll.32k_fs_LR.surf.gii'];
38 | T1w = [hcp_data_folder num2str(subjects(ii)) '/T1w/T1w_acpc_dc_restore_brain.nii.gz'];
39 | output_left = [label_folder num2str(subjects(ii)) '.LEFT_vol.nii'];
40 | output_right = [label_folder num2str(subjects(ii)) '.RIGHT_vol.nii'];
41 |
42 | command = [command 'srun -n 1 --exclusive wb_command -label-to-volume-mapping ' mmp_left_labels ' ' white_left ' ' T1w ' ' output_left ' -ribbon-constrained ' white_left ' ' pial_left ' &\n'];
43 | command = [command 'srun -n 1 --exclusive wb_command -label-to-volume-mapping ' mmp_right_labels ' ' white_right ' ' T1w ' ' output_right ' -ribbon-constrained ' white_right ' ' pial_right ' &\n'];
44 |
45 | if break_counter >= 24 || ii == length(subjects)
46 | preproc_patch = preproc_patch + 1;
47 | finalstring = [command '\nwait\n'];
48 | fileID = fopen(['step1_label2volume_' num2str(preproc_patch)],'w');
49 | fprintf(fileID,finalstring);
50 | fclose(fileID);
51 | fprintf(fileID_batch, ['sbatch step1_label2volume_' num2str(preproc_patch) '\n']);
52 | break_counter = 0;
53 | end
54 | end
55 | fclose(fileID_batch);
56 |
57 |
--------------------------------------------------------------------------------
/data-preprocessing/demographics-behavioral-FC-SC/SC/step3_aggregateSC.m:
--------------------------------------------------------------------------------
1 | % This script aggregates tractography output
2 | % Tractography was performed according to this tutorial:
3 | % https://mrtrix.readthedocs.io/en/latest/quantitative_structural_connectivity/ismrm_hcp_tutorial.html
4 |
5 | clear
6 | close all
7 | clc
8 |
9 |
10 | subjects = load('subject_list.txt');
11 | cd('scripts_step3')
12 |
13 |
14 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15 | % Map streamlines to the parcellated image to produce a connectome
16 | % tck2connectome 10M_SIFT.tck nodes_fixSGM.mif connectome.csv
17 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18 |
19 | %initstring = ['#!/bin/bash -x\n#SBATCH --nodes=1\n#SBATCH --ntasks=1\n#SBATCH --time=00:10:00\n#SBATCH --partition=batch\nmodule load GCC/5.4.0\nmodule load MRtrix/0.3.15-Python-2.7.14\n\n'];
20 | initstring = ['#!/bin/bash -x\n#SBATCH --nodes=1\n#SBATCH --ntasks=1\n#SBATCH --time=00:20:00\n#SBATCH --partition=batch\nmodule use /usr/local/software/jureca/OtherStages\nmodule load Stages/2017a\nmodule load Stages/2016b GCC/5.4.0\nmodule load MRtrix/0.3.15-Python-2.7.12\n\n'];
21 |
22 | connectome_folder = '/homeb/slns/slns019/HCP_MMP_Connectomes/SC/SC/';
23 | sift_weights_folder = '/work/hbu23/hbu231/HCP_tracks_sift2/';
24 | tracks_folder = '/work/hbu23/hbu231/archHCPtcks/';
25 | parc_folder = '/homeb/slns/slns019/HCP_MMP_Connectomes/SC/diffusion_masks/';
26 |
27 |
28 | break_counter = 0;
29 | preproc_patch = 0;
30 | fileID_batch = fopen('step3_tck2connectome','w');
31 | for ii = 1:length(subjects)
32 | if break_counter == 0
33 | command = initstring;
34 | end
35 | break_counter = break_counter + 2;
36 |
37 | tck_file = [tracks_folder num2str(subjects(ii)) '_25M_tracks.tck'];
38 | siftweights_file = [sift_weights_folder num2str(subjects(ii)) '/' num2str(subjects(ii)) '_25M_tracks_weights.txt'];
39 | parc = [parc_folder num2str(subjects(ii)) '.diffmask_MMP.nii'];
40 | connectome = [connectome_folder num2str(subjects(ii)) '_SC.csv'];
41 | connectome_len = [connectome_folder num2str(subjects(ii)) '_SC_len.csv'];
42 |
43 | command = [command 'srun -n 1 --exclusive -c 1 tck2connectome -tck_weights_in ' siftweights_file ' ' tck_file ' ' parc ' ' connectome ' -nthreads 1 -force &\n'];
44 | command = [command 'srun -n 1 --exclusive -c 1 tck2connectome -scale_length -stat_edge mean -tck_weights_in ' siftweights_file ' ' tck_file ' ' parc ' ' connectome_len ' -nthreads 1 -force &\n'];
45 |
46 | if break_counter >= 48 || ii == length(subjects)
47 | preproc_patch = preproc_patch + 1;
48 | finalstring = [command '\nwait\n'];
49 | fileID = fopen(['step3_tck2connectome_' num2str(preproc_patch)],'w');
50 | fprintf(fileID,finalstring);
51 | fclose(fileID);
52 | fprintf(fileID_batch, ['sbatch step3_tck2connectome_' num2str(preproc_patch) '\n']);
53 | break_counter = 0;
54 | end
55 | end
56 | fclose(fileID_batch);
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/data-preprocessing/demographics-behavioral-FC-SC/BNM-input/Generate_BNM_input_LREFFI.m:
--------------------------------------------------------------------------------
1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 | % Convert structural and functional connectome into BNM-C readable input
3 | %
4 | %
5 | % Input:
6 | % SC weights, distances, FC
7 | %
8 | % Output:
9 | % - BNM-C input files (five files: weights, distances, reg_ids, FC reduced, FC full)
10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
11 |
12 | function Generate_BNM_input_LREFFI(subject_ID, FC, SC, SC_len, output_filestem)
13 |
14 | % Write first header line: number of regions
15 | SCsize = length(SC);
16 | dlmwrite([output_filestem subject_ID '_SC_strengths.txt'],SCsize);
17 | dlmwrite([output_filestem subject_ID '_SC_distances.txt'],SCsize);
18 | dlmwrite([output_filestem subject_ID '_SC_regionids.txt'],SCsize);
19 | dlmwrite([output_filestem subject_ID '_FC.txt'],SCsize);
20 | dlmwrite([output_filestem subject_ID '_FCfull.txt'],'');
21 |
22 | % Write second header line in dist-file: maximum distance
23 | %maxdist=1;
24 | maxdist=max(SC_len(:));
25 | dlmwrite([output_filestem subject_ID '_SC_distances.txt'],maxdist,'delimiter',' ','-append');
26 |
27 | % Write SC
28 | for ii = 1:length(SC)
29 | % Format connectivity
30 | inpregs = find(SC(ii,:)>0);
31 | inpcaps = SC(ii,inpregs);
32 | inpFC = FC(ii,inpregs);
33 | %inpdists = ones(1,length(inpregs)); % CAUTION: NO TIME-DELAYS!
34 | inpdists = SC_len(ii,inpregs);
35 | inpregs = inpregs-1; % to get C style numbering of region indices
36 |
37 | % Alternatly write line with region id and number of incoming
38 | % connections ...
39 | cap_line = [(ii-1) length(inpregs)];
40 | dist_line = [(ii-1) length(inpregs)];
41 | inp_line = [(ii-1) length(inpregs)];
42 | FC_line = [(ii-1) length(inpregs)];
43 | dlmwrite([output_filestem subject_ID '_SC_strengths.txt'],cap_line, 'delimiter',' ','-append');
44 | dlmwrite([output_filestem subject_ID '_SC_distances.txt'],dist_line, 'delimiter',' ','-append');
45 | dlmwrite([output_filestem subject_ID '_SC_regionids.txt'],inp_line, 'delimiter',' ','-append');
46 | dlmwrite([output_filestem subject_ID '_FC.txt'], FC_line, 'delimiter',' ','-append');
47 |
48 | % ... and actual connectivity information
49 | dlmwrite([output_filestem subject_ID '_SC_strengths.txt'],inpcaps, 'delimiter',' ','-append','precision','%.8f');
50 | dlmwrite([output_filestem subject_ID '_SC_distances.txt'],inpdists, 'delimiter',' ','-append','precision','%.8f');
51 | dlmwrite([output_filestem subject_ID '_SC_regionids.txt'],inpregs, 'delimiter',' ','-append');
52 | dlmwrite([output_filestem subject_ID '_FC.txt'], inpFC, 'delimiter',' ','-append');
53 |
54 | % write full FC line
55 | dlmwrite([output_filestem subject_ID '_FCfull.txt'], FC(ii,:), 'delimiter',' ','-append');
56 | end
57 |
58 | end
59 |
60 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | # Learning how network structure shapes decision-making for bio-inspired computing
12 | ## Excitation-inhibition balance fitting of brain network models
13 |
14 | Michael Schirner, Gustavo Deco & Petra Ritter
15 | Berlin Institute of Health at Charité – Universitätsmedizin Berlin
16 | Universitat Pompeu Fabra
17 |
18 | Contact: [Michael Schirner](mailto:michael.schirner@bih-charite.de) and [Petra Ritter](mailto:petra.ritter@bih-charite.de).
19 | Brain Simulation Group: [brainsimulation.org](https://www.brainsimulation.org/)
20 |
21 | ## Overview
22 |
23 | Complete code for Schirner, Deco & Ritter, "**Learning how network structure shapes decision-making for bio-inspired computing**", Nature Communications (2023).
24 | In this study we developed a new fitting algorithm for brain network models based on the Excitation-Inhibition balance between simulated brain areas. The algorithm fits brain models to empirical functional connectivity, based on a structural network description (typically obtained via diffusion-weighted MRI tractography).
25 |
26 | ## Contents
27 |
28 | - brain-network-models/
29 | - Brain network model simulation code in C, Python and MATLAB
30 | - data-preprocessing/
31 | - Code for processing of SC, FC, brain model input, and g-factor (Note: the code for computing the g-factor was adapted from Dubois et al. https://doi.org/10.1098/rstb.2017.0284)
32 |
33 | ## Usage
34 |
35 | - **Large- and multi-scale model**: Both the large-scale model (379-regions full-brain parcellation based on Glasser/Human Connectome Project Atlas) and the multiscale model (PFC and PPC regions of the large-scale model are coupled to the DM circuit) are implemented in Python and C versions (see folder `brain-network-models`). We recommend to start with the Python version for initial familiarization as it is more easily readable than the C code which contains numerous optimizations for fast execution.
36 | - **Compilation:** To compile the C code any current C compiler can be used (explicit linking with the `math.h` library needed, e.g. via `-lm`). For this study we used `GCC 9.4` with the following command:
37 | ```
38 | gcc -Wall -Wextra -pedantic -std=c99 -msse2 -O3 -ftree-vectorize -ffast-math -funroll-loops -fomit-frame-pointer -m64 -lm -pthread multiscale-BNM-DM.c -o multiscale-BNM-DM
39 | ```
40 | - **Input data**: Empirical connectome matrices (structural connectivity and functional connectivity) are brought into input format via the scripts `preprocess_HCP_data.m` and `Generate_BNM_input_LREFFI.m`.
41 | - **MRI Processing**:
42 | - **Structural connectivity (SC):** the scripts `step1_generate_scripts.m`, `step2_generate_diffusion_mask.m`, `step3_aggregateSC.m`, `step4_extractSC.m` provide the workflow to perform diffusion-weighted MRI tractography with [MRtrix](https://www.mrtrix.org/) on HCP data.
43 | - **Functional connectivity (FC):** the scripts `step1_generate_scripts.m` and `step2_extract_FC.m` perform the workflow to extract region-average fMRI time series and compute FC matrices.
44 |
45 | ## Data
46 |
47 | All data used in this study was derived from the Human Connectome Project Young Adult study available in the repository https://db.humanconnectome.org/data/projects/HCP_1200. The derived data generated in this study are available under restricted access due to data privacy laws, access can be obtained within a timeframe of one month from the corresponding authors M.S. and P.R. as processing and sharing is subject to the European Union General Data Protection Regulation (GDPR), requiring a written data processing agreement, involving the relevant local data protection authorities, for compliance with the standard contractual clauses by the European Commission for the processing of personal data under GDPR ([https://commission.europa.eu/publications/standard-contractual-clauses-controllers-and-processors-eueea_en](https://commission.europa.eu/publications/standard-contractual-clauses-controllers-and-processors-eueea_en)). The data processing agreement and dataset metadata are available in EBRAINS ([https://search.kg.ebrains.eu/instances/88507924-8509-419f-8900-109accf1414b](https://search.kg.ebrains.eu/instances/88507924-8509-419f-8900-109accf1414b)).
48 |
49 | ## License
50 |
51 | Copyright © 2023 Charité Universitätsmedizin Berlin. This software includes technology that is the subject of pending patent application No. 23 166 587.8 at the European Patent Office. The patent application has been filed by the Charité Universitätsmedizin Berlin. This software is licensed under the terms of the European Union Public Licence (EUPL) version 1.2 or later.
52 |
53 | Please cite the Nature Communications paper when using the software.
54 |
--------------------------------------------------------------------------------
/data-preprocessing/demographics-behavioral-FC-SC/SC/step2_generate_diffusion_mask.m:
--------------------------------------------------------------------------------
1 | function step2_generate_diffusion_mask(sub_id)
2 |
3 | % Generate Diffusion Mask
4 |
5 | % Step 1: Clean aparc+aseg.nii.gz such that only subcortical structures
6 | % remain
7 |
8 | % Step 2: Merge cortical and subcortical volumes
9 |
10 |
11 | % Add NIFTI tools or FreeSurfer Matlab folder to Matlab path
12 | addpath(genpath('/homec/hbu23/hbu231/Octave_include/NIFTI'));
13 |
14 | % Include the following subcortical structures
15 |
16 | subcortical_regions = [8;10;11;12;13;16;17;18;26;28;47;49;50;51;52;53;54;58;60];
17 |
18 | % FreeSurfer Color LUT
19 | % https://surfer.nmr.mgh.harvard.edu/fswiki/FsTutorial/AnatomicalROI/FreeSurferColorLUT
20 | % old_id region_label new_id
21 | % 8 Left-Cerebellum-Cortex --> 361
22 | % 10 Left-Thalamus-Proper --> 362
23 | % 11 Left-Caudate --> 363
24 | % 12 Left-Putamen --> 364
25 | % 13 Left-Pallidum --> 365
26 | % 16 Brain-Stem --> 379
27 | % 17 Left-Hippocampus --> 366
28 | % 18 Left-Amygdala --> 367
29 | % 26 Left-Accumbens-area --> 368
30 | % 28 Left-VentralDC --> 369
31 | % 47 Right-Cerebellum-Cortex --> 370
32 | % 49 Right-Thalamus-Proper --> 371
33 | % 50 Right-Caudate --> 372
34 | % 51 Right-Putamen --> 373
35 | % 52 Right-Pallidum --> 374
36 | % 53 Right-Hippocampus --> 375
37 | % 54 Right-Amygdala --> 376
38 | % 58 Right-Accumbens-area --> 377
39 | % 60 Right-VentralDC --> 378
40 |
41 |
42 | % Load cortical/subcortical segmentation
43 | aparc_file = ['/homec/hbu23/hbu231/_data/hcp_data/hcp/' num2str(sub_id) '/T1w/aparc+aseg.nii'];
44 | aparcaseg = load_untouch_nii(aparc_file,[],[],[],[],[],[]);
45 |
46 |
47 | % Set all voxel labels to zero that do not belong to a subcortical
48 | % structure
49 | aparcaseg.img(~ismember(aparcaseg.img, subcortical_regions)) = 0;
50 |
51 |
52 | % Assign new ids to subcortical structures in order to not interfere with
53 | % HCP MMP1.0 Atlas (360 regions)
54 | % Note that brainstem is moved to the end
55 |
56 | subcortical_regions = [8;10;11;12;13;17;18;26;28;47;49;50;51;52;53;54;58;60;16];
57 |
58 | idx_subcort = 361;
59 | for ii = subcortical_regions'
60 | aparcaseg.img(aparcaseg.img == ii) = idx_subcort;
61 | idx_subcort = idx_subcort + 1;
62 | end
63 |
64 | %save_untouch_nii(aparcaseg, 'aparc+aseg_MMP.nii.gz');
65 | subcortex = aparcaseg;
66 |
67 | % Load three segmentation volumes
68 | %subcortex = load_untouch_nii('aparc+aseg_MMP.nii');
69 | cortex_left_file = ['/homeb/slns/slns019/HCP_MMP_Connectomes/SC/label_to_volume_mapping/' num2str(sub_id) '.LEFT_vol.nii'];
70 | cortex_left = load_untouch_nii(cortex_left_file,[],[],[],[],[],[]);
71 | cortex_right_file = ['/homeb/slns/slns019/HCP_MMP_Connectomes/SC/label_to_volume_mapping/' num2str(sub_id) '.RIGHT_vol.nii'];
72 | cortex_right = load_untouch_nii(cortex_right_file,[],[],[],[],[],[]);
73 |
74 |
75 | % Some border voxels of the subcortical segmentation (Hippocampus and Cerebellum)
76 | % overlap with MMP parcellation, also some right/and left MMP cortex voxels overlap
77 | % -> since they cannot be assigned to a single region: clean these voxels
78 | % out of all masks
79 | sc = subcortex.img;
80 | lc = cortex_left.img;
81 | rc = cortex_right.img;
82 |
83 | lc(lc>0) = 1;
84 | rc(rc>0) = 1;
85 | sc(sc>0) = 1;
86 | overlap = lc+rc+sc;
87 | overlap = find(overlap > 1);
88 |
89 | subcortex.img(overlap) = 0;
90 | cortex_left.img(overlap) = 0;
91 | cortex_right.img(overlap) = 0;
92 |
93 | % Merge masks
94 | cortex_left.img = cortex_left.img + cortex_right.img + subcortex.img;
95 |
96 | % Save result
97 | output_diffusion_mask_file = ['/homeb/slns/slns019/HCP_MMP_Connectomes/SC/diffusion_masks/' num2str(sub_id) '.diffmask_MMP.nii'];
98 | save_untouch_nii(cortex_left, output_diffusion_mask_file);
99 |
100 | end
101 |
102 | %%
103 | % clear
104 | % clc
105 | % close all
106 | % cd('/Users/michael/Desktop/HCP_project/MMP_Connectomes/SC/scripts/')
107 | % subjects = load('/Users/michael/Desktop/HCP_project/subject_list.txt');
108 | %
109 | % initstring = ['#!/bin/bash -x\n#SBATCH --nodes=1\n#SBATCH --ntasks=1\n#SBATCH --time=00:10:00\n#SBATCH --partition=batch\nmodule load GCC/7.2.0 ParaStationMPI/5.2.0-1\nmodule load Octave/4.2.1\n\n'];
110 | % batch_line = 'srun -n 1 octave --eval "step2_generate_diffusion_mask(';
111 | % fileID_start = fopen(['step2_diffmask'],'w');
112 | %
113 | %
114 | % break_counter = 0;
115 | % preproc_patch = 0;
116 | % for ii = 1:length(subjects)
117 | % if break_counter == 0
118 | % command = initstring;
119 | % end
120 | % break_counter = break_counter + 1;
121 | %
122 | % command = [command batch_line num2str(subjects(ii)) ')" &\n'];
123 | % display(['gunzip /homec/hbu23/hbu231/_data/hcp_data/hcp/' num2str(subjects(ii)) '/T1w/aparc+aseg.nii.gz'])
124 | %
125 | % if break_counter == 24 || ii == length(subjects)
126 | % preproc_patch = preproc_patch + 1;
127 | % finalstring = [command '\nwait\n'];
128 | % fileID = fopen(['step2_diffmask_' num2str(preproc_patch)],'w');
129 | % fprintf(fileID,finalstring);
130 | % fclose(fileID);
131 | % fprintf(fileID_start, ['sbatch step2_diffmask_' num2str(preproc_patch) '\n']);
132 | % break_counter = 0;
133 | % end
134 | % end
135 | %
136 | % fclose(fileID_start)
137 | %
138 | %
139 | %
140 |
--------------------------------------------------------------------------------
/brain-network-models/MurrayJaramilloWang2017-Matlab/MurrayJaramilloWang2017_input_amplitude_correlation.m:
--------------------------------------------------------------------------------
1 | % MurrayJaramilloWang JNeuro 2017 model equations
2 | function return_table=MurrayJaramilloWang2017_input_amplitude_correlation(corr_val_inp)
3 |
4 | rng default % Reset random number generator
5 | %rng(seed)
6 |
7 | % Simulation parameters
8 |
9 | dt = 1;
10 | ts = 3000; % (ms) simulation time
11 | tss = length(1:dt:ts);
12 |
13 |
14 |
15 | % Model parameters
16 | tau = 60; % (ms) NMDA time constant
17 | gamma = 0.641; % rate of saturation of S
18 | I_0 = 0.334; % (nA) background current
19 | tau_AMPA = 2; % (ms) AMPA noise time constant
20 | sigma_noise = 0.009; % (nA) noise strength
21 |
22 |
23 | % Connection weights
24 | % Population sorting A_1, B_1, A_2, B_2
25 | % Local Module 1:
26 | % J_same = (J_S + J_T) / 2 = (0.35 + 0.28387) / 2 = 0.3169
27 | % J_diff = J_T - J_same = 0.28387 - 0.3169 = -0.0330
28 | % Local Module 2:
29 | % J_same = (J_S + J_T) / 2 = (0.4182 + 0.28387) / 2 = 0.351
30 | % J_diff = J_T - J_same = 0.28387 - 0.351 = -0.0671
31 | % Long-range Module 1 -> Module 2:
32 | % J_same = (J_S + J_T) / 2 = (0.15 + 0) / 2 = 0.075
33 | % J_diff = J_T - J_same = 0 - 0.0750 = -0.075
34 | % Long-range Module 1 -> Module 1:
35 | % J_same = (J_S + J_T) / 2 = (0.04 + 0) / 2 = 0.02
36 | % J_diff = J_T - J_same = 0 - 0.0200 = -0.02
37 |
38 |
39 | N = 5000;
40 |
41 | % output variables
42 | S_outA1 = zeros(ts,N);
43 | S_outB1 = zeros(ts,N);
44 | S_outA2 = zeros(ts,N);
45 | S_outB2 = zeros(ts,N);
46 |
47 | J_same_M1 = 0.3169;
48 | J_diff_M1 = -0.0330;
49 | J_same_M2 = 0.351;
50 | J_diff_M2 = -0.0671;
51 |
52 | J_same_M1_to_M2 = 0.075;
53 | J_diff_M1_to_M2 = -0.075;
54 | J_same_M2_to_M1 = 0.02;
55 | J_diff_M2_to_M1 = -0.02;
56 |
57 | % Model variables
58 | S_A1 = zeros(N,1);
59 | S_B1 = zeros(N,1);
60 | S_A2 = zeros(N,1);
61 | S_B2 = zeros(N,1);
62 | I_noiseCC= zeros(N,1);
63 | I_noiseA = zeros(N,1);
64 | I_noiseB = zeros(N,1);
65 | I_noiseA2= zeros(N,1);
66 | I_noiseB2= zeros(N,1);
67 |
68 |
69 | %current_add = repmat(current_add,N_noise,1);
70 | contr = 0.2;
71 | %corr_val = 0:0.1:1;
72 | %corr_val = repmat(corr_val',1000,1);
73 | corr_val = corr_val_inp;
74 |
75 | for ii = 1:tss
76 |
77 | if ii > 500 && ii < 2000
78 | %I_appA = linspace(0.0, 0.07, N)';
79 | I_appA = 0.0118 * (1 + contr / 100);
80 | I_appB = 0.0118 * (1 - contr / 100);
81 | else
82 | I_appA = 0.0;
83 | I_appB = 0.0;
84 | end
85 |
86 | I_noiseCC = I_noiseCC + dt * ( (-I_noiseCC + randn(N,1) * sqrt(tau_AMPA * sigma_noise.^2)) ./ tau_AMPA );
87 | I_noiseA = I_noiseA + dt * ( (-I_noiseA + randn(N,1) * sqrt(tau_AMPA * sigma_noise.^2)) ./ tau_AMPA );
88 | I_noiseB = I_noiseB + dt * ( (-I_noiseB + randn(N,1) * sqrt(tau_AMPA * sigma_noise.^2)) ./ tau_AMPA );
89 | I_noiseA2 = I_noiseA2 + dt * ( (-I_noiseA2 + randn(N,1) * sqrt(tau_AMPA * sigma_noise.^2)) ./ tau_AMPA );
90 | I_noiseB2 = I_noiseB2 + dt * ( (-I_noiseB2 + randn(N,1) * sqrt(tau_AMPA * sigma_noise.^2)) ./ tau_AMPA );
91 |
92 | % Generate correlated input noise
93 | I_noiseAf = corr_val .* I_noiseCC + (1 - corr_val) .* I_noiseA;
94 | I_noiseBf = corr_val .* I_noiseCC + (1 - corr_val) .* I_noiseB;
95 | I_noiseAf2= corr_val .* I_noiseCC + (1 - corr_val) .* I_noiseA2;
96 | I_noiseBf2= corr_val .* I_noiseCC + (1 - corr_val) .* I_noiseB2;
97 |
98 | % set input amplitude offsets
99 | curr_addPPC = +0.00;
100 | curr_addPFC = -0.00;
101 |
102 | % input currents
103 | I_A1 = J_same_M1 .* S_A1 + J_diff_M1 .* S_B1 + J_same_M2_to_M1 .* S_A2 + J_diff_M2_to_M1 .* S_B2 + I_0 + I_noiseAf + I_appA + curr_addPPC;
104 | I_B1 = J_diff_M1 .* S_A1 + J_same_M1 .* S_B1 + J_diff_M2_to_M1 .* S_A2 + J_same_M2_to_M1 .* S_B2 + I_0 + I_noiseBf + I_appB + curr_addPPC;
105 | I_A2 = J_same_M1_to_M2 .* S_A1 + J_diff_M1_to_M2 .* S_B1 + J_same_M2 .* S_A2 + J_diff_M2 .* S_B2 + I_0 + I_noiseAf2 + curr_addPFC;
106 | I_B2 = J_diff_M1_to_M2 .* S_A1 + J_same_M1_to_M2 .* S_B1 + J_diff_M2 .* S_A2 + J_same_M2 .* S_B2 + I_0 + I_noiseBf2 + curr_addPFC;
107 |
108 | % synaptic activity
109 | S_A1 = S_A1 + dt * ( -S_A1 / tau + gamma * (1 - S_A1) .* r(I_A1) / 1000);
110 | S_B1 = S_B1 + dt * ( -S_B1 / tau + gamma * (1 - S_B1) .* r(I_B1) / 1000);
111 | S_A2 = S_A2 + dt * ( -S_A2 / tau + gamma * (1 - S_A2) .* r(I_A2) / 1000);
112 | S_B2 = S_B2 + dt * ( -S_B2 / tau + gamma * (1 - S_B2) .* r(I_B2) / 1000);
113 |
114 | %S(S<0) = 0;
115 | %S(S>1) = 1;
116 |
117 | S_outA1(ii,:) = r(I_A1);
118 | S_outB1(ii,:) = r(I_B1);
119 | S_outA2(ii,:) = r(I_A2);
120 | S_outB2(ii,:) = r(I_B2);
121 | end
122 |
123 |
124 | correct_response = mean(S_outA1(end-200:end,:)) > 20 & mean(S_outB1(end-200:end,:)) < 20;
125 | %correct_response_r = reshape(correct_response,11,1000)';
126 |
127 | wrong_response = mean(S_outB1(end-200:end,:)) > 20 & mean(S_outA1(end-200:end,:)) < 20;
128 | %wrong_response_r = reshape(wrong_response,11,1000)';
129 |
130 | return_table = mean(correct_response);
131 |
132 | end
133 |
134 | % input currents to firing rates
135 | function phi = r(I)
136 | a = 270; % (Hz/nA)
137 | b = 108; % (Hz)
138 | c = 0.154; % (s)
139 |
140 | phi = (a .* I - b) ./ (1 - exp(-c .* (a .* I - b)));
141 | end
142 |
143 |
--------------------------------------------------------------------------------
/data-preprocessing/demographics-behavioral-FC-SC/FC/step2_extract_FC.m:
--------------------------------------------------------------------------------
1 | function step2_extract_FC(sub_ii)
2 |
3 | %%%%%%%%%%%%%%%%%%%%%%%
4 | % Mapping between atlases
5 | %%%%%%%%%%%%%%%%%%%%%%%
6 | %
7 | % ROIs 1 to 360 from MMP
8 | % ROIs 361 to 379 from Atlas_ROIs.2.dlabel.nii
9 |
10 | %{
11 |
12 | ************************
13 | Sorting in SC
14 | ************************
15 | % 1. 8 Left-Cerebellum-Cortex --> 361
16 | % 2. 10 Left-Thalamus-Proper --> 362
17 | % 3. 11 Left-Caudate --> 363
18 | % 4. 12 Left-Putamen --> 364
19 | % 5. 13 Left-Pallidum --> 365
20 | % 6. 16 Brain-Stem --> 379
21 | % 7. 17 Left-Hippocampus --> 366
22 | % 8. 18 Left-Amygdala --> 367
23 | % 9. 26 Left-Accumbens-area --> 368
24 | % 10.28 Left-VentralDC --> 369
25 | % 11.47 Right-Cerebellum-Cortex --> 370
26 | % 12.49 Right-Thalamus-Proper --> 371
27 | % 13.50 Right-Caudate --> 372
28 | % 14.51 Right-Putamen --> 373
29 | % 15.52 Right-Pallidum --> 374
30 | % 16.53 Right-Hippocampus --> 375
31 | % 17.54 Right-Amygdala --> 376
32 | % 18.58 Right-Accumbens-area --> 377
33 | % 19.60 Right-VentralDC --> 378
34 |
35 |
36 | ************************
37 | Sorting in ptseries file
38 | ************************
39 | Parcel 1: CEREBELLUM_LEFT
40 | 8709 voxels
41 | Parcel 2: THALAMUS_LEFT
42 | 1288 voxels
43 | Parcel 3: CAUDATE_LEFT
44 | 728 voxels
45 | Parcel 4: PUTAMEN_LEFT
46 | 1060 voxels
47 | Parcel 5: PALLIDUM_LEFT
48 | 297 voxels
49 | Parcel 6: BRAIN_STEM
50 | 3472 voxels
51 | Parcel 7: HIPPOCAMPUS_LEFT
52 | 764 voxels
53 | Parcel 8: AMYGDALA_LEFT
54 | 315 voxels
55 | Parcel 9: ACCUMBENS_LEFT
56 | 135 voxels
57 | Parcel 10: DIENCEPHALON_VENTRAL_LEFT
58 | 706 voxels
59 | Parcel 11: CEREBELLUM_RIGHT
60 | 9144 voxels
61 | Parcel 12: THALAMUS_RIGHT
62 | 1248 voxels
63 | Parcel 13: CAUDATE_RIGHT
64 | 755 voxels
65 | Parcel 14: PUTAMEN_RIGHT
66 | 1010 voxels
67 | Parcel 15: PALLIDUM_RIGHT
68 | 260 voxels
69 | Parcel 16: HIPPOCAMPUS_RIGHT
70 | 795 voxels
71 | Parcel 17: AMYGDALA_RIGHT
72 | 332 voxels
73 | Parcel 18: ACCUMBENS_RIGHT
74 | 140 voxels
75 | Parcel 19: DIENCEPHALON_VENTRAL_RIGHT
76 | 712 voxels
77 | %}
78 | %%%%%%%%%%%%%%%%%%%%%%%
79 | %%%%%%%%%%%%%%%%%%%%%%%
80 |
81 | connectome_folder = '/homeb/slns/slns019/HCP_MMP_Connectomes/FC/extracted_ptseries_txt/';
82 | cd(connectome_folder)
83 | subjects = load('/homec/hbu23/hbu231/HCP_Connectomes/SC/subject_list.txt');
84 |
85 | SC_indices = [361:365 379 366:378];
86 | pt_indices = [1:5 7:19 6];
87 |
88 |
89 | for ii = sub_ii
90 | try
91 | FC.id = subjects(ii);
92 | fMRI.id = subjects(ii);
93 |
94 | ts_MMP_REST1_LR = load([num2str(subjects(ii)) '_FC_REST1_LR_MMP.ptseries.txt']);
95 | ts_subco_REST1_LR = load([num2str(subjects(ii)) '_FC_REST1_LR_subcort.ptseries.txt']);
96 | ts_MMP_REST1_RL = load([num2str(subjects(ii)) '_FC_REST1_RL_MMP.ptseries.txt']);
97 | ts_subco_REST1_RL = load([num2str(subjects(ii)) '_FC_REST1_RL_subcort.ptseries.txt']);
98 | ts_MMP_REST2_LR = load([num2str(subjects(ii)) '_FC_REST2_LR_MMP.ptseries.txt']);
99 | ts_subco_REST2_LR = load([num2str(subjects(ii)) '_FC_REST2_LR_subcort.ptseries.txt']);
100 | ts_MMP_REST2_RL = load([num2str(subjects(ii)) '_FC_REST2_RL_MMP.ptseries.txt']);
101 | ts_subco_REST2_RL = load([num2str(subjects(ii)) '_FC_REST2_RL_subcort.ptseries.txt']);
102 |
103 |
104 | fMRI.MMP_REST1_LR = [ts_MMP_REST1_LR; ts_subco_REST1_LR(pt_indices,:)]';
105 | fMRI.MMP_REST1_RL = [ts_MMP_REST1_RL; ts_subco_REST1_RL(pt_indices,:)]';
106 | fMRI.MMP_REST2_LR = [ts_MMP_REST2_LR; ts_subco_REST2_LR(pt_indices,:)]';
107 | fMRI.MMP_REST2_RL = [ts_MMP_REST2_RL; ts_subco_REST2_RL(pt_indices,:)]';
108 |
109 | FC.MMP_REST1_LR = corr(fMRI.MMP_REST1_LR);
110 | FC.MMP_REST1_RL = corr(fMRI.MMP_REST1_RL);
111 | FC.MMP_REST2_LR = corr(fMRI.MMP_REST2_LR);
112 | FC.MMP_REST2_RL = corr(fMRI.MMP_REST2_RL);
113 |
114 | FC.MMP_REST1_LR_fisherz = atanh(FC.MMP_REST1_LR);
115 | FC.MMP_REST1_RL_fisherz = atanh(FC.MMP_REST1_RL);
116 | FC.MMP_REST2_LR_fisherz = atanh(FC.MMP_REST2_LR);
117 | FC.MMP_REST2_RL_fisherz = atanh(FC.MMP_REST2_RL);
118 |
119 | tmp = (FC.MMP_REST1_LR_fisherz + FC.MMP_REST1_RL_fisherz + FC.MMP_REST2_LR_fisherz + FC.MMP_REST2_RL_fisherz) / 4;
120 | n=size(tmp,1);
121 | tmp(1:n+1:n*n)=0;
122 | FC.MMP_fisherz_avg = tmp;
123 |
124 |
125 | tmp = (FC.MMP_REST1_LR + FC.MMP_REST1_RL + FC.MMP_REST2_LR + FC.MMP_REST2_RL) / 4;
126 | n=size(tmp,1);
127 | tmp(1:n+1:n*n)=0;
128 | FC.MMP_avg = tmp;
129 |
130 | save('-7',['/homeb/slns/slns019/HCP_MMP_Connectomes/FC/FC/' num2str(subjects(ii)) '_MMP_fMRI.mat'],'fMRI')
131 | save('-7',['/homeb/slns/slns019/HCP_MMP_Connectomes/FC/FC/' num2str(subjects(ii)) '_MMP_FC.mat'],'FC')
132 |
133 |
134 | catch me
135 | display([num2str(subjects(ii)) ': ' me.identifier])
136 | end
137 |
138 |
139 | end
140 |
141 |
142 |
143 | end
144 |
145 |
146 | %%
147 | %
148 | % cd('/Users/michael/Desktop/HCP_project/MMP_Connectomes/FC/scripts/')
149 | % subjects = load('/Users/michael/Desktop/HCP_project/subject_list.txt');
150 | %
151 | % initstring = ['#!/bin/bash -x\n#SBATCH --nodes=1\n#SBATCH --ntasks=1\n#SBATCH --time=00:10:00\n#SBATCH --partition=batch\nmodule load GCC/7.2.0 ParaStationMPI/5.2.0-1\nmodule load Octave/4.2.1\n\n'];
152 | % batch_line = 'srun -n 1 octave --eval "step2_extract_FC(';
153 | % fileID_start = fopen(['step3_extractFC'],'w');
154 | %
155 | %
156 | % break_counter = 0;
157 | % preproc_patch = 0;
158 | % for ii = 1:length(subjects)
159 | % if break_counter == 0
160 | % command = initstring;
161 | % end
162 | % break_counter = break_counter + 1;
163 | %
164 | % command = [command batch_line num2str(ii) ')" &\n'];
165 | %
166 | % if break_counter == 24 || ii == length(subjects)
167 | % preproc_patch = preproc_patch + 1;
168 | % finalstring = [command '\nwait\n'];
169 | % fileID = fopen(['step3_extractFC_' num2str(preproc_patch)],'w');
170 | % fprintf(fileID,finalstring);
171 | % fclose(fileID);
172 | % fprintf(fileID_start, ['sbatch step3_extractFC_' num2str(preproc_patch) '\n']);
173 | % break_counter = 0;
174 | % end
175 | % end
176 | %
177 | % fclose(fileID_start)
178 | %
179 |
180 |
--------------------------------------------------------------------------------
/data-preprocessing/demographics-behavioral-FC-SC/FC/step1_generate_scripts.m:
--------------------------------------------------------------------------------
1 | % This file generates SLURM scripts for parallel processing on HPC
2 | clear
3 | close all
4 | clc
5 |
6 | subjects = load('subject_list.txt');
7 | cd('scripts')
8 |
9 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
10 | % Step 1: Export region-average time series for MMP
11 | % wb_command -cifti-parcellate rfMRI_REST1_RL_Atlas_MSMAll_hp2000_clean.dtseries.nii 181232.aparc.32k_fs_LR.dlabel.nii COLUMN output_aparc.ptseries.nii
12 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 |
14 | initstring = ['#!/bin/bash -x\n#SBATCH --nodes=1\n#SBATCH --ntasks=1\n#SBATCH --time=00:10:00\n#SBATCH --partition=batch\n'];
15 |
16 | connectome_folder = '/homeb/slns/slns019/HCP_MMP_Connectomes/FC/extracted_ptseries_nii/';
17 | hcp_data_folder = '/homec/hbu23/hbu231/_data/hcp_data/hcp/';
18 | label_folder = '/homeb/slns/slns019/HCP_MMP_Connectomes/FC/';
19 |
20 | break_counter = 0;
21 | preproc_patch = 0;
22 | fileID_batch = fopen('step1_cifti_parcellate','w');
23 | for ii = 1:length(subjects)
24 | if break_counter == 0
25 | command = initstring;
26 | end
27 | break_counter = break_counter + 8;
28 |
29 | input_file1 = [hcp_data_folder num2str(subjects(ii)) '/fMRI/rfMRI_REST1_LR_Atlas_MSMAll_hp2000_clean.dtseries.nii'];
30 | input_file2 = [hcp_data_folder num2str(subjects(ii)) '/fMRI/rfMRI_REST1_RL_Atlas_MSMAll_hp2000_clean.dtseries.nii'];
31 | input_file3 = [hcp_data_folder num2str(subjects(ii)) '/fMRI/rfMRI_REST2_LR_Atlas_MSMAll_hp2000_clean.dtseries.nii'];
32 | input_file4 = [hcp_data_folder num2str(subjects(ii)) '/fMRI/rfMRI_REST2_RL_Atlas_MSMAll_hp2000_clean.dtseries.nii'];
33 | label_MMP = [label_folder 'Q1-Q6_RelatedValidation210.CorticalAreas_dil_Final_Final_Areas_Group_Colors.32k_fs_LR.dlabel.nii'];
34 | label_subcort = [label_folder 'Atlas_ROIs.2.dlabel.nii'];
35 | output_file1_MMP = [connectome_folder num2str(subjects(ii)) '_FC_REST1_LR_MMP.ptseries.nii'];
36 | output_file1_subcort = [connectome_folder num2str(subjects(ii)) '_FC_REST1_LR_subcort.ptseries.nii'];
37 | output_file2_MMP = [connectome_folder num2str(subjects(ii)) '_FC_REST1_RL_MMP.ptseries.nii'];
38 | output_file2_subcort = [connectome_folder num2str(subjects(ii)) '_FC_REST1_RL_subcort.ptseries.nii'];
39 | output_file3_MMP = [connectome_folder num2str(subjects(ii)) '_FC_REST2_LR_MMP.ptseries.nii'];
40 | output_file3_subcort = [connectome_folder num2str(subjects(ii)) '_FC_REST2_LR_subcort.ptseries.nii'];
41 | output_file4_MMP = [connectome_folder num2str(subjects(ii)) '_FC_REST2_RL_MMP.ptseries.nii'];
42 | output_file4_subcort = [connectome_folder num2str(subjects(ii)) '_FC_REST2_RL_subcort.ptseries.nii'];
43 |
44 | command = [command 'srun -n 1 --exclusive wb_command -cifti-parcellate ' input_file1 ' ' label_MMP ' COLUMN ' output_file1_MMP ' &\n'];
45 | command = [command 'srun -n 1 --exclusive wb_command -cifti-parcellate ' input_file1 ' ' label_subcort ' COLUMN ' output_file1_subcort ' &\n'];
46 |
47 | command = [command 'srun -n 1 --exclusive wb_command -cifti-parcellate ' input_file2 ' ' label_MMP ' COLUMN ' output_file2_MMP ' &\n'];
48 | command = [command 'srun -n 1 --exclusive wb_command -cifti-parcellate ' input_file2 ' ' label_subcort ' COLUMN ' output_file2_subcort ' &\n'];
49 |
50 | command = [command 'srun -n 1 --exclusive wb_command -cifti-parcellate ' input_file3 ' ' label_MMP ' COLUMN ' output_file3_MMP ' &\n'];
51 | command = [command 'srun -n 1 --exclusive wb_command -cifti-parcellate ' input_file3 ' ' label_subcort ' COLUMN ' output_file3_subcort ' &\n'];
52 |
53 | command = [command 'srun -n 1 --exclusive wb_command -cifti-parcellate ' input_file4 ' ' label_MMP ' COLUMN ' output_file4_MMP ' &\n'];
54 | command = [command 'srun -n 1 --exclusive wb_command -cifti-parcellate ' input_file4 ' ' label_subcort ' COLUMN ' output_file4_subcort ' &\n'];
55 |
56 | if break_counter == 24 || ii == length(subjects)
57 | preproc_patch = preproc_patch + 1;
58 | finalstring = [command '\nwait\n'];
59 | fileID = fopen(['step1_cifti_parcellate_' num2str(preproc_patch)],'w');
60 | fprintf(fileID,finalstring);
61 | fclose(fileID);
62 | fprintf(fileID_batch, ['sbatch step1_cifti_parcellate_' num2str(preproc_patch) '\n']);
63 | break_counter = 0;
64 | end
65 | end
66 | fclose(fileID_batch);
67 |
68 |
69 |
70 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
71 | % Step 2: Convert to text file
72 | % wb_command -cifti-convert -to-text output_aparc.ptseries.nii output_aparc.ptseries.txt
73 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
74 |
75 | initstring = ['#!/bin/bash -x\n#SBATCH --nodes=1\n#SBATCH --ntasks=1\n#SBATCH --time=00:10:00\n#SBATCH --partition=batch\n'];
76 |
77 | connectome_folder = '/homeb/slns/slns019/HCP_MMP_Connectomes/FC/extracted_ptseries_nii/';
78 | connectome_folder2 = '/homeb/slns/slns019/HCP_MMP_Connectomes/FC/extracted_ptseries_txt/';
79 | hcp_data_folder = '/homec/hbu23/hbu231/_data/hcp_data/hcp/';
80 | label_folder = '/homeb/slns/slns019/HCP_MMP_Connectomes/FC/';
81 |
82 | break_counter = 0;
83 | preproc_patch = 0;
84 | fileID_batch = fopen('step2_to_txt','w');
85 | for ii = 1:length(subjects)
86 | if break_counter == 0
87 | command = initstring;
88 | end
89 | break_counter = break_counter + 8;
90 |
91 | input_file1_MMP = [connectome_folder num2str(subjects(ii)) '_FC_REST1_LR_MMP.ptseries.nii'];
92 | input_file1_subcort = [connectome_folder num2str(subjects(ii)) '_FC_REST1_LR_subcort.ptseries.nii'];
93 | input_file2_MMP = [connectome_folder num2str(subjects(ii)) '_FC_REST1_RL_MMP.ptseries.nii'];
94 | input_file2_subcort = [connectome_folder num2str(subjects(ii)) '_FC_REST1_RL_subcort.ptseries.nii'];
95 | input_file3_MMP = [connectome_folder num2str(subjects(ii)) '_FC_REST2_LR_MMP.ptseries.nii'];
96 | input_file3_subcort = [connectome_folder num2str(subjects(ii)) '_FC_REST2_LR_subcort.ptseries.nii'];
97 | input_file4_MMP = [connectome_folder num2str(subjects(ii)) '_FC_REST2_RL_MMP.ptseries.nii'];
98 | input_file4_subcort = [connectome_folder num2str(subjects(ii)) '_FC_REST2_RL_subcort.ptseries.nii'];
99 |
100 | output_file1_MMP = [connectome_folder2 num2str(subjects(ii)) '_FC_REST1_LR_MMP.ptseries.txt'];
101 | output_file1_subcort = [connectome_folder2 num2str(subjects(ii)) '_FC_REST1_LR_subcort.ptseries.txt'];
102 | output_file2_MMP = [connectome_folder2 num2str(subjects(ii)) '_FC_REST1_RL_MMP.ptseries.txt'];
103 | output_file2_subcort = [connectome_folder2 num2str(subjects(ii)) '_FC_REST1_RL_subcort.ptseries.txt'];
104 | output_file3_MMP = [connectome_folder2 num2str(subjects(ii)) '_FC_REST2_LR_MMP.ptseries.txt'];
105 | output_file3_subcort = [connectome_folder2 num2str(subjects(ii)) '_FC_REST2_LR_subcort.ptseries.txt'];
106 | output_file4_MMP = [connectome_folder2 num2str(subjects(ii)) '_FC_REST2_RL_MMP.ptseries.txt'];
107 | output_file4_subcort = [connectome_folder2 num2str(subjects(ii)) '_FC_REST2_RL_subcort.ptseries.txt'];
108 |
109 | command = [command 'srun -n 1 --exclusive wb_command -cifti-convert -to-text ' input_file1_MMP ' ' output_file1_MMP ' &\n'];
110 | command = [command 'srun -n 1 --exclusive wb_command -cifti-convert -to-text ' input_file1_subcort ' ' output_file1_subcort ' &\n'];
111 | command = [command 'srun -n 1 --exclusive wb_command -cifti-convert -to-text ' input_file2_MMP ' ' output_file2_MMP ' &\n'];
112 | command = [command 'srun -n 1 --exclusive wb_command -cifti-convert -to-text ' input_file2_subcort ' ' output_file2_subcort ' &\n'];
113 | command = [command 'srun -n 1 --exclusive wb_command -cifti-convert -to-text ' input_file3_MMP ' ' output_file3_MMP ' &\n'];
114 | command = [command 'srun -n 1 --exclusive wb_command -cifti-convert -to-text ' input_file3_subcort ' ' output_file3_subcort ' &\n'];
115 | command = [command 'srun -n 1 --exclusive wb_command -cifti-convert -to-text ' input_file4_MMP ' ' output_file4_MMP ' &\n'];
116 | command = [command 'srun -n 1 --exclusive wb_command -cifti-convert -to-text ' input_file4_subcort ' ' output_file4_subcort ' &\n'];
117 |
118 | if break_counter == 24 || ii == length(subjects)
119 | preproc_patch = preproc_patch + 1;
120 | finalstring = [command '\nwait\n'];
121 | fileID = fopen(['step2_to_txt_' num2str(preproc_patch)],'w');
122 | fprintf(fileID,finalstring);
123 | fclose(fileID);
124 | fprintf(fileID_batch, ['sbatch step2_to_txt_' num2str(preproc_patch) '\n']);
125 | break_counter = 0;
126 | end
127 | end
128 | fclose(fileID_batch);
129 |
130 |
131 |
132 |
133 |
134 |
--------------------------------------------------------------------------------
/data-preprocessing/demographics-behavioral-FC-SC/FC/subject_list.txt:
--------------------------------------------------------------------------------
1 | 100206
2 | 100307
3 | 100408
4 | 100610
5 | 101006
6 | 101107
7 | 101309
8 | 101410
9 | 101915
10 | 102311
11 | 102513
12 | 102816
13 | 103111
14 | 103414
15 | 103515
16 | 103818
17 | 104012
18 | 104416
19 | 104820
20 | 105115
21 | 105216
22 | 105620
23 | 105923
24 | 106016
25 | 106319
26 | 106521
27 | 107018
28 | 107321
29 | 107422
30 | 107725
31 | 108121
32 | 108222
33 | 108323
34 | 108525
35 | 108828
36 | 109123
37 | 109830
38 | 110007
39 | 110411
40 | 110613
41 | 111009
42 | 111312
43 | 111413
44 | 111514
45 | 111716
46 | 112112
47 | 112314
48 | 112516
49 | 112920
50 | 113215
51 | 113619
52 | 113922
53 | 114217
54 | 114419
55 | 114621
56 | 114823
57 | 115017
58 | 115320
59 | 115825
60 | 116221
61 | 116524
62 | 116726
63 | 117122
64 | 117324
65 | 117930
66 | 118124
67 | 118225
68 | 118528
69 | 118730
70 | 118932
71 | 119126
72 | 119732
73 | 119833
74 | 120111
75 | 120212
76 | 120515
77 | 120717
78 | 121416
79 | 121618
80 | 121921
81 | 122317
82 | 122620
83 | 122822
84 | 123117
85 | 123420
86 | 123521
87 | 123925
88 | 124220
89 | 124422
90 | 124624
91 | 124826
92 | 125525
93 | 126325
94 | 126628
95 | 127630
96 | 127933
97 | 128026
98 | 128127
99 | 128632
100 | 128935
101 | 129028
102 | 129129
103 | 129331
104 | 129634
105 | 129937
106 | 130013
107 | 130316
108 | 130417
109 | 130619
110 | 130821
111 | 130922
112 | 131217
113 | 131419
114 | 131722
115 | 131823
116 | 131924
117 | 132017
118 | 133019
119 | 133625
120 | 133827
121 | 133928
122 | 134021
123 | 134223
124 | 134425
125 | 134728
126 | 134829
127 | 135225
128 | 135528
129 | 135730
130 | 135932
131 | 136227
132 | 136732
133 | 136833
134 | 137229
135 | 137633
136 | 138231
137 | 138534
138 | 138837
139 | 139233
140 | 139637
141 | 139839
142 | 140117
143 | 140319
144 | 140420
145 | 140824
146 | 140925
147 | 141119
148 | 141422
149 | 141826
150 | 143325
151 | 144125
152 | 144226
153 | 144428
154 | 144731
155 | 144832
156 | 145127
157 | 145834
158 | 146129
159 | 146331
160 | 146432
161 | 146533
162 | 146634
163 | 146937
164 | 147030
165 | 147737
166 | 148032
167 | 148133
168 | 148335
169 | 148840
170 | 148941
171 | 149236
172 | 149337
173 | 149539
174 | 149741
175 | 149842
176 | 150019
177 | 150625
178 | 150726
179 | 150928
180 | 151223
181 | 151425
182 | 151526
183 | 151627
184 | 151728
185 | 151829
186 | 152831
187 | 153025
188 | 153227
189 | 153429
190 | 153732
191 | 154229
192 | 154431
193 | 154532
194 | 154734
195 | 154835
196 | 154936
197 | 155231
198 | 155635
199 | 155938
200 | 156031
201 | 156233
202 | 156334
203 | 156435
204 | 156536
205 | 156637
206 | 157336
207 | 157437
208 | 157942
209 | 158035
210 | 158136
211 | 158338
212 | 158540
213 | 158843
214 | 159138
215 | 159239
216 | 159340
217 | 159441
218 | 159744
219 | 159946
220 | 160123
221 | 160830
222 | 160931
223 | 161327
224 | 161630
225 | 161731
226 | 162026
227 | 162228
228 | 162329
229 | 162733
230 | 162935
231 | 163129
232 | 163331
233 | 163836
234 | 164030
235 | 164131
236 | 164636
237 | 164939
238 | 165032
239 | 165638
240 | 165840
241 | 166438
242 | 167036
243 | 167238
244 | 168139
245 | 168240
246 | 168341
247 | 168745
248 | 169343
249 | 169444
250 | 169747
251 | 169949
252 | 170631
253 | 170934
254 | 171330
255 | 171532
256 | 171633
257 | 172029
258 | 172130
259 | 172332
260 | 172433
261 | 172534
262 | 172938
263 | 173334
264 | 173435
265 | 173536
266 | 173637
267 | 173738
268 | 173839
269 | 173940
270 | 174437
271 | 174841
272 | 175035
273 | 175237
274 | 175338
275 | 175439
276 | 175540
277 | 175742
278 | 176037
279 | 176239
280 | 176441
281 | 176542
282 | 176744
283 | 177241
284 | 177645
285 | 177746
286 | 178142
287 | 178243
288 | 178647
289 | 178849
290 | 178950
291 | 179245
292 | 179346
293 | 179548
294 | 179952
295 | 180129
296 | 180432
297 | 180735
298 | 180836
299 | 180937
300 | 181131
301 | 181232
302 | 181636
303 | 182032
304 | 182436
305 | 182739
306 | 182840
307 | 183034
308 | 183337
309 | 185139
310 | 185341
311 | 185442
312 | 185846
313 | 185947
314 | 186141
315 | 186444
316 | 187345
317 | 187547
318 | 187850
319 | 188347
320 | 188448
321 | 188549
322 | 188751
323 | 189349
324 | 189450
325 | 190031
326 | 191033
327 | 191336
328 | 191437
329 | 191841
330 | 191942
331 | 192035
332 | 192136
333 | 192540
334 | 192641
335 | 192843
336 | 193239
337 | 193441
338 | 194140
339 | 194645
340 | 194746
341 | 194847
342 | 195041
343 | 195445
344 | 195647
345 | 195849
346 | 195950
347 | 196144
348 | 196346
349 | 196750
350 | 197348
351 | 198249
352 | 198350
353 | 198451
354 | 198653
355 | 198855
356 | 199150
357 | 199453
358 | 199655
359 | 199958
360 | 200008
361 | 200109
362 | 200210
363 | 200311
364 | 200614
365 | 200917
366 | 201111
367 | 201414
368 | 201515
369 | 201818
370 | 202113
371 | 202719
372 | 203418
373 | 203923
374 | 204016
375 | 204319
376 | 204420
377 | 204521
378 | 204622
379 | 205119
380 | 205220
381 | 205725
382 | 205826
383 | 206222
384 | 207123
385 | 207426
386 | 208125
387 | 208226
388 | 208327
389 | 209127
390 | 209228
391 | 209329
392 | 209935
393 | 210011
394 | 210415
395 | 210617
396 | 211114
397 | 211215
398 | 211316
399 | 211417
400 | 211720
401 | 211922
402 | 212015
403 | 212116
404 | 212217
405 | 212318
406 | 212419
407 | 212823
408 | 213421
409 | 214019
410 | 214221
411 | 214423
412 | 214524
413 | 214625
414 | 214726
415 | 217126
416 | 217429
417 | 220721
418 | 221319
419 | 223929
420 | 224022
421 | 227432
422 | 228434
423 | 231928
424 | 233326
425 | 236130
426 | 237334
427 | 239944
428 | 245333
429 | 246133
430 | 248339
431 | 250427
432 | 250932
433 | 251833
434 | 255639
435 | 256540
436 | 257542
437 | 257845
438 | 263436
439 | 268749
440 | 268850
441 | 270332
442 | 275645
443 | 280739
444 | 280941
445 | 283543
446 | 284646
447 | 285345
448 | 285446
449 | 286650
450 | 287248
451 | 289555
452 | 290136
453 | 293748
454 | 295146
455 | 297655
456 | 298051
457 | 298455
458 | 299154
459 | 300618
460 | 303119
461 | 303624
462 | 304020
463 | 304727
464 | 305830
465 | 307127
466 | 308129
467 | 308331
468 | 309636
469 | 310621
470 | 311320
471 | 316633
472 | 316835
473 | 317332
474 | 318637
475 | 320826
476 | 321323
477 | 322224
478 | 330324
479 | 333330
480 | 334635
481 | 336841
482 | 339847
483 | 341834
484 | 346137
485 | 346945
486 | 351938
487 | 352132
488 | 353740
489 | 358144
490 | 361234
491 | 361941
492 | 365343
493 | 366042
494 | 366446
495 | 371843
496 | 377451
497 | 379657
498 | 380036
499 | 381038
500 | 381543
501 | 385450
502 | 386250
503 | 387959
504 | 389357
505 | 390645
506 | 391748
507 | 393247
508 | 393550
509 | 395251
510 | 395756
511 | 395958
512 | 397154
513 | 397760
514 | 397861
515 | 406836
516 | 412528
517 | 414229
518 | 415837
519 | 422632
520 | 424939
521 | 429040
522 | 432332
523 | 433839
524 | 436239
525 | 436845
526 | 441939
527 | 445543
528 | 448347
529 | 449753
530 | 453441
531 | 456346
532 | 459453
533 | 465852
534 | 467351
535 | 473952
536 | 479762
537 | 480141
538 | 481951
539 | 485757
540 | 486759
541 | 492754
542 | 495255
543 | 497865
544 | 499566
545 | 500222
546 | 506234
547 | 510326
548 | 512835
549 | 513736
550 | 517239
551 | 519950
552 | 520228
553 | 522434
554 | 523032
555 | 524135
556 | 525541
557 | 529549
558 | 529953
559 | 530635
560 | 531536
561 | 536647
562 | 540436
563 | 541943
564 | 545345
565 | 547046
566 | 548250
567 | 553344
568 | 555348
569 | 555651
570 | 557857
571 | 559053
572 | 561242
573 | 561444
574 | 562345
575 | 562446
576 | 565452
577 | 566454
578 | 567052
579 | 567961
580 | 568963
581 | 570243
582 | 571144
583 | 571548
584 | 572045
585 | 573249
586 | 573451
587 | 576255
588 | 579867
589 | 580044
590 | 580347
591 | 580650
592 | 580751
593 | 581349
594 | 581450
595 | 583858
596 | 585256
597 | 586460
598 | 587664
599 | 588565
600 | 594156
601 | 597869
602 | 598568
603 | 599065
604 | 599469
605 | 599671
606 | 604537
607 | 609143
608 | 611938
609 | 613538
610 | 615744
611 | 616645
612 | 617748
613 | 618952
614 | 622236
615 | 623844
616 | 626648
617 | 627549
618 | 627852
619 | 628248
620 | 633847
621 | 638049
622 | 645450
623 | 645551
624 | 647858
625 | 654350
626 | 654754
627 | 656253
628 | 656657
629 | 657659
630 | 660951
631 | 663755
632 | 664757
633 | 665254
634 | 667056
635 | 668361
636 | 671855
637 | 672756
638 | 673455
639 | 677766
640 | 677968
641 | 679568
642 | 679770
643 | 680957
644 | 683256
645 | 685058
646 | 687163
647 | 690152
648 | 693764
649 | 695768
650 | 700634
651 | 702133
652 | 704238
653 | 705341
654 | 706040
655 | 707749
656 | 709551
657 | 713239
658 | 715647
659 | 715950
660 | 720337
661 | 724446
662 | 725751
663 | 727654
664 | 729254
665 | 729557
666 | 731140
667 | 732243
668 | 734045
669 | 735148
670 | 742549
671 | 744553
672 | 748258
673 | 748662
674 | 749058
675 | 751348
676 | 751550
677 | 753150
678 | 756055
679 | 759869
680 | 761957
681 | 765056
682 | 766563
683 | 767464
684 | 769064
685 | 770352
686 | 771354
687 | 773257
688 | 779370
689 | 782561
690 | 783462
691 | 784565
692 | 786569
693 | 788876
694 | 789373
695 | 792564
696 | 792867
697 | 800941
698 | 802844
699 | 803240
700 | 810843
701 | 812746
702 | 816653
703 | 818859
704 | 820745
705 | 825048
706 | 826353
707 | 826454
708 | 833148
709 | 833249
710 | 835657
711 | 837560
712 | 837964
713 | 841349
714 | 843151
715 | 844961
716 | 845458
717 | 849264
718 | 849971
719 | 852455
720 | 856463
721 | 856766
722 | 856968
723 | 857263
724 | 859671
725 | 861456
726 | 865363
727 | 867468
728 | 870861
729 | 871762
730 | 871964
731 | 872158
732 | 872562
733 | 873968
734 | 877168
735 | 877269
736 | 880157
737 | 882161
738 | 885975
739 | 887373
740 | 889579
741 | 891667
742 | 894067
743 | 894673
744 | 894774
745 | 896778
746 | 896879
747 | 898176
748 | 899885
749 | 901139
750 | 901442
751 | 904044
752 | 907656
753 | 910241
754 | 910443
755 | 912447
756 | 917255
757 | 917558
758 | 919966
759 | 922854
760 | 923755
761 | 927359
762 | 930449
763 | 932554
764 | 937160
765 | 942658
766 | 947668
767 | 952863
768 | 955465
769 | 957974
770 | 958976
771 | 959574
772 | 965367
773 | 965771
774 | 966975
775 | 972566
776 | 978578
777 | 983773
778 | 984472
779 | 987983
780 | 990366
781 | 991267
782 | 992673
783 | 992774
784 | 993675
785 | 994273
786 | 996782
--------------------------------------------------------------------------------
/data-preprocessing/demographics-behavioral-FC-SC/SC/subject_list.txt:
--------------------------------------------------------------------------------
1 | 100206
2 | 100307
3 | 100408
4 | 100610
5 | 101006
6 | 101107
7 | 101309
8 | 101410
9 | 101915
10 | 102311
11 | 102513
12 | 102816
13 | 103111
14 | 103414
15 | 103515
16 | 103818
17 | 104012
18 | 104416
19 | 104820
20 | 105115
21 | 105216
22 | 105620
23 | 105923
24 | 106016
25 | 106319
26 | 106521
27 | 107018
28 | 107321
29 | 107422
30 | 107725
31 | 108121
32 | 108222
33 | 108323
34 | 108525
35 | 108828
36 | 109123
37 | 109830
38 | 110007
39 | 110411
40 | 110613
41 | 111009
42 | 111312
43 | 111413
44 | 111514
45 | 111716
46 | 112112
47 | 112314
48 | 112516
49 | 112920
50 | 113215
51 | 113619
52 | 113922
53 | 114217
54 | 114419
55 | 114621
56 | 114823
57 | 115017
58 | 115320
59 | 115825
60 | 116221
61 | 116524
62 | 116726
63 | 117122
64 | 117324
65 | 117930
66 | 118124
67 | 118225
68 | 118528
69 | 118730
70 | 118932
71 | 119126
72 | 119732
73 | 119833
74 | 120111
75 | 120212
76 | 120515
77 | 120717
78 | 121416
79 | 121618
80 | 121921
81 | 122317
82 | 122620
83 | 122822
84 | 123117
85 | 123420
86 | 123521
87 | 123925
88 | 124220
89 | 124422
90 | 124624
91 | 124826
92 | 125525
93 | 126325
94 | 126628
95 | 127630
96 | 127933
97 | 128026
98 | 128127
99 | 128632
100 | 128935
101 | 129028
102 | 129129
103 | 129331
104 | 129634
105 | 129937
106 | 130013
107 | 130316
108 | 130417
109 | 130619
110 | 130821
111 | 130922
112 | 131217
113 | 131419
114 | 131722
115 | 131823
116 | 131924
117 | 132017
118 | 133019
119 | 133625
120 | 133827
121 | 133928
122 | 134021
123 | 134223
124 | 134425
125 | 134728
126 | 134829
127 | 135225
128 | 135528
129 | 135730
130 | 135932
131 | 136227
132 | 136732
133 | 136833
134 | 137229
135 | 137633
136 | 138231
137 | 138534
138 | 138837
139 | 139233
140 | 139637
141 | 139839
142 | 140117
143 | 140319
144 | 140420
145 | 140824
146 | 140925
147 | 141119
148 | 141422
149 | 141826
150 | 143325
151 | 144125
152 | 144226
153 | 144428
154 | 144731
155 | 144832
156 | 145127
157 | 145834
158 | 146129
159 | 146331
160 | 146432
161 | 146533
162 | 146634
163 | 146937
164 | 147030
165 | 147737
166 | 148032
167 | 148133
168 | 148335
169 | 148840
170 | 148941
171 | 149236
172 | 149337
173 | 149539
174 | 149741
175 | 149842
176 | 150019
177 | 150625
178 | 150726
179 | 150928
180 | 151223
181 | 151425
182 | 151526
183 | 151627
184 | 151728
185 | 151829
186 | 152831
187 | 153025
188 | 153227
189 | 153429
190 | 153732
191 | 154229
192 | 154431
193 | 154532
194 | 154734
195 | 154835
196 | 154936
197 | 155231
198 | 155635
199 | 155938
200 | 156031
201 | 156233
202 | 156334
203 | 156435
204 | 156536
205 | 156637
206 | 157336
207 | 157437
208 | 157942
209 | 158035
210 | 158136
211 | 158338
212 | 158540
213 | 158843
214 | 159138
215 | 159239
216 | 159340
217 | 159441
218 | 159744
219 | 159946
220 | 160123
221 | 160830
222 | 160931
223 | 161327
224 | 161630
225 | 161731
226 | 162026
227 | 162228
228 | 162329
229 | 162733
230 | 162935
231 | 163129
232 | 163331
233 | 163836
234 | 164030
235 | 164131
236 | 164636
237 | 164939
238 | 165032
239 | 165638
240 | 165840
241 | 166438
242 | 167036
243 | 167238
244 | 168139
245 | 168240
246 | 168341
247 | 168745
248 | 169343
249 | 169444
250 | 169747
251 | 169949
252 | 170631
253 | 170934
254 | 171330
255 | 171532
256 | 171633
257 | 172029
258 | 172130
259 | 172332
260 | 172433
261 | 172534
262 | 172938
263 | 173334
264 | 173435
265 | 173536
266 | 173637
267 | 173738
268 | 173839
269 | 173940
270 | 174437
271 | 174841
272 | 175035
273 | 175237
274 | 175338
275 | 175439
276 | 175540
277 | 175742
278 | 176037
279 | 176239
280 | 176441
281 | 176542
282 | 176744
283 | 177241
284 | 177645
285 | 177746
286 | 178142
287 | 178243
288 | 178647
289 | 178849
290 | 178950
291 | 179245
292 | 179346
293 | 179548
294 | 179952
295 | 180129
296 | 180432
297 | 180735
298 | 180836
299 | 180937
300 | 181131
301 | 181232
302 | 181636
303 | 182032
304 | 182436
305 | 182739
306 | 182840
307 | 183034
308 | 183337
309 | 185139
310 | 185341
311 | 185442
312 | 185846
313 | 185947
314 | 186141
315 | 186444
316 | 187345
317 | 187547
318 | 187850
319 | 188347
320 | 188448
321 | 188549
322 | 188751
323 | 189349
324 | 189450
325 | 190031
326 | 191033
327 | 191336
328 | 191437
329 | 191841
330 | 191942
331 | 192035
332 | 192136
333 | 192540
334 | 192641
335 | 192843
336 | 193239
337 | 193441
338 | 194140
339 | 194645
340 | 194746
341 | 194847
342 | 195041
343 | 195445
344 | 195647
345 | 195849
346 | 195950
347 | 196144
348 | 196346
349 | 196750
350 | 197348
351 | 198249
352 | 198350
353 | 198451
354 | 198653
355 | 198855
356 | 199150
357 | 199453
358 | 199655
359 | 199958
360 | 200008
361 | 200109
362 | 200210
363 | 200311
364 | 200614
365 | 200917
366 | 201111
367 | 201414
368 | 201515
369 | 201818
370 | 202113
371 | 202719
372 | 203418
373 | 203923
374 | 204016
375 | 204319
376 | 204420
377 | 204521
378 | 204622
379 | 205119
380 | 205220
381 | 205725
382 | 205826
383 | 206222
384 | 207123
385 | 207426
386 | 208125
387 | 208226
388 | 208327
389 | 209127
390 | 209228
391 | 209329
392 | 209935
393 | 210011
394 | 210415
395 | 210617
396 | 211114
397 | 211215
398 | 211316
399 | 211417
400 | 211720
401 | 211922
402 | 212015
403 | 212116
404 | 212217
405 | 212318
406 | 212419
407 | 212823
408 | 213421
409 | 214019
410 | 214221
411 | 214423
412 | 214524
413 | 214625
414 | 214726
415 | 217126
416 | 217429
417 | 220721
418 | 221319
419 | 223929
420 | 224022
421 | 227432
422 | 228434
423 | 231928
424 | 233326
425 | 236130
426 | 237334
427 | 239944
428 | 245333
429 | 246133
430 | 248339
431 | 250427
432 | 250932
433 | 251833
434 | 255639
435 | 256540
436 | 257542
437 | 257845
438 | 263436
439 | 268749
440 | 268850
441 | 270332
442 | 275645
443 | 280739
444 | 280941
445 | 283543
446 | 284646
447 | 285345
448 | 285446
449 | 286650
450 | 287248
451 | 289555
452 | 290136
453 | 293748
454 | 295146
455 | 297655
456 | 298051
457 | 298455
458 | 299154
459 | 300618
460 | 303119
461 | 303624
462 | 304020
463 | 304727
464 | 305830
465 | 307127
466 | 308129
467 | 308331
468 | 309636
469 | 310621
470 | 311320
471 | 316633
472 | 316835
473 | 317332
474 | 318637
475 | 320826
476 | 321323
477 | 322224
478 | 330324
479 | 333330
480 | 334635
481 | 336841
482 | 339847
483 | 341834
484 | 346137
485 | 346945
486 | 351938
487 | 352132
488 | 353740
489 | 358144
490 | 361234
491 | 361941
492 | 365343
493 | 366042
494 | 366446
495 | 371843
496 | 377451
497 | 379657
498 | 380036
499 | 381038
500 | 381543
501 | 385450
502 | 386250
503 | 387959
504 | 389357
505 | 390645
506 | 391748
507 | 393247
508 | 393550
509 | 395251
510 | 395756
511 | 395958
512 | 397154
513 | 397760
514 | 397861
515 | 406836
516 | 412528
517 | 414229
518 | 415837
519 | 422632
520 | 424939
521 | 429040
522 | 432332
523 | 433839
524 | 436239
525 | 436845
526 | 441939
527 | 445543
528 | 448347
529 | 449753
530 | 453441
531 | 456346
532 | 459453
533 | 465852
534 | 467351
535 | 473952
536 | 479762
537 | 480141
538 | 481951
539 | 485757
540 | 486759
541 | 492754
542 | 495255
543 | 497865
544 | 499566
545 | 500222
546 | 506234
547 | 510326
548 | 512835
549 | 513736
550 | 517239
551 | 519950
552 | 520228
553 | 522434
554 | 523032
555 | 524135
556 | 525541
557 | 529549
558 | 529953
559 | 530635
560 | 531536
561 | 536647
562 | 540436
563 | 541943
564 | 545345
565 | 547046
566 | 548250
567 | 553344
568 | 555348
569 | 555651
570 | 557857
571 | 559053
572 | 561242
573 | 561444
574 | 562345
575 | 562446
576 | 565452
577 | 566454
578 | 567052
579 | 567961
580 | 568963
581 | 570243
582 | 571144
583 | 571548
584 | 572045
585 | 573249
586 | 573451
587 | 576255
588 | 579867
589 | 580044
590 | 580347
591 | 580650
592 | 580751
593 | 581349
594 | 581450
595 | 583858
596 | 585256
597 | 586460
598 | 587664
599 | 588565
600 | 594156
601 | 597869
602 | 598568
603 | 599065
604 | 599469
605 | 599671
606 | 604537
607 | 609143
608 | 611938
609 | 613538
610 | 615744
611 | 616645
612 | 617748
613 | 618952
614 | 622236
615 | 623844
616 | 626648
617 | 627549
618 | 627852
619 | 628248
620 | 633847
621 | 638049
622 | 645450
623 | 645551
624 | 647858
625 | 654350
626 | 654754
627 | 656253
628 | 656657
629 | 657659
630 | 660951
631 | 663755
632 | 664757
633 | 665254
634 | 667056
635 | 668361
636 | 671855
637 | 672756
638 | 673455
639 | 677766
640 | 677968
641 | 679568
642 | 679770
643 | 680957
644 | 683256
645 | 685058
646 | 687163
647 | 690152
648 | 693764
649 | 695768
650 | 700634
651 | 702133
652 | 704238
653 | 705341
654 | 706040
655 | 707749
656 | 709551
657 | 713239
658 | 715647
659 | 715950
660 | 720337
661 | 724446
662 | 725751
663 | 727654
664 | 729254
665 | 729557
666 | 731140
667 | 732243
668 | 734045
669 | 735148
670 | 742549
671 | 744553
672 | 748258
673 | 748662
674 | 749058
675 | 751348
676 | 751550
677 | 753150
678 | 756055
679 | 759869
680 | 761957
681 | 765056
682 | 766563
683 | 767464
684 | 769064
685 | 770352
686 | 771354
687 | 773257
688 | 779370
689 | 782561
690 | 783462
691 | 784565
692 | 786569
693 | 788876
694 | 789373
695 | 792564
696 | 792867
697 | 800941
698 | 802844
699 | 803240
700 | 810843
701 | 812746
702 | 816653
703 | 818859
704 | 820745
705 | 825048
706 | 826353
707 | 826454
708 | 833148
709 | 833249
710 | 835657
711 | 837560
712 | 837964
713 | 841349
714 | 843151
715 | 844961
716 | 845458
717 | 849264
718 | 849971
719 | 852455
720 | 856463
721 | 856766
722 | 856968
723 | 857263
724 | 859671
725 | 861456
726 | 865363
727 | 867468
728 | 870861
729 | 871762
730 | 871964
731 | 872158
732 | 872562
733 | 873968
734 | 877168
735 | 877269
736 | 880157
737 | 882161
738 | 885975
739 | 887373
740 | 889579
741 | 891667
742 | 894067
743 | 894673
744 | 894774
745 | 896778
746 | 896879
747 | 898176
748 | 899885
749 | 901139
750 | 901442
751 | 904044
752 | 907656
753 | 910241
754 | 910443
755 | 912447
756 | 917255
757 | 917558
758 | 919966
759 | 922854
760 | 923755
761 | 927359
762 | 930449
763 | 932554
764 | 937160
765 | 942658
766 | 947668
767 | 952863
768 | 955465
769 | 957974
770 | 958976
771 | 959574
772 | 965367
773 | 965771
774 | 966975
775 | 972566
776 | 978578
777 | 983773
778 | 984472
779 | 987983
780 | 990366
781 | 991267
782 | 992673
783 | 992774
784 | 993675
785 | 994273
786 | 996782
--------------------------------------------------------------------------------
/data-preprocessing/demographics-behavioral-FC-SC/FC/region_sorting.txt:
--------------------------------------------------------------------------------
1 | For more information on the cortical parcellation (ROIs 1 to 360) please refer to
2 | Glasser et al., Nature 2016
3 |
4 | 1 R_V1_ROI
5 | 2 R_MST_ROI
6 | 3 R_V6_ROI
7 | 4 R_V2_ROI
8 | 5 R_V3_ROI
9 | 6 R_V4_ROI
10 | 7 R_V8_ROI
11 | 8 R_4_ROI
12 | 9 R_3b_ROI
13 | 10 R_FEF_ROI
14 | 11 R_PEF_ROI
15 | 12 R_55b_ROI
16 | 13 R_V3A_ROI
17 | 14 R_RSC_ROI
18 | 15 R_POS2_ROI
19 | 16 R_V7_ROI
20 | 17 R_IPS1_ROI
21 | 18 R_FFC_ROI
22 | 19 R_V3B_ROI
23 | 20 R_LO1_ROI
24 | 21 R_LO2_ROI
25 | 22 R_PIT_ROI
26 | 23 R_MT_ROI
27 | 24 R_A1_ROI
28 | 25 R_PSL_ROI
29 | 26 R_SFL_ROI
30 | 27 R_PCV_ROI
31 | 28 R_STV_ROI
32 | 29 R_7Pm_ROI
33 | 30 R_7m_ROI
34 | 31 R_POS1_ROI
35 | 32 R_23d_ROI
36 | 33 R_v23ab_ROI
37 | 34 R_d23ab_ROI
38 | 35 R_31pv_ROI
39 | 36 R_5m_ROI
40 | 37 R_5mv_ROI
41 | 38 R_23c_ROI
42 | 39 R_5L_ROI
43 | 40 R_24dd_ROI
44 | 41 R_24dv_ROI
45 | 42 R_7AL_ROI
46 | 43 R_SCEF_ROI
47 | 44 R_6ma_ROI
48 | 45 R_7Am_ROI
49 | 46 R_7PL_ROI
50 | 47 R_7PC_ROI
51 | 48 R_LIPv_ROI
52 | 49 R_VIP_ROI
53 | 50 R_MIP_ROI
54 | 51 R_1_ROI
55 | 52 R_2_ROI
56 | 53 R_3a_ROI
57 | 54 R_6d_ROI
58 | 55 R_6mp_ROI
59 | 56 R_6v_ROI
60 | 57 R_p24pr_ROI
61 | 58 R_33pr_ROI
62 | 59 R_a24pr_ROI
63 | 60 R_p32pr_ROI
64 | 61 R_a24_ROI
65 | 62 R_d32_ROI
66 | 63 R_8BM_ROI
67 | 64 R_p32_ROI
68 | 65 R_10r_ROI
69 | 66 R_47m_ROI
70 | 67 R_8Av_ROI
71 | 68 R_8Ad_ROI
72 | 69 R_9m_ROI
73 | 70 R_8BL_ROI
74 | 71 R_9p_ROI
75 | 72 R_10d_ROI
76 | 73 R_8C_ROI
77 | 74 R_44_ROI
78 | 75 R_45_ROI
79 | 76 R_47l_ROI
80 | 77 R_a47r_ROI
81 | 78 R_6r_ROI
82 | 79 R_IFJa_ROI
83 | 80 R_IFJp_ROI
84 | 81 R_IFSp_ROI
85 | 82 R_IFSa_ROI
86 | 83 R_p9-46v_ROI
87 | 84 R_46_ROI
88 | 85 R_a9-46v_ROI
89 | 86 R_9-46d_ROI
90 | 87 R_9a_ROI
91 | 88 R_10v_ROI
92 | 89 R_a10p_ROI
93 | 90 R_10pp_ROI
94 | 91 R_11l_ROI
95 | 92 R_13l_ROI
96 | 93 R_OFC_ROI
97 | 94 R_47s_ROI
98 | 95 R_LIPd_ROI
99 | 96 R_6a_ROI
100 | 97 R_i6-8_ROI
101 | 98 R_s6-8_ROI
102 | 99 R_43_ROI
103 | 100 R_OP4_ROI
104 | 101 R_OP1_ROI
105 | 102 R_OP2-3_ROI
106 | 103 R_52_ROI
107 | 104 R_RI_ROI
108 | 105 R_PFcm_ROI
109 | 106 R_PoI2_ROI
110 | 107 R_TA2_ROI
111 | 108 R_FOP4_ROI
112 | 109 R_MI_ROI
113 | 110 R_Pir_ROI
114 | 111 R_AVI_ROI
115 | 112 R_AAIC_ROI
116 | 113 R_FOP1_ROI
117 | 114 R_FOP3_ROI
118 | 115 R_FOP2_ROI
119 | 116 R_PFt_ROI
120 | 117 R_AIP_ROI
121 | 118 R_EC_ROI
122 | 119 R_PreS_ROI
123 | 120 R_H_ROI
124 | 121 R_ProS_ROI
125 | 122 R_PeEc_ROI
126 | 123 R_STGa_ROI
127 | 124 R_PBelt_ROI
128 | 125 R_A5_ROI
129 | 126 R_PHA1_ROI
130 | 127 R_PHA3_ROI
131 | 128 R_STSda_ROI
132 | 129 R_STSdp_ROI
133 | 130 R_STSvp_ROI
134 | 131 R_TGd_ROI
135 | 132 R_TE1a_ROI
136 | 133 R_TE1p_ROI
137 | 134 R_TE2a_ROI
138 | 135 R_TF_ROI
139 | 136 R_TE2p_ROI
140 | 137 R_PHT_ROI
141 | 138 R_PH_ROI
142 | 139 R_TPOJ1_ROI
143 | 140 R_TPOJ2_ROI
144 | 141 R_TPOJ3_ROI
145 | 142 R_DVT_ROI
146 | 143 R_PGp_ROI
147 | 144 R_IP2_ROI
148 | 145 R_IP1_ROI
149 | 146 R_IP0_ROI
150 | 147 R_PFop_ROI
151 | 148 R_PF_ROI
152 | 149 R_PFm_ROI
153 | 150 R_PGi_ROI
154 | 151 R_PGs_ROI
155 | 152 R_V6A_ROI
156 | 153 R_VMV1_ROI
157 | 154 R_VMV3_ROI
158 | 155 R_PHA2_ROI
159 | 156 R_V4t_ROI
160 | 157 R_FST_ROI
161 | 158 R_V3CD_ROI
162 | 159 R_LO3_ROI
163 | 160 R_VMV2_ROI
164 | 161 R_31pd_ROI
165 | 162 R_31a_ROI
166 | 163 R_VVC_ROI
167 | 164 R_25_ROI
168 | 165 R_s32_ROI
169 | 166 R_pOFC_ROI
170 | 167 R_PoI1_ROI
171 | 168 R_Ig_ROI
172 | 169 R_FOP5_ROI
173 | 170 R_p10p_ROI
174 | 171 R_p47r_ROI
175 | 172 R_TGv_ROI
176 | 173 R_MBelt_ROI
177 | 174 R_LBelt_ROI
178 | 175 R_A4_ROI
179 | 176 R_STSva_ROI
180 | 177 R_TE1m_ROI
181 | 178 R_PI_ROI
182 | 179 R_a32pr_ROI
183 | 180 R_p24_ROI
184 | 181 L_V1_ROI
185 | 182 L_MST_ROI
186 | 183 L_V6_ROI
187 | 184 L_V2_ROI
188 | 185 L_V3_ROI
189 | 186 L_V4_ROI
190 | 187 L_V8_ROI
191 | 188 L_4_ROI
192 | 189 L_3b_ROI
193 | 190 L_FEF_ROI
194 | 191 L_PEF_ROI
195 | 192 L_55b_ROI
196 | 193 L_V3A_ROI
197 | 194 L_RSC_ROI
198 | 195 L_POS2_ROI
199 | 196 L_V7_ROI
200 | 197 L_IPS1_ROI
201 | 198 L_FFC_ROI
202 | 199 L_V3B_ROI
203 | 200 L_LO1_ROI
204 | 201 L_LO2_ROI
205 | 202 L_PIT_ROI
206 | 203 L_MT_ROI
207 | 204 L_A1_ROI
208 | 205 L_PSL_ROI
209 | 206 L_SFL_ROI
210 | 207 L_PCV_ROI
211 | 208 L_STV_ROI
212 | 209 L_7Pm_ROI
213 | 210 L_7m_ROI
214 | 211 L_POS1_ROI
215 | 212 L_23d_ROI
216 | 213 L_v23ab_ROI
217 | 214 L_d23ab_ROI
218 | 215 L_31pv_ROI
219 | 216 L_5m_ROI
220 | 217 L_5mv_ROI
221 | 218 L_23c_ROI
222 | 219 L_5L_ROI
223 | 220 L_24dd_ROI
224 | 221 L_24dv_ROI
225 | 222 L_7AL_ROI
226 | 223 L_SCEF_ROI
227 | 224 L_6ma_ROI
228 | 225 L_7Am_ROI
229 | 226 L_7PL_ROI
230 | 227 L_7PC_ROI
231 | 228 L_LIPv_ROI
232 | 229 L_VIP_ROI
233 | 230 L_MIP_ROI
234 | 231 L_1_ROI
235 | 232 L_2_ROI
236 | 233 L_3a_ROI
237 | 234 L_6d_ROI
238 | 235 L_6mp_ROI
239 | 236 L_6v_ROI
240 | 237 L_p24pr_ROI
241 | 238 L_33pr_ROI
242 | 239 L_a24pr_ROI
243 | 240 L_p32pr_ROI
244 | 241 L_a24_ROI
245 | 242 L_d32_ROI
246 | 243 L_8BM_ROI
247 | 244 L_p32_ROI
248 | 245 L_10r_ROI
249 | 246 L_47m_ROI
250 | 247 L_8Av_ROI
251 | 248 L_8Ad_ROI
252 | 249 L_9m_ROI
253 | 250 L_8BL_ROI
254 | 251 L_9p_ROI
255 | 252 L_10d_ROI
256 | 253 L_8C_ROI
257 | 254 L_44_ROI
258 | 255 L_45_ROI
259 | 256 L_47l_ROI
260 | 257 L_a47r_ROI
261 | 258 L_6r_ROI
262 | 259 L_IFJa_ROI
263 | 260 L_IFJp_ROI
264 | 261 L_IFSp_ROI
265 | 262 L_IFSa_ROI
266 | 263 L_p9-46v_ROI
267 | 264 L_46_ROI
268 | 265 L_a9-46v_ROI
269 | 266 L_9-46d_ROI
270 | 267 L_9a_ROI
271 | 268 L_10v_ROI
272 | 269 L_a10p_ROI
273 | 270 L_10pp_ROI
274 | 271 L_11l_ROI
275 | 272 L_13l_ROI
276 | 273 L_OFC_ROI
277 | 274 L_47s_ROI
278 | 275 L_LIPd_ROI
279 | 276 L_6a_ROI
280 | 277 L_i6-8_ROI
281 | 278 L_s6-8_ROI
282 | 279 L_43_ROI
283 | 280 L_OP4_ROI
284 | 281 L_OP1_ROI
285 | 282 L_OP2-3_ROI
286 | 283 L_52_ROI
287 | 284 L_RI_ROI
288 | 285 L_PFcm_ROI
289 | 286 L_PoI2_ROI
290 | 287 L_TA2_ROI
291 | 288 L_FOP4_ROI
292 | 289 L_MI_ROI
293 | 290 L_Pir_ROI
294 | 291 L_AVI_ROI
295 | 292 L_AAIC_ROI
296 | 293 L_FOP1_ROI
297 | 294 L_FOP3_ROI
298 | 295 L_FOP2_ROI
299 | 296 L_PFt_ROI
300 | 297 L_AIP_ROI
301 | 298 L_EC_ROI
302 | 299 L_PreS_ROI
303 | 300 L_H_ROI
304 | 301 L_ProS_ROI
305 | 302 L_PeEc_ROI
306 | 303 L_STGa_ROI
307 | 304 L_PBelt_ROI
308 | 305 L_A5_ROI
309 | 306 L_PHA1_ROI
310 | 307 L_PHA3_ROI
311 | 308 L_STSda_ROI
312 | 309 L_STSdp_ROI
313 | 310 L_STSvp_ROI
314 | 311 L_TGd_ROI
315 | 312 L_TE1a_ROI
316 | 313 L_TE1p_ROI
317 | 314 L_TE2a_ROI
318 | 315 L_TF_ROI
319 | 316 L_TE2p_ROI
320 | 317 L_PHT_ROI
321 | 318 L_PH_ROI
322 | 319 L_TPOJ1_ROI
323 | 320 L_TPOJ2_ROI
324 | 321 L_TPOJ3_ROI
325 | 322 L_DVT_ROI
326 | 323 L_PGp_ROI
327 | 324 L_IP2_ROI
328 | 325 L_IP1_ROI
329 | 326 L_IP0_ROI
330 | 327 L_PFop_ROI
331 | 328 L_PF_ROI
332 | 329 L_PFm_ROI
333 | 330 L_PGi_ROI
334 | 331 L_PGs_ROI
335 | 332 L_V6A_ROI
336 | 333 L_VMV1_ROI
337 | 334 L_VMV3_ROI
338 | 335 L_PHA2_ROI
339 | 336 L_V4t_ROI
340 | 337 L_FST_ROI
341 | 338 L_V3CD_ROI
342 | 339 L_LO3_ROI
343 | 340 L_VMV2_ROI
344 | 341 L_31pd_ROI
345 | 342 L_31a_ROI
346 | 343 L_VVC_ROI
347 | 344 L_25_ROI
348 | 345 L_s32_ROI
349 | 346 L_pOFC_ROI
350 | 347 L_PoI1_ROI
351 | 348 L_Ig_ROI
352 | 349 L_FOP5_ROI
353 | 350 L_p10p_ROI
354 | 351 L_p47r_ROI
355 | 352 L_TGv_ROI
356 | 353 L_MBelt_ROI
357 | 354 L_LBelt_ROI
358 | 355 L_A4_ROI
359 | 356 L_STSva_ROI
360 | 357 L_TE1m_ROI
361 | 358 L_PI_ROI
362 | 359 L_a32pr_ROI
363 | 360 L_p24_ROI
364 | 361 Left-Cerebellum-Cortex
365 | 362 Left-Thalamus-Proper
366 | 363 Left-Caudate
367 | 364 Left-Putamen
368 | 365 Left-Pallidum
369 | 379 Brain-Stem
370 | 366 Left-Hippocampus
371 | 367 Left-Amygdala
372 | 368 Left-Accumbens-area
373 | 369 Left-VentralDC
374 | 370 Right-Cerebellum-Cortex
375 | 371 Right-Thalamus-Proper
376 | 372 Right-Caudate
377 | 373 Right-Putamen
378 | 374 Right-Pallidum
379 | 375 Right-Hippocampus
380 | 376 Right-Amygdala
381 | 377 Right-Accumbens-area
382 | 378 Right-VentralDC
383 | 379 Brainstem (only in FC since tractography was performed w/o brainstem)
384 |
--------------------------------------------------------------------------------
/data-preprocessing/demographics-behavioral-FC-SC/SC/region_sorting.txt:
--------------------------------------------------------------------------------
1 | For more information on the cortical parcellation (ROIs 1 to 360) please refer to
2 | Glasser et al., Nature 2016
3 |
4 | 1 R_V1_ROI
5 | 2 R_MST_ROI
6 | 3 R_V6_ROI
7 | 4 R_V2_ROI
8 | 5 R_V3_ROI
9 | 6 R_V4_ROI
10 | 7 R_V8_ROI
11 | 8 R_4_ROI
12 | 9 R_3b_ROI
13 | 10 R_FEF_ROI
14 | 11 R_PEF_ROI
15 | 12 R_55b_ROI
16 | 13 R_V3A_ROI
17 | 14 R_RSC_ROI
18 | 15 R_POS2_ROI
19 | 16 R_V7_ROI
20 | 17 R_IPS1_ROI
21 | 18 R_FFC_ROI
22 | 19 R_V3B_ROI
23 | 20 R_LO1_ROI
24 | 21 R_LO2_ROI
25 | 22 R_PIT_ROI
26 | 23 R_MT_ROI
27 | 24 R_A1_ROI
28 | 25 R_PSL_ROI
29 | 26 R_SFL_ROI
30 | 27 R_PCV_ROI
31 | 28 R_STV_ROI
32 | 29 R_7Pm_ROI
33 | 30 R_7m_ROI
34 | 31 R_POS1_ROI
35 | 32 R_23d_ROI
36 | 33 R_v23ab_ROI
37 | 34 R_d23ab_ROI
38 | 35 R_31pv_ROI
39 | 36 R_5m_ROI
40 | 37 R_5mv_ROI
41 | 38 R_23c_ROI
42 | 39 R_5L_ROI
43 | 40 R_24dd_ROI
44 | 41 R_24dv_ROI
45 | 42 R_7AL_ROI
46 | 43 R_SCEF_ROI
47 | 44 R_6ma_ROI
48 | 45 R_7Am_ROI
49 | 46 R_7PL_ROI
50 | 47 R_7PC_ROI
51 | 48 R_LIPv_ROI
52 | 49 R_VIP_ROI
53 | 50 R_MIP_ROI
54 | 51 R_1_ROI
55 | 52 R_2_ROI
56 | 53 R_3a_ROI
57 | 54 R_6d_ROI
58 | 55 R_6mp_ROI
59 | 56 R_6v_ROI
60 | 57 R_p24pr_ROI
61 | 58 R_33pr_ROI
62 | 59 R_a24pr_ROI
63 | 60 R_p32pr_ROI
64 | 61 R_a24_ROI
65 | 62 R_d32_ROI
66 | 63 R_8BM_ROI
67 | 64 R_p32_ROI
68 | 65 R_10r_ROI
69 | 66 R_47m_ROI
70 | 67 R_8Av_ROI
71 | 68 R_8Ad_ROI
72 | 69 R_9m_ROI
73 | 70 R_8BL_ROI
74 | 71 R_9p_ROI
75 | 72 R_10d_ROI
76 | 73 R_8C_ROI
77 | 74 R_44_ROI
78 | 75 R_45_ROI
79 | 76 R_47l_ROI
80 | 77 R_a47r_ROI
81 | 78 R_6r_ROI
82 | 79 R_IFJa_ROI
83 | 80 R_IFJp_ROI
84 | 81 R_IFSp_ROI
85 | 82 R_IFSa_ROI
86 | 83 R_p9-46v_ROI
87 | 84 R_46_ROI
88 | 85 R_a9-46v_ROI
89 | 86 R_9-46d_ROI
90 | 87 R_9a_ROI
91 | 88 R_10v_ROI
92 | 89 R_a10p_ROI
93 | 90 R_10pp_ROI
94 | 91 R_11l_ROI
95 | 92 R_13l_ROI
96 | 93 R_OFC_ROI
97 | 94 R_47s_ROI
98 | 95 R_LIPd_ROI
99 | 96 R_6a_ROI
100 | 97 R_i6-8_ROI
101 | 98 R_s6-8_ROI
102 | 99 R_43_ROI
103 | 100 R_OP4_ROI
104 | 101 R_OP1_ROI
105 | 102 R_OP2-3_ROI
106 | 103 R_52_ROI
107 | 104 R_RI_ROI
108 | 105 R_PFcm_ROI
109 | 106 R_PoI2_ROI
110 | 107 R_TA2_ROI
111 | 108 R_FOP4_ROI
112 | 109 R_MI_ROI
113 | 110 R_Pir_ROI
114 | 111 R_AVI_ROI
115 | 112 R_AAIC_ROI
116 | 113 R_FOP1_ROI
117 | 114 R_FOP3_ROI
118 | 115 R_FOP2_ROI
119 | 116 R_PFt_ROI
120 | 117 R_AIP_ROI
121 | 118 R_EC_ROI
122 | 119 R_PreS_ROI
123 | 120 R_H_ROI
124 | 121 R_ProS_ROI
125 | 122 R_PeEc_ROI
126 | 123 R_STGa_ROI
127 | 124 R_PBelt_ROI
128 | 125 R_A5_ROI
129 | 126 R_PHA1_ROI
130 | 127 R_PHA3_ROI
131 | 128 R_STSda_ROI
132 | 129 R_STSdp_ROI
133 | 130 R_STSvp_ROI
134 | 131 R_TGd_ROI
135 | 132 R_TE1a_ROI
136 | 133 R_TE1p_ROI
137 | 134 R_TE2a_ROI
138 | 135 R_TF_ROI
139 | 136 R_TE2p_ROI
140 | 137 R_PHT_ROI
141 | 138 R_PH_ROI
142 | 139 R_TPOJ1_ROI
143 | 140 R_TPOJ2_ROI
144 | 141 R_TPOJ3_ROI
145 | 142 R_DVT_ROI
146 | 143 R_PGp_ROI
147 | 144 R_IP2_ROI
148 | 145 R_IP1_ROI
149 | 146 R_IP0_ROI
150 | 147 R_PFop_ROI
151 | 148 R_PF_ROI
152 | 149 R_PFm_ROI
153 | 150 R_PGi_ROI
154 | 151 R_PGs_ROI
155 | 152 R_V6A_ROI
156 | 153 R_VMV1_ROI
157 | 154 R_VMV3_ROI
158 | 155 R_PHA2_ROI
159 | 156 R_V4t_ROI
160 | 157 R_FST_ROI
161 | 158 R_V3CD_ROI
162 | 159 R_LO3_ROI
163 | 160 R_VMV2_ROI
164 | 161 R_31pd_ROI
165 | 162 R_31a_ROI
166 | 163 R_VVC_ROI
167 | 164 R_25_ROI
168 | 165 R_s32_ROI
169 | 166 R_pOFC_ROI
170 | 167 R_PoI1_ROI
171 | 168 R_Ig_ROI
172 | 169 R_FOP5_ROI
173 | 170 R_p10p_ROI
174 | 171 R_p47r_ROI
175 | 172 R_TGv_ROI
176 | 173 R_MBelt_ROI
177 | 174 R_LBelt_ROI
178 | 175 R_A4_ROI
179 | 176 R_STSva_ROI
180 | 177 R_TE1m_ROI
181 | 178 R_PI_ROI
182 | 179 R_a32pr_ROI
183 | 180 R_p24_ROI
184 | 181 L_V1_ROI
185 | 182 L_MST_ROI
186 | 183 L_V6_ROI
187 | 184 L_V2_ROI
188 | 185 L_V3_ROI
189 | 186 L_V4_ROI
190 | 187 L_V8_ROI
191 | 188 L_4_ROI
192 | 189 L_3b_ROI
193 | 190 L_FEF_ROI
194 | 191 L_PEF_ROI
195 | 192 L_55b_ROI
196 | 193 L_V3A_ROI
197 | 194 L_RSC_ROI
198 | 195 L_POS2_ROI
199 | 196 L_V7_ROI
200 | 197 L_IPS1_ROI
201 | 198 L_FFC_ROI
202 | 199 L_V3B_ROI
203 | 200 L_LO1_ROI
204 | 201 L_LO2_ROI
205 | 202 L_PIT_ROI
206 | 203 L_MT_ROI
207 | 204 L_A1_ROI
208 | 205 L_PSL_ROI
209 | 206 L_SFL_ROI
210 | 207 L_PCV_ROI
211 | 208 L_STV_ROI
212 | 209 L_7Pm_ROI
213 | 210 L_7m_ROI
214 | 211 L_POS1_ROI
215 | 212 L_23d_ROI
216 | 213 L_v23ab_ROI
217 | 214 L_d23ab_ROI
218 | 215 L_31pv_ROI
219 | 216 L_5m_ROI
220 | 217 L_5mv_ROI
221 | 218 L_23c_ROI
222 | 219 L_5L_ROI
223 | 220 L_24dd_ROI
224 | 221 L_24dv_ROI
225 | 222 L_7AL_ROI
226 | 223 L_SCEF_ROI
227 | 224 L_6ma_ROI
228 | 225 L_7Am_ROI
229 | 226 L_7PL_ROI
230 | 227 L_7PC_ROI
231 | 228 L_LIPv_ROI
232 | 229 L_VIP_ROI
233 | 230 L_MIP_ROI
234 | 231 L_1_ROI
235 | 232 L_2_ROI
236 | 233 L_3a_ROI
237 | 234 L_6d_ROI
238 | 235 L_6mp_ROI
239 | 236 L_6v_ROI
240 | 237 L_p24pr_ROI
241 | 238 L_33pr_ROI
242 | 239 L_a24pr_ROI
243 | 240 L_p32pr_ROI
244 | 241 L_a24_ROI
245 | 242 L_d32_ROI
246 | 243 L_8BM_ROI
247 | 244 L_p32_ROI
248 | 245 L_10r_ROI
249 | 246 L_47m_ROI
250 | 247 L_8Av_ROI
251 | 248 L_8Ad_ROI
252 | 249 L_9m_ROI
253 | 250 L_8BL_ROI
254 | 251 L_9p_ROI
255 | 252 L_10d_ROI
256 | 253 L_8C_ROI
257 | 254 L_44_ROI
258 | 255 L_45_ROI
259 | 256 L_47l_ROI
260 | 257 L_a47r_ROI
261 | 258 L_6r_ROI
262 | 259 L_IFJa_ROI
263 | 260 L_IFJp_ROI
264 | 261 L_IFSp_ROI
265 | 262 L_IFSa_ROI
266 | 263 L_p9-46v_ROI
267 | 264 L_46_ROI
268 | 265 L_a9-46v_ROI
269 | 266 L_9-46d_ROI
270 | 267 L_9a_ROI
271 | 268 L_10v_ROI
272 | 269 L_a10p_ROI
273 | 270 L_10pp_ROI
274 | 271 L_11l_ROI
275 | 272 L_13l_ROI
276 | 273 L_OFC_ROI
277 | 274 L_47s_ROI
278 | 275 L_LIPd_ROI
279 | 276 L_6a_ROI
280 | 277 L_i6-8_ROI
281 | 278 L_s6-8_ROI
282 | 279 L_43_ROI
283 | 280 L_OP4_ROI
284 | 281 L_OP1_ROI
285 | 282 L_OP2-3_ROI
286 | 283 L_52_ROI
287 | 284 L_RI_ROI
288 | 285 L_PFcm_ROI
289 | 286 L_PoI2_ROI
290 | 287 L_TA2_ROI
291 | 288 L_FOP4_ROI
292 | 289 L_MI_ROI
293 | 290 L_Pir_ROI
294 | 291 L_AVI_ROI
295 | 292 L_AAIC_ROI
296 | 293 L_FOP1_ROI
297 | 294 L_FOP3_ROI
298 | 295 L_FOP2_ROI
299 | 296 L_PFt_ROI
300 | 297 L_AIP_ROI
301 | 298 L_EC_ROI
302 | 299 L_PreS_ROI
303 | 300 L_H_ROI
304 | 301 L_ProS_ROI
305 | 302 L_PeEc_ROI
306 | 303 L_STGa_ROI
307 | 304 L_PBelt_ROI
308 | 305 L_A5_ROI
309 | 306 L_PHA1_ROI
310 | 307 L_PHA3_ROI
311 | 308 L_STSda_ROI
312 | 309 L_STSdp_ROI
313 | 310 L_STSvp_ROI
314 | 311 L_TGd_ROI
315 | 312 L_TE1a_ROI
316 | 313 L_TE1p_ROI
317 | 314 L_TE2a_ROI
318 | 315 L_TF_ROI
319 | 316 L_TE2p_ROI
320 | 317 L_PHT_ROI
321 | 318 L_PH_ROI
322 | 319 L_TPOJ1_ROI
323 | 320 L_TPOJ2_ROI
324 | 321 L_TPOJ3_ROI
325 | 322 L_DVT_ROI
326 | 323 L_PGp_ROI
327 | 324 L_IP2_ROI
328 | 325 L_IP1_ROI
329 | 326 L_IP0_ROI
330 | 327 L_PFop_ROI
331 | 328 L_PF_ROI
332 | 329 L_PFm_ROI
333 | 330 L_PGi_ROI
334 | 331 L_PGs_ROI
335 | 332 L_V6A_ROI
336 | 333 L_VMV1_ROI
337 | 334 L_VMV3_ROI
338 | 335 L_PHA2_ROI
339 | 336 L_V4t_ROI
340 | 337 L_FST_ROI
341 | 338 L_V3CD_ROI
342 | 339 L_LO3_ROI
343 | 340 L_VMV2_ROI
344 | 341 L_31pd_ROI
345 | 342 L_31a_ROI
346 | 343 L_VVC_ROI
347 | 344 L_25_ROI
348 | 345 L_s32_ROI
349 | 346 L_pOFC_ROI
350 | 347 L_PoI1_ROI
351 | 348 L_Ig_ROI
352 | 349 L_FOP5_ROI
353 | 350 L_p10p_ROI
354 | 351 L_p47r_ROI
355 | 352 L_TGv_ROI
356 | 353 L_MBelt_ROI
357 | 354 L_LBelt_ROI
358 | 355 L_A4_ROI
359 | 356 L_STSva_ROI
360 | 357 L_TE1m_ROI
361 | 358 L_PI_ROI
362 | 359 L_a32pr_ROI
363 | 360 L_p24_ROI
364 | 361 Left-Cerebellum-Cortex
365 | 362 Left-Thalamus-Proper
366 | 363 Left-Caudate
367 | 364 Left-Putamen
368 | 365 Left-Pallidum
369 | 379 Brain-Stem
370 | 366 Left-Hippocampus
371 | 367 Left-Amygdala
372 | 368 Left-Accumbens-area
373 | 369 Left-VentralDC
374 | 370 Right-Cerebellum-Cortex
375 | 371 Right-Thalamus-Proper
376 | 372 Right-Caudate
377 | 373 Right-Putamen
378 | 374 Right-Pallidum
379 | 375 Right-Hippocampus
380 | 376 Right-Amygdala
381 | 377 Right-Accumbens-area
382 | 378 Right-VentralDC
383 | 379 Brainstem (only in FC since tractography was performed w/o brainstem)
384 |
--------------------------------------------------------------------------------
/data-preprocessing/demographics-behavioral-FC-SC/BNM-input/preprocess_HCP_data.m:
--------------------------------------------------------------------------------
1 | clear
2 | close all
3 | clc
4 |
5 | % Read HCP FreeSurfer statistics (needs to be obtained from HCP)
6 | T_fs = readtable('freesurfer_unrestricted_....csv');
7 | T_fs_study = table(T_fs.Subject);
8 | T_fs_study.FS_IntraCranial_Vol = T_fs.FS_IntraCranial_Vol;
9 | T_fs_study.FS_BrainSeg_Vol = T_fs.FS_BrainSeg_Vol;
10 |
11 | Afs = table2array(T_fs_study);
12 |
13 | % take the cube-root as done in Smith et al. Nat Neuro
14 | Afs(:,2:3) = nthroot(Afs(:,2:3), 3);
15 | save('study_data_fs.mat','Afs');
16 |
17 | %%
18 | clear
19 | close all
20 | clc
21 |
22 | % Read HCP unrestricted demographics data (needs to be obtained from HCP)
23 | T = readtable('demographicsunrestricted_....csv');
24 |
25 | %%%
26 | % https://wiki.humanconnectome.org/display/PublicData/HCP-YA+Data+Dictionary-+Updated+for+the+1200+Subject+Release
27 |
28 | T_study = table(T.Subject);
29 |
30 | % Select all interesting measures
31 | T_study.Flanker_AgeAdj = T.Flanker_AgeAdj; % The Flanker task measures both a participant?s attention and inhibitory control.
32 | T_study.CardSort_AgeAdj = T.CardSort_AgeAdj; % DCCS is a measure of cognitive flexibility
33 | T_study.PicSeq_AgeAdj = T.PicSeq_AgeAdj; % Picture Sequence Memory Test for the assessment of episodic memory
34 | T_study.ListSort_AgeAdj = T.ListSort_AgeAdj ; %
35 | T_study.ProcSpeed_AgeAdj = T.ProcSpeed_AgeAdj; % Pattern Comparison Processing Speed Test
36 | T_study.PicVocab_AgeAdj = T.PicVocab_AgeAdj; % Picture Vocabulary Test
37 | T_study.ReadEng_AgeAdj = T.ReadEng_AgeAdj; % Oral Reading Recognition Test
38 |
39 | T_study.Flanker_Unadj = T.Flanker_Unadj; % The Flanker task measures both a participant?s attention and inhibitory control.
40 | T_study.CardSort_Unadj = T.CardSort_Unadj; % DCCS is a measure of cognitive flexibility
41 | T_study.PicSeq_Unadj = T.PicSeq_Unadj; % Picture Sequence Memory Test for the assessment of episodic memory
42 | T_study.ListSort_Unadj = T.ListSort_Unadj ; %
43 | T_study.ProcSpeed_Unadj = T.ProcSpeed_Unadj; % Pattern Comparison Processing Speed Test
44 | T_study.PicVocab_Unadj = T.PicVocab_Unadj; % Picture Vocabulary Test
45 | T_study.ReadEng_Unadj = T.ReadEng_Unadj; % Oral Reading Recognition Test
46 |
47 | T_study.PSQI_Score = T.PSQI_Score; % Pittsburgh Sleep Quality Questionnaire
48 | T_study.PMAT24_A_CR = T.PMAT24_A_CR; % Penn Progressive Matrices: Number of Correct Responses
49 | T_study.PMAT24_A_SI = T.PMAT24_A_SI; % Penn Progressive Matrices: Total Skipped Items
50 | T_study.PMAT24_A_RTCR = T.PMAT24_A_RTCR; % Penn Progressive Matrices: Median Reaction Time for Correct Responses
51 | T_study.DDisc_AUC_200 = T.DDisc_AUC_200; % Delay Discounting: Area Under the Curve for Discounting of $200
52 | T_study.DDisc_AUC_40K = T.DDisc_AUC_40K; % Delay Discounting: Area Under the Curve for Discounting of $40,000
53 | T_study.VSPLOT_TC = T.VSPLOT_TC; % Variable Short Penn Line Orientation: Total Number Correct
54 | %T_study.VSPLOT_CRTE = T.VSPLOT_CRTE ; % Variable Short Penn Line Orientation: Median Reaction Time Divided by Expected Number of Clicks for Correct
55 | %T_study.VSPLOT_OFF = T.VSPLOT_OFF ; % Variable Short Penn Line Orientation: Total Positions Off for All Trials
56 | T_study.SCPT_SEN = T.SCPT_SEN ; %
57 | T_study.SCPT_SPEC = T.SCPT_SPEC ; %
58 | T_study.IWRD_TOT = T.IWRD_TOT ; %
59 | %T_study.IWRD_RTC = T.IWRD_RTC ; %
60 | T_study.ER40_CR = T.ER40_CR ; %
61 | %T_study.ER40_CRT = T.ER40_CRT ; %
62 | T_study.AngAffect_Unadj = T.AngAffect_Unadj ; %
63 | T_study.AngHostil_Unadj = T.AngHostil_Unadj ; %
64 | T_study.AngAggr_Unadj = T.AngAggr_Unadj ; %
65 | T_study.FearAffect_Unadj = T.FearAffect_Unadj ; %
66 | T_study.FearSomat_Unadj = T.FearSomat_Unadj ; %
67 | T_study.Sadness_Unadj = T.Sadness_Unadj ; %
68 | T_study.LifeSatisf_Unadj = T.LifeSatisf_Unadj ; %
69 | T_study.MeanPurp_Unadj = T.MeanPurp_Unadj ; %
70 | T_study.PosAffect_Unadj = T.PosAffect_Unadj ; %
71 | T_study.Friendship_Unadj = T.Friendship_Unadj ; %
72 | T_study.Loneliness_Unadj = T.Loneliness_Unadj ; %
73 | T_study.PercHostil_Unadj = T.PercHostil_Unadj ; %
74 | T_study.PercReject_Unadj = T.PercReject_Unadj ; %
75 | T_study.EmotSupp_Unadj = T.EmotSupp_Unadj ; %
76 | T_study.InstruSupp_Unadj = T.InstruSupp_Unadj ; %
77 | T_study.PercStress_Unadj = T.PercStress_Unadj ; %
78 | T_study.SelfEff_Unadj = T.SelfEff_Unadj ; %
79 | %T_study.Endurance_AgeAdj = T.Endurance_AgeAdj ; %
80 | %T_study.GaitSpeed_Comp = T.GaitSpeed_Comp ; %
81 | T_study.Dexterity_AgeAdj = T.Dexterity_AgeAdj ; %
82 | %T_study.Strength_AgeAdj = T.Strength_AgeAdj ; %
83 | T_study.NEOFAC_A = T.NEOFAC_A ; %
84 | T_study.NEOFAC_O = T.NEOFAC_O ; %
85 | T_study.NEOFAC_C = T.NEOFAC_C ; %
86 | T_study.NEOFAC_N = T.NEOFAC_N ; %
87 | T_study.NEOFAC_E = T.NEOFAC_E ; %
88 | T_study.Noise_Comp = T.Noise_Comp ; %
89 | T_study.Odor_AgeAdj = T.Odor_AgeAdj ; %
90 | T_study.Taste_AgeAdj = T.Taste_AgeAdj ; %
91 | T_study.WM_Task_2bk_Acc = T.WM_Task_2bk_Acc ; %
92 | T_study.WM_Task_2bk_Median_RT = T.WM_Task_2bk_Median_RT ; %
93 | T_study.WM_Task_0bk_Acc = T.WM_Task_0bk_Acc ; %
94 | T_study.WM_Task_0bk_Median_RT = T.WM_Task_0bk_Median_RT ; %
95 | %T_study.Mars_Log_Score = T.Mars_Log_Score;
96 | T_study.Mars_Final = T.Mars_Final;
97 |
98 |
99 | % Convert table to matrix
100 | A = table2array(T_study);
101 |
102 | % recon-all version --> needed as confounder
103 | reconver=T.fMRI_3T_ReconVrs;
104 | which_newer=strcmp('r227',reconver);
105 | which_older=strcmp('r177',reconver);
106 |
107 | % up to now confounds variable consists of recon-all vers. brain volume,
108 | % intracranial volume
109 | confounds = nan(size(A,1),4);
110 | confounds(:,1) = A(:,1);
111 | confounds(which_newer,2) = 1;
112 | confounds(which_older,2) = 0;
113 |
114 | % load fs-stats (intracranial volume, brain volume)
115 | load('study_data_fs.mat')
116 | indexing = find(A(:,1)==Afs(:,1));
117 | confounds(:,3:4) = Afs(indexing,2:3);
118 |
119 |
120 | % select only those subjects for which we have complete information
121 | incompl=isnan(confounds(:,2)) + isnan(confounds(:,3))+ isnan(confounds(:,4));
122 | incompl=incompl>0;
123 | A = A(~incompl,:);
124 | confounds = confounds(~incompl,:);
125 |
126 |
127 | % From which subjects do we have SC and FC?
128 | %clear
129 | % FC
130 | cd('../FC');
131 | files = dir('*FC.mat');
132 | for ii = 1:length(files)
133 | sub_id_FC(ii) = str2double(strtok(files(ii).name,'_'));
134 | end
135 | % SC
136 | cd('../SC');
137 | files = dir('*SC.mat');
138 | for ii = 1:length(files)
139 | sub_id_SC(ii) = str2double(strtok(files(ii).name,'_'));
140 | end
141 |
142 | % which are in both?
143 | sub_id = intersect(sub_id_FC, sub_id_SC);
144 |
145 | %%% Select only those subjects for which we have SC and FC
146 | [C,ia,ib] = intersect(A(:,1),sub_id);
147 | A_study = A(ia,:);
148 | confounds_study = confounds(ia,:);
149 |
150 | % remove subjects with incomplete tests (nan)
151 | complete_subs = find(sum(isnan(A_study)')==0);
152 | A_study = A_study(complete_subs,:);
153 | confounds_study = confounds_study(complete_subs,:);
154 |
155 | A_final = A_study(:,2:end);
156 | confounds_final = confounds_study(:,2:end);
157 | cc=corr(A_final);
158 | figure;imagesc(cc);colorbar
159 | cd('..');
160 | save('study_data.mat')
161 | save('study_data_agg.mat','A_final','confounds_final','A_study')
162 | %%
163 | %%% Find robust set of connections by computing average SC
164 | subjects = A_study(:,1);
165 | mean_SC = zeros(379,379);
166 | for ii = 1:length(subjects)
167 | SC = load(['../SC/' num2str(subjects(ii)) '_SC.mat']);
168 | SC = SC.SC.weights;
169 | mean_SC = mean_SC + SC;
170 | end
171 | mean_SC = mean_SC / length(subjects);
172 | save('mean_SC.mat','mean_SC');
173 |
174 | %%% use only those connections that are robustly existent in all subjects
175 | subjects = A_study(:,1);
176 | num_conn_SC = zeros(379,379);
177 | for ii = 1:length(subjects)
178 | SC = load(['../SC/' num2str(subjects(ii)) '_SC.mat']);
179 | SC = SC.SC.weights;
180 | %SC(SC < median(SC(:))) = 0;
181 | SC(SC~=0) = 1;
182 | num_conn_SC = num_conn_SC + SC;
183 | end
184 |
185 | % use only connections that were present in at least 99 % of all subjects
186 | mask_SC = num_conn_SC >= 0.99*length(subjects);
187 |
188 | save('num_conn_SC.mat','num_conn_SC', 'mask_SC');
189 |
190 | %% Construct brain model input
191 | clear
192 | close all
193 | clc
194 | load('study_data.mat');
195 | load('mean_SC.mat');
196 | load('num_conn_SC.mat');
197 |
198 | subjects = A_study(:,1);
199 |
200 |
201 | % get max for normalization
202 | th_SC = mean_SC;
203 | th_SC(~mask_SC) = 0;
204 | norm_fact = max(sqrt(th_SC(:)));
205 |
206 |
207 | for ii = 1:length(subjects)
208 | FC = load(['../FC/' num2str(subjects(ii)) '_FC.mat']);
209 | FC = FC.FC.MMP_avg;
210 | SC = load(['../SC/' num2str(subjects(ii)) '_SC.mat']);
211 | SC_len = SC.SC.distances;
212 | SC = SC.SC.weights;
213 | SC = sqrt(SC);
214 | SC = SC ./ norm_fact;
215 | SC = SC ./ 10;
216 |
217 | SC(~mask_SC) = 0;
218 | SC_len(~mask_SC) = 0;
219 |
220 | mkdir(['../BNM_models/' num2str(subjects(ii))]);
221 | mkdir(['../BNM_models/' num2str(subjects(ii)) '/input/']);
222 | mkdir(['../BNM_models/' num2str(subjects(ii)) '/output/']);
223 | output_filestem = ['../BNM_models/' num2str(subjects(ii)) '/input/'];
224 | Generate_TVBii_input_FFI(num2str(subjects(ii)), FC, SC, SC_len, output_filestem)
225 | end
226 |
227 | %% Concatenate SC matrices of all coherently existing connections
228 | clear
229 | close all
230 | clc
231 |
232 | load('study_data.mat');
233 | load('mean_SC.mat');
234 | load('num_conn_SC.mat');
235 |
236 | subjects = A_study(:,1);
237 |
238 | % SC connections that are present in all subjects
239 | coherent_SC = find(num_conn_SC == length(subjects));
240 |
241 | % get max for normalization
242 | th_SC = mean_SC;
243 | th_SC(~mask_SC) = 0;
244 | norm_fact = max(sqrt(th_SC(:)));
245 |
246 | agg_SC = nan(length(subjects),length(coherent_SC));
247 |
248 | for ii = 1:length(subjects)
249 | SC = load(['../SC/' num2str(subjects(ii)) '_SC.mat']);
250 | SC = SC.SC.weights;
251 | SC = sqrt(SC);
252 | SC = SC ./ norm_fact;
253 | SC = SC ./ 10;
254 | SC = SC(:);
255 | SC = SC(coherent_SC);
256 | agg_SC(ii,:) = SC;
257 | end
258 |
259 | save('agg_coherent_SC.mat','subjects','agg_SC')
260 |
261 | %% Concatenate FC matrices
262 | cd('../FC');
263 | subjects = A_study(:,1);
264 | Isubdiag = find(tril(ones(379),-1));
265 |
266 | concat_FC = zeros(length(subjects), length(Isubdiag));
267 |
268 | for ii = 1:length(subjects)
269 | fc = load([num2str(subjects(ii)) '_FC.mat']);
270 | concat_FC(ii,:) = fc.FC.MMP_avg(Isubdiag);
271 | end
272 | cd('..')
273 | save('concat_FCs.mat','concat_FC')
274 |
275 |
276 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright © 2023 Charité Universitätsmedizin Berlin. This software includes
2 | technology that is the subject of pending patent application No. 23 166 587.8 at
3 | the European Patent Office. The patent application has been filed by the
4 | Charité Universitätsmedizin Berlin. This software is licensed under the terms of
5 | the European Union Public Licence (EUPL) version 1.2 or later.
6 |
7 |
8 | EUROPEAN UNION PUBLIC LICENCE v. 1.2
9 | EUPL © the European Union 2007, 2016
10 |
11 | This European Union Public Licence (the ‘EUPL’) applies to the Work (as defined
12 | below) which is provided under the terms of this Licence. Any use of the Work,
13 | other than as authorised under this Licence is prohibited (to the extent such
14 | use is covered by a right of the copyright holder of the Work).
15 |
16 | The Work is provided under the terms of this Licence when the Licensor (as
17 | defined below) has placed the following notice immediately following the
18 | copyright notice for the Work:
19 |
20 | Licensed under the EUPL
21 |
22 | or has expressed by any other means his willingness to license under the EUPL.
23 |
24 | 1. Definitions
25 |
26 | In this Licence, the following terms have the following meaning:
27 |
28 | - ‘The Licence’: this Licence.
29 |
30 | - ‘The Original Work’: the work or software distributed or communicated by the
31 | Licensor under this Licence, available as Source Code and also as Executable
32 | Code as the case may be.
33 |
34 | - ‘Derivative Works’: the works or software that could be created by the
35 | Licensee, based upon the Original Work or modifications thereof. This Licence
36 | does not define the extent of modification or dependence on the Original Work
37 | required in order to classify a work as a Derivative Work; this extent is
38 | determined by copyright law applicable in the country mentioned in Article 15.
39 |
40 | - ‘The Work’: the Original Work or its Derivative Works.
41 |
42 | - ‘The Source Code’: the human-readable form of the Work which is the most
43 | convenient for people to study and modify.
44 |
45 | - ‘The Executable Code’: any code which has generally been compiled and which is
46 | meant to be interpreted by a computer as a program.
47 |
48 | - ‘The Licensor’: the natural or legal person that distributes or communicates
49 | the Work under the Licence.
50 |
51 | - ‘Contributor(s)’: any natural or legal person who modifies the Work under the
52 | Licence, or otherwise contributes to the creation of a Derivative Work.
53 |
54 | - ‘The Licensee’ or ‘You’: any natural or legal person who makes any usage of
55 | the Work under the terms of the Licence.
56 |
57 | - ‘Distribution’ or ‘Communication’: any act of selling, giving, lending,
58 | renting, distributing, communicating, transmitting, or otherwise making
59 | available, online or offline, copies of the Work or providing access to its
60 | essential functionalities at the disposal of any other natural or legal
61 | person.
62 |
63 | 2. Scope of the rights granted by the Licence
64 |
65 | The Licensor hereby grants You a worldwide, royalty-free, non-exclusive,
66 | sublicensable licence to do the following, for the duration of copyright vested
67 | in the Original Work:
68 |
69 | - use the Work in any circumstance and for all usage,
70 | - reproduce the Work,
71 | - modify the Work, and make Derivative Works based upon the Work,
72 | - communicate to the public, including the right to make available or display
73 | the Work or copies thereof to the public and perform publicly, as the case may
74 | be, the Work,
75 | - distribute the Work or copies thereof,
76 | - lend and rent the Work or copies thereof,
77 | - sublicense rights in the Work or copies thereof.
78 |
79 | Those rights can be exercised on any media, supports and formats, whether now
80 | known or later invented, as far as the applicable law permits so.
81 |
82 | In the countries where moral rights apply, the Licensor waives his right to
83 | exercise his moral right to the extent allowed by law in order to make effective
84 | the licence of the economic rights here above listed.
85 |
86 | The Licensor grants to the Licensee royalty-free, non-exclusive usage rights to
87 | any patents held by the Licensor, to the extent necessary to make use of the
88 | rights granted on the Work under this Licence.
89 |
90 | 3. Communication of the Source Code
91 |
92 | The Licensor may provide the Work either in its Source Code form, or as
93 | Executable Code. If the Work is provided as Executable Code, the Licensor
94 | provides in addition a machine-readable copy of the Source Code of the Work
95 | along with each copy of the Work that the Licensor distributes or indicates, in
96 | a notice following the copyright notice attached to the Work, a repository where
97 | the Source Code is easily and freely accessible for as long as the Licensor
98 | continues to distribute or communicate the Work.
99 |
100 | 4. Limitations on copyright
101 |
102 | Nothing in this Licence is intended to deprive the Licensee of the benefits from
103 | any exception or limitation to the exclusive rights of the rights owners in the
104 | Work, of the exhaustion of those rights or of other applicable limitations
105 | thereto.
106 |
107 | 5. Obligations of the Licensee
108 |
109 | The grant of the rights mentioned above is subject to some restrictions and
110 | obligations imposed on the Licensee. Those obligations are the following:
111 |
112 | Attribution right: The Licensee shall keep intact all copyright, patent or
113 | trademarks notices and all notices that refer to the Licence and to the
114 | disclaimer of warranties. The Licensee must include a copy of such notices and a
115 | copy of the Licence with every copy of the Work he/she distributes or
116 | communicates. The Licensee must cause any Derivative Work to carry prominent
117 | notices stating that the Work has been modified and the date of modification.
118 |
119 | Copyleft clause: If the Licensee distributes or communicates copies of the
120 | Original Works or Derivative Works, this Distribution or Communication will be
121 | done under the terms of this Licence or of a later version of this Licence
122 | unless the Original Work is expressly distributed only under this version of the
123 | Licence — for example by communicating ‘EUPL v. 1.2 only’. The Licensee
124 | (becoming Licensor) cannot offer or impose any additional terms or conditions on
125 | the Work or Derivative Work that alter or restrict the terms of the Licence.
126 |
127 | Compatibility clause: If the Licensee Distributes or Communicates Derivative
128 | Works or copies thereof based upon both the Work and another work licensed under
129 | a Compatible Licence, this Distribution or Communication can be done under the
130 | terms of this Compatible Licence. For the sake of this clause, ‘Compatible
131 | Licence’ refers to the licences listed in the appendix attached to this Licence.
132 | Should the Licensee's obligations under the Compatible Licence conflict with
133 | his/her obligations under this Licence, the obligations of the Compatible
134 | Licence shall prevail.
135 |
136 | Provision of Source Code: When distributing or communicating copies of the Work,
137 | the Licensee will provide a machine-readable copy of the Source Code or indicate
138 | a repository where this Source will be easily and freely available for as long
139 | as the Licensee continues to distribute or communicate the Work.
140 |
141 | Legal Protection: This Licence does not grant permission to use the trade names,
142 | trademarks, service marks, or names of the Licensor, except as required for
143 | reasonable and customary use in describing the origin of the Work and
144 | reproducing the content of the copyright notice.
145 |
146 | 6. Chain of Authorship
147 |
148 | The original Licensor warrants that the copyright in the Original Work granted
149 | hereunder is owned by him/her or licensed to him/her and that he/she has the
150 | power and authority to grant the Licence.
151 |
152 | Each Contributor warrants that the copyright in the modifications he/she brings
153 | to the Work are owned by him/her or licensed to him/her and that he/she has the
154 | power and authority to grant the Licence.
155 |
156 | Each time You accept the Licence, the original Licensor and subsequent
157 | Contributors grant You a licence to their contributions to the Work, under the
158 | terms of this Licence.
159 |
160 | 7. Disclaimer of Warranty
161 |
162 | The Work is a work in progress, which is continuously improved by numerous
163 | Contributors. It is not a finished work and may therefore contain defects or
164 | ‘bugs’ inherent to this type of development.
165 |
166 | For the above reason, the Work is provided under the Licence on an ‘as is’ basis
167 | and without warranties of any kind concerning the Work, including without
168 | limitation merchantability, fitness for a particular purpose, absence of defects
169 | or errors, accuracy, non-infringement of intellectual property rights other than
170 | copyright as stated in Article 6 of this Licence.
171 |
172 | This disclaimer of warranty is an essential part of the Licence and a condition
173 | for the grant of any rights to the Work.
174 |
175 | 8. Disclaimer of Liability
176 |
177 | Except in the cases of wilful misconduct or damages directly caused to natural
178 | persons, the Licensor will in no event be liable for any direct or indirect,
179 | material or moral, damages of any kind, arising out of the Licence or of the use
180 | of the Work, including without limitation, damages for loss of goodwill, work
181 | stoppage, computer failure or malfunction, loss of data or any commercial
182 | damage, even if the Licensor has been advised of the possibility of such damage.
183 | However, the Licensor will be liable under statutory product liability laws as
184 | far such laws apply to the Work.
185 |
186 | 9. Additional agreements
187 |
188 | While distributing the Work, You may choose to conclude an additional agreement,
189 | defining obligations or services consistent with this Licence. However, if
190 | accepting obligations, You may act only on your own behalf and on your sole
191 | responsibility, not on behalf of the original Licensor or any other Contributor,
192 | and only if You agree to indemnify, defend, and hold each Contributor harmless
193 | for any liability incurred by, or claims asserted against such Contributor by
194 | the fact You have accepted any warranty or additional liability.
195 |
196 | 10. Acceptance of the Licence
197 |
198 | The provisions of this Licence can be accepted by clicking on an icon ‘I agree’
199 | placed under the bottom of a window displaying the text of this Licence or by
200 | affirming consent in any other similar way, in accordance with the rules of
201 | applicable law. Clicking on that icon indicates your clear and irrevocable
202 | acceptance of this Licence and all of its terms and conditions.
203 |
204 | Similarly, you irrevocably accept this Licence and all of its terms and
205 | conditions by exercising any rights granted to You by Article 2 of this Licence,
206 | such as the use of the Work, the creation by You of a Derivative Work or the
207 | Distribution or Communication by You of the Work or copies thereof.
208 |
209 | 11. Information to the public
210 |
211 | In case of any Distribution or Communication of the Work by means of electronic
212 | communication by You (for example, by offering to download the Work from a
213 | remote location) the distribution channel or media (for example, a website) must
214 | at least provide to the public the information requested by the applicable law
215 | regarding the Licensor, the Licence and the way it may be accessible, concluded,
216 | stored and reproduced by the Licensee.
217 |
218 | 12. Termination of the Licence
219 |
220 | The Licence and the rights granted hereunder will terminate automatically upon
221 | any breach by the Licensee of the terms of the Licence.
222 |
223 | Such a termination will not terminate the licences of any person who has
224 | received the Work from the Licensee under the Licence, provided such persons
225 | remain in full compliance with the Licence.
226 |
227 | 13. Miscellaneous
228 |
229 | Without prejudice of Article 9 above, the Licence represents the complete
230 | agreement between the Parties as to the Work.
231 |
232 | If any provision of the Licence is invalid or unenforceable under applicable
233 | law, this will not affect the validity or enforceability of the Licence as a
234 | whole. Such provision will be construed or reformed so as necessary to make it
235 | valid and enforceable.
236 |
237 | The European Commission may publish other linguistic versions or new versions of
238 | this Licence or updated versions of the Appendix, so far this is required and
239 | reasonable, without reducing the scope of the rights granted by the Licence. New
240 | versions of the Licence will be published with a unique version number.
241 |
242 | All linguistic versions of this Licence, approved by the European Commission,
243 | have identical value. Parties can take advantage of the linguistic version of
244 | their choice.
245 |
246 | 14. Jurisdiction
247 |
248 | Without prejudice to specific agreement between parties,
249 |
250 | - any litigation resulting from the interpretation of this License, arising
251 | between the European Union institutions, bodies, offices or agencies, as a
252 | Licensor, and any Licensee, will be subject to the jurisdiction of the Court
253 | of Justice of the European Union, as laid down in article 272 of the Treaty on
254 | the Functioning of the European Union,
255 |
256 | - any litigation arising between other parties and resulting from the
257 | interpretation of this License, will be subject to the exclusive jurisdiction
258 | of the competent court where the Licensor resides or conducts its primary
259 | business.
260 |
261 | 15. Applicable Law
262 |
263 | Without prejudice to specific agreement between parties,
264 |
265 | - this Licence shall be governed by the law of the European Union Member State
266 | where the Licensor has his seat, resides or has his registered office,
267 |
268 | - this licence shall be governed by Belgian law if the Licensor has no seat,
269 | residence or registered office inside a European Union Member State.
270 |
271 | Appendix
272 |
273 | ‘Compatible Licences’ according to Article 5 EUPL are:
274 |
275 | - GNU General Public License (GPL) v. 2, v. 3
276 | - GNU Affero General Public License (AGPL) v. 3
277 | - Open Software License (OSL) v. 2.1, v. 3.0
278 | - Eclipse Public License (EPL) v. 1.0
279 | - CeCILL v. 2.0, v. 2.1
280 | - Mozilla Public Licence (MPL) v. 2
281 | - GNU Lesser General Public Licence (LGPL) v. 2.1, v. 3
282 | - Creative Commons Attribution-ShareAlike v. 3.0 Unported (CC BY-SA 3.0) for
283 | works other than software
284 | - European Union Public Licence (EUPL) v. 1.1, v. 1.2
285 | - Québec Free and Open-Source Licence — Reciprocity (LiLiQ-R) or Strong
286 | Reciprocity (LiLiQ-R+).
287 |
288 | The European Commission may update this Appendix to later versions of the above
289 | licences without producing a new version of the EUPL, as long as they provide
290 | the rights granted in Article 2 of this Licence and protect the covered Source
291 | Code from exclusive appropriation.
292 |
293 | All other changes or additions to this Appendix require the production of a new
294 | EUPL version.
295 |
--------------------------------------------------------------------------------
/brain-network-models/2-node-model-Python/2-node-model.py:
--------------------------------------------------------------------------------
1 | # This code implements a multiscale toy model
2 | # The model connects two large-scale populations
3 | # with a small-scale functional circuit for decision-making
4 | # and working memory.
5 | # The large-scale model uses "ReducedWongWangDeco"
6 | # neural mass models
7 | # -> Deco et al., 2014, Journal of Neuroscience
8 | # The functional circuit was taken from
9 | # Murray et al., 2017, Journal of Neuroscience
10 | #
11 | # The model by Deco2014 was modified to allow for simulation
12 | # of the effect of varying levels of long-range excitation
13 | # versus feedforward inhibition.
14 | #
15 | # (c) Michael Schirner 2018-2021, michael.schirner@charite.de
16 | # Co-Author: Petra Ritter, petra.ritter@charite.de
17 | # Brain Simulation Section, Charité Berlin
18 | #
19 | #
20 | # The two populations A, B from the MurrayWang functional circuit
21 | # are driven by the large-scale populations, instead of noise.
22 | # A and B from Module 1 is coupled with a population that models PFC and
23 | # A and B from Module 2 is coupled with a population that models PPC.
24 | # A and B receive shared input as well as unique inputs (noise).
25 | #
26 | # The goal of this work is to show the effect of varying E/I ratios on
27 | # FC and decision-making performance.
28 | import sys
29 | import numpy as np
30 | from numpy.random import seed
31 | from numpy.random import randn
32 | from scipy.signal import decimate
33 | from scipy.io import savemat, loadmat
34 | import time
35 |
36 | precomp_Ji = np.array([0.685216346451926,0.685992054216534,0.687098519611814,0.688312823361645,0.689933557851172,0.691893836415375,0.694345167686177,0.697215870607475,0.700692284923842,0.704778992315311,0.709954147508085,0.716148286212684,0.723580689725627,0.732613833807214,0.743592238592289,0.756771067717338,0.772620860095290,0.791505287876342,0.813801438796014,0.839854599310192,0.869924742040147,0.904149808913073,0.942494887272832,0.984746379444041,1.03050103376096,1.07914853079897,1.12996101886773,1.18204515159652,1.23444008343165,1.28622762992412,1.33650030882016,1.38448756524300,1.42957109640756,1.47128875300492,1.50935820603458,1.54366221669168,1.57421664767453,1.60115810274441,1.62470008824564,1.64510732265226,1.66267658738453,1.67771304548578,1.69051782046346,1.70137113552461,1.71069947747479,1.71857901030852,1.72506373314467,1.73049739346561,1.73483536204369,1.73862911827088])
37 | EI_ratios = np.array([0.0100000000000000,0.0120679264063933,0.0145634847750124,0.0175751062485479,0.0212095088792019,0.0255954792269954,0.0308884359647748,0.0372759372031494,0.0449843266896945,0.0542867543932386,0.0655128556859551,0.0790604321090770,0.0954095476349994,0.115139539932645,0.138949549437314,0.167683293681101,0.202358964772516,0.244205309454865,0.294705170255181,0.355648030622313,0.429193426012878,0.517947467923121,0.625055192527397,0.754312006335462,0.910298177991522,1.09854114198756,1.32571136559011,1.59985871960606,1.93069772888325,2.32995181051537,2.81176869797423,3.39322177189533,4.09491506238043,4.94171336132384,5.96362331659464,7.19685673001152,8.68511373751353,10.4811313415469,12.6485521685530,15.2641796717523,18.4206996932672,22.2299648252619,26.8269579527972,32.3745754281764,39.0693993705462,47.1486636345739,56.8986602901830,68.6648845004300,82.8642772854684,100])
38 |
39 |
40 | start = time.time()
41 | #################################################
42 | ##### PARAMETERS ################################
43 | #################################################
44 | #EI_ratio_i = 29
45 | #rng_seed = 1
46 | EI_ratio_i = int(sys.argv[1])
47 | EI_ratio = EI_ratios[EI_ratio_i]
48 | rng_seed = int(sys.argv[2])
49 | #rng_seed = 2706
50 | seed(rng_seed) # Important: vary RNG seed in re-simulations
51 | #contrast = float(sys.argv[3])
52 | #contrast = 0.8
53 | contrast = 6.4
54 | J_i_val = precomp_Ji[EI_ratio_i]
55 |
56 |
57 | # contrast and consequential sensory currents of DM experiment
58 | I_appA = 0.0118 * (1 + contrast / 100);
59 | I_appB = 0.0118 * (1 - contrast / 100);
60 |
61 |
62 | # normalization parameters for large-scale MW input currents
63 | # For our default E/I setting we want that large-scale inputs
64 | # have a mean of 0 and an STD of 0.007347, because that's how it
65 | # is in MurrayWang
66 | mean_norm = 0.3807 # mean at E/I=2.33
67 | MW_noise_SD = 0.007347 # that's the SD of MW
68 | std_norm = MW_noise_SD / 0.02367 # that's the SD at E/I=2.33
69 |
70 | FIC_ts = 20 * 1000 # number of time steps for FIC tuning
71 | ts = FIC_ts + 5 * 1000 # (ms) total simulation time
72 |
73 | SC = np.array([[0, 1.0],
74 | [1.0, 0]])
75 |
76 | # Excitation-Inhibition ratio is the ratio of long-range excitation
77 | # (LRE) to feedforward inhibition (FFI)
78 | # compute LRE and FFI based on solving a system of two equations
79 | # (1) LRE / FFI = EI_ratio
80 | # (2) LRE + FFI = 1
81 | # That is, the coefficients LRE and FFI should always sum to 1, in
82 | # order to not change the sum total of global coupling, because this
83 | # would in turn affect currents.
84 | FFI = 1 / (EI_ratio + 1)
85 | LRE = EI_ratio * FFI
86 |
87 |
88 | # Hemodynamic response function
89 | hrf = loadmat('HRF_200Hz.mat')
90 | hrf = hrf['HRF_200Hz'].T[:,0]
91 |
92 |
93 | #################################################
94 | ##### Helper functions ##########################
95 | #################################################
96 |
97 | # Eq. 4 Murray2017
98 | def MW_noise(I_noise):
99 | dt = 1.0
100 | tau_AMPA = 2.0 # (ms) AMPA noise time constant
101 | sigma_noise = 0.009 # (nA) noise strength
102 | I_noise = I_noise + dt * ( (-I_noise + randn(I_noise.shape[0]) * np.sqrt(tau_AMPA * sigma_noise**2)) / tau_AMPA )
103 | return I_noise
104 |
105 | # Eq. 3 Murray2017
106 | def fI_A1(S_A1, S_A2, S_B1, S_B2, I_net_bg, I_appA):
107 | J_same_M1 = 0.3169
108 | J_diff_M1 = -0.0330
109 | J_same_M2_to_M1 = 0.02
110 | J_diff_M2_to_M1 = -0.02
111 | I_0 = 0.334
112 | I = J_same_M1 * S_A1 + J_diff_M1 * S_B1 + J_same_M2_to_M1 * S_A2 + J_diff_M2_to_M1 * S_B2 + I_0 + I_net_bg + I_appA
113 | return I
114 |
115 | def fI_B1(S_A1, S_A2, S_B1, S_B2, I_net_bg, I_appB):
116 | J_same_M1 = 0.3169
117 | J_diff_M1 = -0.0330
118 | J_same_M2_to_M1 = 0.02
119 | J_diff_M2_to_M1 = -0.02
120 | I_0 = 0.334
121 | I = J_diff_M1 * S_A1 + J_same_M1 * S_B1 + J_diff_M2_to_M1 * S_A2 + J_same_M2_to_M1 * S_B2 + I_0 + I_net_bg + I_appB
122 | return I
123 |
124 | def fI_A2(S_A1, S_A2, S_B1, S_B2, I_net_bg):
125 | J_same_M2 = 0.351
126 | J_diff_M2 = -0.0671
127 | J_same_M1_to_M2 = 0.075
128 | J_diff_M1_to_M2 = -0.075
129 | I_0 = 0.334
130 | I = J_same_M1_to_M2 * S_A1 + J_diff_M1_to_M2 * S_B1 + J_same_M2 * S_A2 + J_diff_M2 * S_B2 + I_0 + I_net_bg
131 | return I
132 |
133 | def fI_B2(S_A1, S_A2, S_B1, S_B2, I_net_bg):
134 | J_same_M2 = 0.351
135 | J_diff_M2 = -0.0671
136 | J_same_M1_to_M2 = 0.075
137 | J_diff_M1_to_M2 = -0.075
138 | I_0 = 0.334
139 | I = J_diff_M1_to_M2 * S_A1 + J_same_M1_to_M2 * S_B1 + J_diff_M2 * S_A2 + J_same_M2 * S_B2 + I_0 + I_net_bg
140 | return I
141 |
142 | # Eq. 1 Murray2017
143 | def S_AB(S, I):
144 | dt = 1.0
145 | tau = 60.0 # (ms) NMDA time constant
146 | gamma = 0.641 # rate of saturation of S
147 | fr = r(I)
148 | S = S + dt * ( -S / tau + gamma * (1.0 - S) * fr / 1000.0 )
149 | if S<0: S = 0.0
150 | if S>1: S = 1.0
151 | return S, fr
152 |
153 | # Eq. 2 Murray2017
154 | def r(I):
155 | a = 270.0 # (Hz/nA)
156 | b = 108.0 # (Hz)
157 | c = 0.154 # (s)
158 | phi = (a * I - b) / (1 - np.exp(-c * (a * I - b)))
159 | return phi
160 |
161 | # Eq. 3 Deco2014
162 | def rww_I_E(S_E, S_I, J_i, SC, LRE):
163 | W_E = 1.0
164 | I_0 = 0.382 # (nA)
165 | w_p = 1.4
166 | J_NMDA = 0.15 # (nA)
167 | E_loc = w_p * J_NMDA * S_E
168 | E_glob = J_NMDA * LRE * np.dot(SC, S_E)
169 | I_loc = J_i * S_I
170 | I = W_E * I_0 + E_loc + E_glob - I_loc
171 | #I = W_E * I_0 + w_p * J_NMDA * S_E + J_NMDA * LRE * np.dot(SC, S_E) - J_i * S_I
172 | return I, E_glob, E_loc, I_loc
173 |
174 | # Eq. 4 Deco2014
175 | def rww_I_I(S_E, S_I, SC, FFI):
176 | W_I = 0.7
177 | I_0 = 0.382 # (nA)
178 | J_NMDA = 0.15 # (nA)
179 | I = W_I * I_0 + J_NMDA * S_E - S_I + J_NMDA * FFI * np.dot(SC, S_E)
180 | return I
181 |
182 | # Eq. 5 Deco2014
183 | def rww_r_E(I):
184 | a = 310.0 # (Hz/nA)
185 | b = 125.0 # (Hz)
186 | d = 0.16 # (s)
187 | tmp = a * I - b
188 | phi = tmp / (1.0 - np.exp(-d * tmp))
189 | return phi
190 |
191 | # Eq. 6 Deco2014
192 | def rww_r_I(I):
193 | a = 615.0 # (Hz/nA)
194 | b = 177.0 # (Hz)
195 | d = 0.087 # (s)
196 | tmp = a * I - b
197 | phi = tmp / (1.0 - np.exp(-d * tmp))
198 | return phi
199 |
200 | # Eq. 7 Deco2014
201 | def rww_S_E(S_E, r_E):
202 | dt = 1.0
203 | tau_E = 100.0 # (ms)
204 | gamma_E = 0.641/1000.0 # /1000: all units in ms not s
205 | sigma = 0.01
206 | dS = -S_E / tau_E + (1.0 - S_E) * gamma_E * r_E
207 | S = S_E + dt * dS + np.sqrt(dt) * sigma * randn(S_E.shape[0])
208 | S[S<0] = 0
209 | S[S>1] = 1
210 | return S
211 |
212 | # Eq. 8 Deco2014
213 | def rww_S_I(S_I, r_I):
214 | dt = 1.0
215 | tau_I = 10.0 # (ms)
216 | gamma_I = 1.0/1000.0 # /1000: all units in ms not s
217 | sigma = 0.01
218 | dS = -S_I / tau_I + gamma_I * r_I
219 | S = S_I + dt * dS + np.sqrt(dt) * sigma * randn(S_I.shape[0])
220 | S[S<0] = 0
221 | S[S>1] = 1
222 | return S
223 |
224 | # Inhibitory synaptic plasticity as in Vogels et al. Science
225 | def ISP(J_i, pre, post):
226 | eta = 0.0001 # smaller eta than in Vogels article
227 | r0 = 4.0 # target firing rate
228 | J_i = J_i + eta * (pre * post - r0 * pre)
229 | J_i[J_i<0] = 0
230 | return J_i
231 |
232 | # convolve synaptic gating with HRF to simulate fMRI
233 | def compute_BOLD(y, HRF):
234 | y = decimate(y, 5) # downsample to 200 Hz
235 | y = np.convolve(y, HRF, mode='valid'); # convolve with HRF
236 | y = y[::200] # downsample to 1 Hz
237 | return y
238 |
239 |
240 |
241 |
242 | #################################################
243 | ##### Initialize state variables ################
244 | #################################################
245 | N = SC.shape[0]
246 |
247 | # RWW variables
248 | S_E = np.zeros((N))
249 | S_I = np.zeros((N))
250 | J_i = J_i_val * np.ones((N))
251 |
252 | # MW variables
253 | S_A1 = 0.0
254 | S_B1 = 0.0
255 | S_A2 = 0.0
256 | S_B2 = 0.0
257 |
258 | # RWW output variables
259 | J_iout = np.zeros((ts,N))
260 | S_Eout = np.zeros((ts,N))
261 | S_Iout = np.zeros((ts,N))
262 | r_Eout = np.zeros((ts,N))
263 | r_Iout = np.zeros((ts,N))
264 |
265 | # Large-scale input to small-scale populations
266 | LSI_A1out = np.zeros((ts))
267 | LSI_A2out = np.zeros((ts))
268 | LSI_B1out = np.zeros((ts))
269 | LSI_B2out = np.zeros((ts))
270 | LSI_PFCout = np.zeros((ts))
271 | LSI_PPCout = np.zeros((ts))
272 | E_global = np.zeros((ts,N))
273 | E_local = np.zeros((ts,N))
274 | I_local = np.zeros((ts,N))
275 |
276 | # MW output variables
277 | r_A1out = np.zeros((ts))
278 | r_A2out = np.zeros((ts))
279 | r_B1out = np.zeros((ts))
280 | r_B2out = np.zeros((ts))
281 |
282 | ############################################
283 | ##### Integrate brain model ################
284 | ############################################
285 | for ii in range(ts):
286 | # integrate RWW (i.e. compute Eqs. 3 to 8 from Deco2014)
287 | I_E, E_global[ii,:], E_local[ii,:], I_local[ii,:] = rww_I_E(S_E, S_I, J_i, SC, LRE)
288 | I_I = rww_I_I(S_E, S_I, SC, FFI)
289 | r_E, r_I = rww_r_E(I_E), rww_r_I(I_I)
290 | S_E, S_I = rww_S_E(S_E, r_E), rww_S_I(S_I, r_I)
291 |
292 | # store results
293 | S_Eout[ii,:], S_Iout[ii,:], r_Eout[ii,:], r_Iout[ii,:] = S_E, S_I, r_E, r_I
294 | LSI_PFC, LSI_PPC = I_E
295 | LSI_PFCout[ii], LSI_PPCout[ii] = LSI_PFC, LSI_PPC
296 |
297 |
298 | if ii >= FIC_ts: # only integrate MW after burn-in
299 | LSI_PPC, LSI_PFC = (I_E - mean_norm) * std_norm
300 | LSI_PPCout[ii], LSI_PFCout[ii] = LSI_PPC, LSI_PFC
301 |
302 | LSI_A1, LSI_B1 = 0.5 * MW_noise_SD * randn(2) + 0.5 * LSI_PPC
303 | LSI_A2, LSI_B2 = 0.5 * MW_noise_SD * randn(2) + 0.5 * LSI_PFC
304 | LSI_A1out[ii], LSI_B1out[ii], LSI_A2out[ii], LSI_B2out[ii] = LSI_A1, LSI_B1, LSI_A2, LSI_B2
305 |
306 | # integrate MW
307 | I_A1, I_A2, I_B1, I_B2 = fI_A1(S_A1, S_A2, S_B1, S_B2, LSI_A1, I_appA), fI_A2(S_A1, S_A2, S_B1, S_B2, LSI_A2), fI_B1(S_A1, S_A2, S_B1, S_B2, LSI_B1, I_appB), fI_B2(S_A1, S_A2, S_B1, S_B2, LSI_B2)
308 | S_A1, r_A1out[ii] = S_AB(S_A1, I_A1)
309 | S_A2, r_A2out[ii] = S_AB(S_A2, I_A2)
310 | S_B1, r_B1out[ii] = S_AB(S_B1, I_B1)
311 | S_B2, r_B2out[ii] = S_AB(S_B2, I_B2)
312 | #S_A1out[ii] = S_A1
313 | #S_B1out[ii] = S_B1
314 | #S_A2out[ii] = S_A2
315 | #S_B2out[ii] = S_B2
316 |
317 |
318 | J_iout[ii,:] = J_i;
319 |
320 | ## Make sure that FIC tuning converged
321 | #if np.sum(np.abs(np.mean(r_Eout[FIC_ts-20000:,:], axis=0) - 4.0) > 0.5) > 0:
322 | # print('Error: FIC tuning did not sufficiently converge.')
323 | # sys.exit("Exit with error: FIC did not converge")
324 |
325 | # compute BOLD signal of dummy regions
326 | #BOLD_A1 = compute_BOLD(S_Eout[FIC_ts:, 8 ], hrf)
327 | #BOLD_B1 = compute_BOLD(S_Eout[FIC_ts:, 9 ], hrf)
328 | #BOLD_A2 = compute_BOLD(S_Eout[FIC_ts:, 10], hrf)
329 | #BOLD_B2 = compute_BOLD(S_Eout[FIC_ts:, 11], hrf)
330 |
331 |
332 |
333 | ############################################
334 | ##### Compute result statistics ############
335 | ############################################
336 |
337 | # compute synaptic input current correlations
338 | ccsyn_M1 = np.corrcoef(LSI_A1out[FIC_ts:], LSI_B1out[FIC_ts:])[0,1]
339 | ccsyn_M2 = np.corrcoef(LSI_A2out[FIC_ts:], LSI_B2out[FIC_ts:])[0,1]
340 | # compute fMRI correlations
341 | #ccfMRI_M1 = np.corrcoef(BOLD_A1, BOLD_B1)[0,1]
342 | #ccfMRI_M2 = np.corrcoef(BOLD_A2, BOLD_B2)[0,1]
343 | ccfMRI_M1 = np.nan
344 | ccfMRI_M2 = np.nan
345 | # compute average synaptic input current amplitudes
346 | ampsyn_PFC = np.mean(LSI_PFCout[FIC_ts:])
347 | ampsyn_PPC = np.mean(LSI_PPCout[FIC_ts:])
348 | ampsyn_M1 = (np.mean(LSI_A1out[FIC_ts:]) + np.mean(LSI_B1out[FIC_ts:])) / 2
349 | ampsyn_M2 = (np.mean(LSI_A2out[FIC_ts:]) + np.mean(LSI_B2out[FIC_ts:])) / 2
350 | # compute variance of synaptic input current amplitudes
351 | varsyn_PFC = np.var(LSI_PFCout[FIC_ts:])
352 | varsyn_PPC = np.var(LSI_PPCout[FIC_ts:])
353 | varsyn_M1 = (np.var(LSI_A1out[FIC_ts:]) + np.var(LSI_B1out[FIC_ts:])) / 2
354 | varsyn_M2 = (np.var(LSI_A2out[FIC_ts:]) + np.var(LSI_B2out[FIC_ts:])) / 2
355 | # compute mean global exc. input
356 | ampsyn_E_glob_M1 = np.mean(E_global[FIC_ts:, 0])
357 | ampsyn_E_glob_M2 = np.mean(E_global[FIC_ts:, 1])
358 | # compute mean local exc. input
359 | ampsyn_E_locl_M1 = np.mean(E_local[FIC_ts:, 0])
360 | ampsyn_E_locl_M2 = np.mean(E_local[FIC_ts:, 1])
361 | # compute mean local inh. input
362 | ampsyn_I_locl_M1 = np.mean(I_local[FIC_ts:, 0])
363 | ampsyn_I_locl_M2 = np.mean(I_local[FIC_ts:, 1])
364 |
365 | EI_ratio_curr_M1 = (0.382 + ampsyn_E_glob_M1 + ampsyn_E_locl_M1) / ampsyn_I_locl_M1
366 | EI_ratio_curr_M2 = (0.382 + ampsyn_E_glob_M2 + ampsyn_E_locl_M2) / ampsyn_I_locl_M2
367 |
368 |
369 |
370 | ##### Compute DM outcome ############
371 | #####################################
372 | r_A1out, r_A2out, r_B1out, r_B2out = r_A1out[FIC_ts+1:], r_A2out[FIC_ts+1:], r_B1out[FIC_ts+1:], r_B2out[FIC_ts+1:]
373 | correct_response = np.mean(r_A2out[-200:]) > 30 and np.mean(r_B2out[-200:]) < 30
374 | dec_time_A, dec_time_B = np.argmax(r_A1out>25), np.argmax(r_B1out>25)
375 | if dec_time_A==1: dec_time_A = np.nan
376 | if dec_time_B==1: dec_time_B = np.nan
377 |
378 |
379 |
380 | res = {'EI_ratio': EI_ratio, 'LRE': LRE, 'FFI': FFI, 'ccsyn_M1': ccsyn_M1, 'ccsyn_M2': ccsyn_M2, 'ccfMRI_M1': ccfMRI_M1, 'ccfMRI_M2': ccfMRI_M2,
381 | 'ampsyn_M1': ampsyn_M1, 'ampsyn_M2': ampsyn_M2, 'varsyn_M1': varsyn_M1, 'varsyn_M2': varsyn_M2,
382 | 'ampsyn_PFC': ampsyn_PFC, 'ampsyn_PPC': ampsyn_PPC, 'varsyn_PFC': varsyn_PFC, 'varsyn_PPC': varsyn_PFC,
383 | 'ampsyn_E_glob_M1': ampsyn_E_glob_M1, 'ampsyn_E_glob_M2': ampsyn_E_glob_M2,
384 | 'ampsyn_E_locl_M1': ampsyn_E_locl_M1, 'ampsyn_E_locl_M2': ampsyn_E_locl_M2,
385 | 'ampsyn_I_locl_M1': ampsyn_I_locl_M1, 'ampsyn_I_locl_M2': ampsyn_I_locl_M2,
386 | 'EI_ratio_curr_M1': EI_ratio_curr_M1, 'EI_ratio_curr_M2': EI_ratio_curr_M2,
387 | 'correct_response': correct_response, 'dec_time_A': dec_time_A, 'dec_time_B': dec_time_B,
388 | 'contrast': contrast, 'rng_seed': rng_seed}
389 |
390 | filename = "res_msBNM_DM_EI" + str(EI_ratio_i) + '_seed' + str(rng_seed) + '_contrast' + str(contrast) + ".mat"
391 | savemat(filename, res)
392 | end = time.time()
393 | print("Elapsed time: ", end - start, 's')
394 |
395 |
396 |
--------------------------------------------------------------------------------
/data-preprocessing/g-factor/Dubois-etal/compute_g_factor_Dubois.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "The following code was with minor modifications taken from Dubois et al. Phil Trans R Soc B 2018.\n",
8 | "\n",
9 | "Code was made available at github:\n",
10 | "https://github.com/adolphslab/HCP_MRI-behavior/blob/master/intelligence.ipynb\n"
11 | ]
12 | },
13 | {
14 | "cell_type": "code",
15 | "execution_count": null,
16 | "metadata": {},
17 | "outputs": [],
18 | "source": [
19 | "from HCP_helpers import *\n",
20 | "%load_ext rpy2.ipython\n",
21 | "%matplotlib inline\n",
22 | "plt.rcParams['svg.fonttype'] = 'none'"
23 | ]
24 | },
25 | {
26 | "cell_type": "code",
27 | "execution_count": null,
28 | "metadata": {},
29 | "outputs": [],
30 | "source": [
31 | "%%R \n",
32 | "library(ggplot2)\n",
33 | "library(psych)\n",
34 | "library(lavaan)\n",
35 | "library(Hmisc)\n",
36 | "library(corrplot)\n",
37 | "library(semPlot)\n",
38 | "library(colorRamps)\n",
39 | "# Helpers functions\n",
40 | "# compute Comparative Fit Index for a factor analysis \n",
41 | "CFI <-function(x){\n",
42 | " return((1-((x$STATISTIC-x$dof))/(x$null.chisq-x$null.dof)))\n",
43 | "}\n",
44 | "# compute Comparative Fit Index for a bifactor analysis \n",
45 | "CFI_biv <-function(x){\n",
46 | " return((1-((x$stats$STATISTIC-x$stats$dof))/(x$stats$null.chisq-x$stats$null.dof)))\n",
47 | "}\n",
48 | "# compute implied matrix for a factor analysis\n",
49 | "impliedMatrix<-function(x){\n",
50 | " if (dim(x$loadings)[2]==1) {\n",
51 | " imp <- x$loadings %*% t(x$loadings) \n",
52 | " } else {\n",
53 | " imp <- x$loadings %*% x$Phi %*% t(x$loadings) \n",
54 | " }\n",
55 | " diag(imp)<- diag(imp) + x$uniquenesses\n",
56 | " return(imp)\n",
57 | "}\n",
58 | "# compute implied matrix for a bifactor analysis\n",
59 | "impliedMatrix_biv<-function(x){\n",
60 | " Gloadings <- x$schmid$sl[,1]\n",
61 | " Floadings <- x$schmid$sl[,2:(ncol(x$schmid$sl)-3)]\n",
62 | " uniquenesses <- x$schmid$sl[,ncol(x$schmid$sl)-1]\n",
63 | " imp <- Gloadings %*% t(Gloadings) + Floadings %*% t(Floadings)\n",
64 | " diag(imp) <- diag(imp) + uniquenesses\n",
65 | " return(imp)\n",
66 | "}"
67 | ]
68 | },
69 | {
70 | "cell_type": "code",
71 | "execution_count": null,
72 | "metadata": {},
73 | "outputs": [],
74 | "source": [
75 | "# should figures be saved as files\n",
76 | "exportFigs = False"
77 | ]
78 | },
79 | {
80 | "cell_type": "code",
81 | "execution_count": null,
82 | "metadata": {},
83 | "outputs": [],
84 | "source": [
85 | "# config is a global variable used by several functions\n",
86 | "# Where does the HCP data live?\n",
87 | "config.DATADIR = '/path/to/data'\n",
88 | "# Which release should subjects be selected from?\n",
89 | "config.release = 'all+MEG2'\n",
90 | "# Which resting-state denoising pipeline should be used?\n",
91 | "# A replicates Finn et al Nature Neuroscience 2015 as closely as possible\n",
92 | "config.pipelineName = 'A'\n",
93 | "# list available runs\n",
94 | "fmriRuns = ['rfMRI_REST1_LR','rfMRI_REST1_RL','rfMRI_REST2_LR','rfMRI_REST2_RL']\n",
95 | "# which file to use for the functional data?\n",
96 | "#the code #fMRIrun# will be replaced by the appropriate run\n",
97 | "config.fmriFileTemplate = '#fMRIrun#_Atlas_MSMAll.dtseries.nii'\n",
98 | "## do not alter the following lines ##\n",
99 | "##>>>>>>>>\n",
100 | "tmp = config.fmriFileTemplate.split('.')\n",
101 | "if tmp[1]=='nii':\n",
102 | " config.isCifti = False\n",
103 | "elif tmp[1]=='dtseries':\n",
104 | " config.isCifti = True\n",
105 | "else:\n",
106 | " print('unknown file extension')\n",
107 | "##<<<<<<<<\n",
108 | "# parcellation for FC matrix\n",
109 | "config.parcellationName = 'Glasser' #used for easy reference\n",
110 | "config.parcellationFile = '/scratch/duboisjx/data/parcellations/Glasser2016/Parcels.dlabel.nii'\n",
111 | "config.nParcels = 360\n",
112 | "# where are the .csv files with subject scores and info?\n",
113 | "# unrestricted\n",
114 | "config.behavFile = '/path/to/HCP_data/unrestricted_....csv'\n",
115 | "# RESTRICTED: needed for age, handedness, family structure,...\n",
116 | "config.RbehavFile = '/path/to/HCP_data/RESTRICTED_....csv'\n",
117 | "# other naming conventions\n",
118 | "config.melodicFolder = op.join('#fMRIrun#_hp2000.ica','filtered_func_data.ica') \n",
119 | "config.movementRelativeRMSFile = 'Movement_RelativeRMS.txt'\n",
120 | "config.movementRegressorsFile = 'Movement_Regressors_dt.txt'\n",
121 | "# it is advisable to run the analyses on a cluster with sge\n",
122 | "config.queue = True\n",
123 | "parallelEnvironment = 'smp' #'openmp'\n",
124 | "# output directory\n",
125 | "outDir = op.join(config.DATADIR,'Results','INTELLIGENCE',config.pipelineName,config.parcellationName)\n",
126 | "if not op.isdir(outDir):\n",
127 | " makedirs(outDir)\n",
128 | " \n",
129 | "# if working with volumetric data: should the parcels be restricted to the gray matter mask?\n",
130 | "if not config.isCifti:\n",
131 | " config.maskParcelswithGM = False\n",
132 | " if config.maskParcelswithGM:\n",
133 | " config.parcellationName = config.parcellationName + '_GM'"
134 | ]
135 | },
136 | {
137 | "cell_type": "code",
138 | "execution_count": null,
139 | "metadata": {},
140 | "outputs": [],
141 | "source": [
142 | "# READ CSV FILES\n",
143 | "Udf = pd.read_csv(config.behavFile)\n",
144 | "Rdf = pd.read_csv(config.RbehavFile)\n",
145 | "# merge unrestricted and restricted\n",
146 | "df = pd.merge(Udf,Rdf,how='inner')\n",
147 | "# keep only variables of interest\n",
148 | "df = df[['Subject','Release','Gender','Age_in_Yrs','fMRI_3T_ReconVrs',\n",
149 | " 'FS_BrainSeg_Vol','MMSE_Score',\n",
150 | " 'Family_ID','Father_ID','Mother_ID','Race','Ethnicity','Handedness', \n",
151 | " '3T_RS-fMRI_PctCompl','PMAT_Compl','NEO-FFI_Compl','MMSE_Compl',\n",
152 | " 'Non-TB_Compl','VisProc_Compl','DelDisc_Compl','SCPT_Compl','IWRD_Compl','VSPLOT_Compl', \n",
153 | " 'NEOFAC_O','NEOFAC_C','NEOFAC_E','NEOFAC_A','NEOFAC_N',\n",
154 | " 'NEORAW_01','NEORAW_02','NEORAW_03','NEORAW_04','NEORAW_05','NEORAW_06','NEORAW_07','NEORAW_08','NEORAW_09','NEORAW_10',\n",
155 | " 'NEORAW_11','NEORAW_12','NEORAW_13','NEORAW_14','NEORAW_15','NEORAW_16','NEORAW_17','NEORAW_18','NEORAW_19','NEORAW_20',\n",
156 | " 'NEORAW_21','NEORAW_22','NEORAW_23','NEORAW_24','NEORAW_25','NEORAW_26','NEORAW_27','NEORAW_28','NEORAW_29','NEORAW_30',\n",
157 | " 'NEORAW_31','NEORAW_32','NEORAW_33','NEORAW_34','NEORAW_35','NEORAW_36','NEORAW_37','NEORAW_38','NEORAW_39','NEORAW_40',\n",
158 | " 'NEORAW_41','NEORAW_42','NEORAW_43','NEORAW_44','NEORAW_45','NEORAW_46','NEORAW_47','NEORAW_48','NEORAW_49','NEORAW_50',\n",
159 | " 'NEORAW_51','NEORAW_52','NEORAW_53','NEORAW_54','NEORAW_55','NEORAW_56','NEORAW_57','NEORAW_58','NEORAW_59','NEORAW_60',\n",
160 | " 'CardSort_Unadj','Flanker_Unadj','ListSort_Unadj','PicSeq_Unadj','PicVocab_Unadj','ProcSpeed_Unadj','ReadEng_Unadj',\n",
161 | " 'IWRD_TOT','PMAT24_A_CR','VSPLOT_TC'\n",
162 | " ]]\n",
163 | "# replace labeled columns with dummies\n",
164 | "df['Gender'].replace(['F','M'],[1,2],inplace=True)\n",
165 | "df['fMRI_3T_ReconVrs'].replace(['r177','r177 r227','r227'],[1,2,3],inplace=True)\n",
166 | "\n",
167 | "# RECOMPUTE PERSONALITY FACTOR SCORES\n",
168 | "# NOT USED IN THIS ANALYSIS, BUT KEPT FOR CONSISTENCY WITH PERSONALITY PAPER SUBJECT SELECTION\n",
169 | "scoring = [ \n",
170 | " {'13':'n', '23':'r', '43':'n', #aesthetic interests\n",
171 | " '48':'r', '53':'n', '58':'n', #intellectual interests\n",
172 | " '03':'r', '08':'r', '18':'r', '38':'r', # unconventionality\n",
173 | " '28':'n', '33':'r'},#??\n",
174 | " {'05':'n', '10':'n', '15':'r', '30':'r', '55':'r', # orderliness\n",
175 | " '25':'n', '35':'n', '60':'n', # goal-striving\n",
176 | " '20':'n', '40':'n', '45':'r', '50':'n'}, # dependability\n",
177 | " {'07':'n', '12':'r', '37':'n', '42':'r', # positive affect\n",
178 | " '02':'n', '17':'n', '27':'r', '57':'r', # sociability\n",
179 | " '22':'n', '32':'n', '47':'n', '52':'n'}, # activity\n",
180 | " {'09':'r', '14':'r', '19':'n', '24':'r', '29':'r', '44':'r', '54':'r', '59':'r', #nonantagonistic orientation\n",
181 | " '04':'n', '34':'n', '39':'r', '49':'n'}, # prosocial orientation\n",
182 | " {'01':'r', '11':'n', '16':'r', '31':'r', '46':'r', # negative affect\n",
183 | " '06':'n', '21':'n', '26':'n', '36':'n', '41':'n', '51':'n', '56':'n'} # self-reproach\n",
184 | " ]\n",
185 | "factors = ['O','C','E','A','N']\n",
186 | "scoreL = ['NEOFAC_O', 'NEOFAC_C', 'NEOFAC_E', 'NEOFAC_A_corr', 'NEOFAC_N']\n",
187 | "diff = list()\n",
188 | "for iFac,factor in enumerate(factors):\n",
189 | " this = np.zeros(df.shape[0])\n",
190 | " keyCtr = -1\n",
191 | " for key in scoring[iFac].keys():\n",
192 | " if scoring[iFac][key]=='n':\n",
193 | " df['NEORAW_'+key].replace(['SD','D','N','A','SA'],[0,1,2,3,4],inplace=True)\n",
194 | " else:\n",
195 | " df['NEORAW_'+key].replace(['SD','D','N','A','SA'],[4,3,2,1,0],inplace=True)\n",
196 | " this = this + df['NEORAW_'+key]\n",
197 | " keyCtr += 1\n",
198 | " df['NEOFAC_'+factor+'_calc']=this\n",
199 | " diff.append(np.sum(np.abs(df['NEOFAC_'+factor]-df['NEOFAC_'+factor+'_calc'])))\n",
200 | "print('diffO={0:d}, diffC={1:d}, diffE={2:d}, diffA={3:d}, diffN={4:d}'.format(\n",
201 | " np.int(diff[0]),np.int(diff[1]),np.int(diff[2]),np.int(diff[3]),np.int(diff[4])))\n",
202 | "# correct scores\n",
203 | "df['NEOFAC_A_corr'] = df['NEOFAC_A_calc']\n",
204 | "\n",
205 | "# select subjects according to release\n",
206 | "if config.release == 'Q2':\n",
207 | " keepSub = (df['Release'] == 'Q2') | (df['Release'] == 'Q1')\n",
208 | "elif config.release == 'S500':\n",
209 | " keepSub = (df['Release'] == 'Q3') | (df['Release'] == 'S500')\n",
210 | "elif config.release == 'Q2+S500':\n",
211 | " keepSub = (df['Release'] == 'Q2') | (df['Release'] == 'Q1') | (df['Release'] == 'Q3') | (df['Release'] == 'S500')\n",
212 | "elif config.release == 'S900':\n",
213 | " keepSub = (df['Release'] == 'S900')\n",
214 | "elif config.release == 'S1200':\n",
215 | " keepSub = (df['Release'] == 'S1200')\n",
216 | "elif config.release == 'all':\n",
217 | " keepSub = ((df['Release'] == 'Q1') | (df['Release'] == 'Q2') | (df['Release'] == 'Q3') \n",
218 | " | (df['Release'] == 'S500') | (df['Release'] == 'S900') | (df['Release'] == 'S1200'))\n",
219 | "elif config.release == 'all+MEG2':\n",
220 | " keepSub = ((df['Release'] == 'Q1') | (df['Release'] == 'Q2') | (df['Release'] == 'Q3') \n",
221 | " | (df['Release'] == 'S500') | (df['Release'] == 'S900') | (df['Release'] == 'S1200') \n",
222 | " | (df['Release'] == 'MEG2'))\n",
223 | "else:\n",
224 | " sys.exit(\"Invalid release code\")\n",
225 | "print('Selected {} subjects for release {}'.format(np.sum(keepSub),config.release))\n",
226 | "\n",
227 | "# select subjects that have completed all neuropsych\n",
228 | "keepSub = keepSub & (\n",
229 | " (df['PMAT_Compl']==True) &\n",
230 | " (df['NEO-FFI_Compl']==True) &\n",
231 | " (df['MMSE_Compl']==True) &\n",
232 | " (df['Non-TB_Compl']==True) &\n",
233 | " (df['VisProc_Compl']==True) &\n",
234 | " (df['SCPT_Compl']==True) &\n",
235 | " (df['IWRD_Compl']==True) &\n",
236 | " (df['VSPLOT_Compl']==True)\n",
237 | " )\n",
238 | "print('Selected {} subjects with complete neuropsych data'.format(np.sum(keepSub)))\n",
239 | "\n",
240 | "# FURTHER EXCLUSIONARY CRITERIA: MISSING VALUES\n",
241 | "keepSub = np.logical_and(keepSub,np.logical_not(np.isnan(df['CardSort_Unadj'])))\n",
242 | "keepSub = np.logical_and(keepSub,np.logical_not(np.isnan(df['VSPLOT_TC'])))\n",
243 | "keepSub = np.logical_and(keepSub,np.logical_not(np.isnan(df['PicSeq_Unadj'])))\n",
244 | "keepSub = np.logical_and(keepSub,np.logical_not(np.isnan(df['NEORAW_01'])))\n",
245 | "print('Kept {} subjects after removing missing values'.format(np.sum(keepSub)))\n",
246 | "\n",
247 | "# COGNITIVE COMPROMISE --> MMSE <26 excluded\n",
248 | "keepSub = np.logical_and(keepSub,df['MMSE_Score']>=26)\n",
249 | "print('Kept {} subjects after MMSE<26 exclusion criterion'.format(np.sum(keepSub)))\n",
250 | "\n",
251 | "# PRUNE df \n",
252 | "df = df[keepSub]\n",
253 | "# reindex\n",
254 | "df.index = range(df.shape[0])\n",
255 | "\n",
256 | "print('Included data for FACTOR ANALYSIS: {} subjects [{} F, {:0.1f}+/-{:0.1f} range {}-{} y.o.]'.format(\n",
257 | " len(df),np.sum(df['Gender']==1),np.mean(df['Age_in_Yrs']),np.std(df['Age_in_Yrs']),np.min(df['Age_in_Yrs']),np.max(df['Age_in_Yrs'])))"
258 | ]
259 | },
260 | {
261 | "cell_type": "code",
262 | "execution_count": null,
263 | "metadata": {},
264 | "outputs": [],
265 | "source": [
266 | "cogScores = ['PicVocab_Unadj', # Vocabulary, Language, Crystallized, Global\n",
267 | " 'ReadEng_Unadj', # Reading, Language, Crystallized, Global\n",
268 | " 'PicSeq_Unadj', # Episodic memory, Fluid, Global\n",
269 | " 'Flanker_Unadj', # Executive, Fluid, Global\n",
270 | " 'CardSort_Unadj', # Executive, Fluid, Global\n",
271 | " 'ProcSpeed_Unadj', # Speed, Executive, Fluid, Global\n",
272 | " 'PMAT24_A_CR', # non-verbal reasoning: Number of Correct Responses, Median Reaction Time for Correct Responses \n",
273 | " 'VSPLOT_TC', # Spatial ability: Total Number Correct, Median Reaction Time Divided by Expected Number of Clicks for Correct \n",
274 | " 'IWRD_TOT', # Verbal memory\n",
275 | " 'ListSort_Unadj', # Working memory, Executive, Fluid, Global\n",
276 | " ]\n",
277 | "alpha = 1e-3\n",
278 | "for score in cogScores:\n",
279 | " k2, p = stats.normaltest(df[score])\n",
280 | " print(\"{} normality test: p = {:g}\".format(score,p))\n",
281 | "cogdf = df[cogScores].copy()\n",
282 | "\n",
283 | "# standardize scores\n",
284 | "standardize = lambda x: (x-x.mean()) / x.std() #* 15. + 100.\n",
285 | "cogdf = cogdf.pipe(standardize)"
286 | ]
287 | },
288 | {
289 | "cell_type": "code",
290 | "execution_count": null,
291 | "metadata": {},
292 | "outputs": [],
293 | "source": [
294 | "def corrfunc(x, y, **kws):\n",
295 | " cmap = matplotlib.cm.get_cmap('jet')\n",
296 | " r, _ = stats.pearsonr(x, y)\n",
297 | " ax = plt.gca()\n",
298 | " ax.text(0.5, 0.5, \"{:.2f}\".format(r), size=48, ha='center', va='center')\n",
299 | " ax.set_axis_bgcolor(cmap((r+1)/2))\n",
300 | " ax.spines['left'].set_visible(False) \n",
301 | " ax.spines['bottom'].set_visible(False) \n",
302 | "def diagfunc(x, **kws):\n",
303 | " ax = plt.gca()\n",
304 | " ylims = ax.get_ylim()\n",
305 | " ax.text(0.5, ylims[0]+0.9*(ylims[1]-ylims[0]), x.name, size=24, ha='center', va='center')\n",
306 | " ax.spines['left'].set_visible(False) \n",
307 | "\n",
308 | "g = sns.PairGrid(cogdf, palette=[\"red\"])\n",
309 | "g.map_upper(plt.scatter, s=10)\n",
310 | "g.map_diag(sns.distplot, kde=False)\n",
311 | "g.map_diag(diagfunc)\n",
312 | "g.map_lower(corrfunc)\n",
313 | "\n",
314 | "lims = (-4,4)\n",
315 | "for ax in g.axes.flatten():\n",
316 | " ax.set_xticks([])\n",
317 | " ax.set_yticks([])\n",
318 | " ax.set_xlabel('')\n",
319 | " ax.set_ylabel('')\n",
320 | " ax.set_xlim(lims)\n",
321 | " ax.set_ylim(lims)\n",
322 | " ax.spines['left'].set_visible(False)\n",
323 | " ax.spines['bottom'].set_visible(False)\n",
324 | "\n",
325 | "if exportFigs:\n",
326 | " plt.savefig(op.join(outDir,\"testCorr.svg\"), format='svg')\n",
327 | " \n",
328 | "# cmap = matplotlib.cm.get_cmap('jet')\n",
329 | "# c = np.random.random((10,10))\n",
330 | "# sns.heatmap(c,annot=True, fmt=\".2f\", cmap=cmap, vmin=-1,vmax=1)\n",
331 | "# if exportFigs:\n",
332 | "# plt.savefig(\"/scratch/duboisjx/testCorrCBAR.svg\", format='svg')"
333 | ]
334 | },
335 | {
336 | "cell_type": "code",
337 | "execution_count": null,
338 | "metadata": {},
339 | "outputs": [],
340 | "source": [
341 | "%%R -i cogdf -o faValues,faSim,faSimR \n",
342 | "\n",
343 | "out = fa.parallel(cogdf,plot=F)#error.bars=T,se.bars=F,\n",
344 | "faValues = out$fa.values\n",
345 | "faSim = out$fa.sim\n",
346 | "faSimR = out$fa.simr"
347 | ]
348 | },
349 | {
350 | "cell_type": "code",
351 | "execution_count": null,
352 | "metadata": {},
353 | "outputs": [],
354 | "source": [
355 | "f,ax = plt.subplots(1,1,figsize=(5,5))\n",
356 | "ax.plot(np.arange(10)+1,faSim,'r:',label='simulated data');\n",
357 | "ax.plot(np.arange(10)+1,faSimR,'r--',label='resampled data');\n",
358 | "ax.plot(np.arange(10)+1,faValues,'b^-',label='actual data');\n",
359 | "ax.axhline(y=1,linestyle='-',color='k')\n",
360 | "plt.setp(ax,xlabel='Factor #',ylabel='eigenvalues of factor analysis',xlim=(0.5,10.5));\n",
361 | "plt.legend()\n",
362 | "\n",
363 | "if exportFigs:\n",
364 | " plt.savefig(op.join(outDir,\"faParallel.svg\"), format='svg')"
365 | ]
366 | },
367 | {
368 | "cell_type": "code",
369 | "execution_count": null,
370 | "metadata": {},
371 | "outputs": [],
372 | "source": [
373 | "%%R \n",
374 | "library(ggplot2)\n",
375 | "library(psych)\n",
376 | "library(lavaan)\n",
377 | "library(Hmisc)\n",
378 | "library(corrplot)\n",
379 | "library(semPlot)\n",
380 | "#library(colorRamps)\n",
381 | "# Helpers functions\n",
382 | "# compute Comparative Fit Index for a factor analysis \n",
383 | "CFI <-function(x){\n",
384 | " return((1-((x$STATISTIC-x$dof))/(x$null.chisq-x$null.dof)))\n",
385 | "}\n",
386 | "# compute Comparative Fit Index for a bifactor analysis \n",
387 | "CFI_biv <-function(x){\n",
388 | " return((1-((x$stats$STATISTIC-x$stats$dof))/(x$stats$null.chisq-x$stats$null.dof)))\n",
389 | "}\n",
390 | "# compute implied matrix for a factor analysis\n",
391 | "impliedMatrix<-function(x){\n",
392 | " if (dim(x$loadings)[2]==1) {\n",
393 | " imp <- x$loadings %*% t(x$loadings) \n",
394 | " } else {\n",
395 | " imp <- x$loadings %*% x$Phi %*% t(x$loadings) \n",
396 | " }\n",
397 | " diag(imp)<- diag(imp) + x$uniquenesses\n",
398 | " return(imp)\n",
399 | "}\n",
400 | "# compute implied matrix for a bifactor analysis\n",
401 | "impliedMatrix_biv<-function(x){\n",
402 | " Gloadings <- x$schmid$sl[,1]\n",
403 | " Floadings <- x$schmid$sl[,2:(ncol(x$schmid$sl)-3)]\n",
404 | " uniquenesses <- x$schmid$sl[,ncol(x$schmid$sl)-1]\n",
405 | " imp <- Gloadings %*% t(Gloadings) + Floadings %*% t(Floadings)\n",
406 | " diag(imp) <- diag(imp) + uniquenesses\n",
407 | " return(imp)\n",
408 | "}"
409 | ]
410 | },
411 | {
412 | "cell_type": "code",
413 | "execution_count": null,
414 | "metadata": {},
415 | "outputs": [],
416 | "source": [
417 | "%%R \n",
418 | "fm <- \"mle\" # use maximum likelihood estimator\n",
419 | "rotate <- \"oblimin\" # use oblimin factor rotation\n",
420 | "\n",
421 | "fitInds <- matrix(, nrow = 2, ncol = 9)\n",
422 | "rownames(fitInds) <- c('s1','b4')\n",
423 | "colnames(fitInds) <- c('CFI','RMSEA','SRMR','BIC','om_h','om_s1','om_s2','om_s3','om_s4')\n",
424 | "\n",
425 | "# observed covariance matrices\n",
426 | "obs <- cov(cogdf)\n",
427 | "lobs <- obs[!lower.tri(obs)]\n",
428 | "\n",
429 | "#SINGLE FACTOR\n",
430 | "model = 1\n",
431 | "f1 <- fa(cogdf,nfactors=1)\n",
432 | "imp <- impliedMatrix(f1)\n",
433 | "limp <- imp[!lower.tri(imp)]\n",
434 | "fitInds[model,1] <- CFI(f1)\n",
435 | "fitInds[model,2] <- f1$RMSEA[1]\n",
436 | "fitInds[model,3] <- sqrt(mean((limp - lobs)^2))\n",
437 | "fitInds[model,4] <- f1$BIC\n",
438 | "\n",
439 | "# BI-FACTOR MODEL\n",
440 | "model = 2\n",
441 | "b4 <- omega(cogdf,nfactors=4,fm=fm,key=NULL,flip=FALSE,\n",
442 | " digits=3,title=\"Omega\",sl=TRUE,labels=NULL, plot=FALSE,\n",
443 | " n.obs=NA,rotate=rotate,Phi = NULL,option=\"equal\",covar=FALSE)\n",
444 | "imp <- impliedMatrix_biv(b4)\n",
445 | "limp <- imp[!lower.tri(imp)]\n",
446 | "fitInds[model,1] <- CFI_biv(b4)\n",
447 | "fitInds[model,2] <- b4$schmid$RMSEA[1]\n",
448 | "fitInds[model,3] <- sqrt(mean((limp - lobs)^2))\n",
449 | "fitInds[model,4] <- b4$stats$BIC\n",
450 | "fitInds[model,5] <- b4$omega_h\n",
451 | "fitInds[model,6:9] <- b4$omega.group[-1,3]\n",
452 | "\n",
453 | "print(fitInds,digits=3)\n",
454 | "\n",
455 | "print(b4)"
456 | ]
457 | },
458 | {
459 | "cell_type": "code",
460 | "execution_count": null,
461 | "metadata": {},
462 | "outputs": [],
463 | "source": [
464 | "%%R -w 500 -h 500 -o b4Scores\n",
465 | "\n",
466 | "diagram(b4,digits=3,cut=.2)\n",
467 | "# export scores\n",
468 | "b4Scores <- factor.scores(cogdf,b4$schmid$sl[,1:5])$scores"
469 | ]
470 | },
471 | {
472 | "cell_type": "code",
473 | "execution_count": null,
474 | "metadata": {},
475 | "outputs": [],
476 | "source": [
477 | "subjects = df['Subject'].values\n",
478 | "g_factor = b4Scores[:,0]\n",
479 | "\n",
480 | "flank=cogdf['Flanker_Unadj']\n",
481 | "ccs = [np.corrcoef(b4Scores[:,ii],flank)[0,1] for ii in range(b4Scores.shape[1])]\n",
482 | "which_spd = np.where(np.array(ccs) > 0.79)[0][0]\n",
483 | "spd = b4Scores[:,which_spd]\n",
484 | "\n",
485 | "\n",
486 | "picvoc=cogdf['PicVocab_Unadj']\n",
487 | "ccs = [np.corrcoef(b4Scores[:,ii],picvoc)[0,1] for ii in range(b4Scores.shape[1])]\n",
488 | "which_picvoc = np.where(np.array(ccs) > 0.83)[0][0]\n",
489 | "cry = b4Scores[:,which_picvoc]\n",
490 | "\n",
491 | "\n",
492 | "pmat=cogdf['PMAT24_A_CR']\n",
493 | "ccs = [np.corrcoef(b4Scores[:,ii],pmat)[0,1] for ii in range(b4Scores.shape[1])]\n",
494 | "which_pmat = np.where(np.array(ccs[1:]) > 0.54)[0][0]\n",
495 | "which_pmat = which_pmat+1\n",
496 | "vis = b4Scores[:,which_pmat]\n",
497 | "\n",
498 | "\n",
499 | "picseq=cogdf['PicSeq_Unadj']\n",
500 | "ccs = [np.corrcoef(b4Scores[:,ii],picseq)[0,1] for ii in range(b4Scores.shape[1])]\n",
501 | "which_picseq = np.where(np.array(ccs) > 0.9)[0][0]\n",
502 | "mem = b4Scores[:,which_picseq]\n",
503 | "ccs\n",
504 | "\n",
505 | "\n",
506 | "print(which_spd,which_picvoc,which_pmat, which_picseq)\n",
507 | "print(ccs)\n",
508 | "\n",
509 | "from scipy.io import savemat\n",
510 | "savemat('g_asin_Dubois2018.mat', \n",
511 | " {\"g_factor\" : g_factor,\n",
512 | " \"subjects\" : subjects,\n",
513 | " \"spd\" : spd,\n",
514 | " \"cry\" : cry,\n",
515 | " \"mem\" : mem,\n",
516 | " \"vis\" : vis\n",
517 | " })"
518 | ]
519 | }
520 | ],
521 | "metadata": {
522 | "kernelspec": {
523 | "display_name": "Python 3 (ipykernel)",
524 | "language": "python",
525 | "name": "python3"
526 | },
527 | "language_info": {
528 | "codemirror_mode": {
529 | "name": "ipython",
530 | "version": 3
531 | },
532 | "file_extension": ".py",
533 | "mimetype": "text/x-python",
534 | "name": "python",
535 | "nbconvert_exporter": "python",
536 | "pygments_lexer": "ipython3",
537 | "version": "3.9.7"
538 | }
539 | },
540 | "nbformat": 4,
541 | "nbformat_minor": 4
542 | }
543 |
--------------------------------------------------------------------------------
/brain-network-models/multiscale-BNM-DM-Python/multiscale-BNM-DM.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": 74,
6 | "metadata": {
7 | "deletable": true,
8 | "editable": true
9 | },
10 | "outputs": [
11 | {
12 | "name": "stdout",
13 | "output_type": "stream",
14 | "text": [
15 | "Elapsed time: 1.5471417903900146 s\n"
16 | ]
17 | },
18 | {
19 | "data": {
20 | "text/plain": [
21 | "(0.001503171534559864,\n",
22 | " 0.0015881791582682805,\n",
23 | " 0.0013966701898095817,\n",
24 | " 0.001469408088440593)"
25 | ]
26 | },
27 | "execution_count": 74,
28 | "metadata": {},
29 | "output_type": "execute_result"
30 | },
31 | {
32 | "data": {
33 | "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXAAAAD4CAYAAAD1jb0+AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjIsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8li6FKAAAgAElEQVR4nOydd3xUxfbAv7O76QQCIdQACb13KUpRiiAoxYKNos/u79kb9t4f79mfoqjgU0Sxg4CKKFUQpPcqhJbQQnqyu/P7Y7a37CabbALz/Xz2s/fOnTv37N17zz33zJkzQkqJRqPRaKofhkgLoNFoNJqyoRW4RqPRVFO0AtdoNJpqilbgGo1GU03RClyj0WiqKabKPFjdunVlWlpaZR5So9Foqj1r1qw5JqVM8SyvVAWelpbG6tWrK/OQGo1GU+0RQvztq1y7UDQajaaaohW4RqPRVFO0AtdoNJpqSqX6wH1RUlJCRkYGhYWFkRalTMTGxpKamkpUVFSkRdFoNGcZEVfgGRkZJCYmkpaWhhAi0uKEhJSS48ePk5GRQXp6eqTF0Wg0ZxkRd6EUFhaSnJxc7ZQ3gBCC5OTkavv2oNFoqjcRV+BAtVTedqqz7BqNpnpTJRS4RlPtKc6D9Z+DTs+sqUS0Arfx7bffIoRg27ZtjrLhw4eTlJTExRdfHEHJNNWCBY/AN7fA38vg4Br4/Fooyil9v9OHYckUpfilhN2L9ENAEzRagduYOXMm/fr1Y+bMmY6yBx54gE8++SSCUlVzsnbAU7Vg65xIS1Lx5Gaq78JseH8QbJsDL6bCroWB95t9PSx8Bn5+HDbOhk/GwNNJZZej4JR+AJxFaAUO5ObmsnTpUqZNm8bnn3/uKB88eDCJ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adLlA+AH4DfSWNfTpLG/w8As8BXQ5XUFvOXep4F7Csd5Cpjz5cmyvf7FdwdpnPAUMOnLYMWd7wROuvM08JLH+0jJaA74GOjw+HrfnvP9fYVj7fVzMQM8UrZbg/47+fsplMo6u9uUL2fquamVfTv+lT4IgiBTchhCCYIgCJYgEngQBEGmRAIPgiDIlEjgQRAEmRIJPAiCIFMigQdBEGRKJPAgCIJM+Qv++I2UWp8IVwAAAABJRU5ErkJggg==\n",
34 | "text/plain": [
35 | ""
36 | ]
37 | },
38 | "metadata": {
39 | "needs_background": "light"
40 | },
41 | "output_type": "display_data"
42 | }
43 | ],
44 | "source": [
45 | "# This code implements a multiscale brain network model\n",
46 | "# The model connects large-scale populations\n",
47 | "# with a small-scale functional circuit for decision-making\n",
48 | "# and working memory.\n",
49 | "# The large-scale model uses \"ReducedWongWangDeco\" \n",
50 | "# neural mass models \n",
51 | "# -> Deco et al., 2014, Journal of Neuroscience\n",
52 | "# The functional circuit was taken from \n",
53 | "# Murray et al., 2017, Journal of Neuroscience\n",
54 | "#\n",
55 | "# The model by Deco2014 was modified to allow for simulation\n",
56 | "# of the effect of varying levels of long-range excitation\n",
57 | "# versus feedforward inhibition. \n",
58 | "#\n",
59 | "# (c) Michael Schirner 2018-2021, michael.schirner@charite.de\n",
60 | "# Co-Author: Petra Ritter, petra.ritter@charite.de\n",
61 | "# Brain Simulation Section, Charité Berlin\n",
62 | "#\n",
63 | "#\n",
64 | "# The two populations A, B from the MurrayWang functional circuit\n",
65 | "# are driven by the large-scale populations, instead of noise.\n",
66 | "# A and B from Module 1 is coupled with a population that models PFC and\n",
67 | "# A and B from Module 2 is coupled with a population that models PPC.\n",
68 | "# A and B receive shared input as well as unique inputs (noise).\n",
69 | "#\n",
70 | "# The goal of this work is to show the effect of varying E/I ratios on\n",
71 | "# FC and decision-making performance.\n",
72 | "import sys \n",
73 | "import numpy as np\n",
74 | "from numpy.random import seed\n",
75 | "from numpy.random import randn\n",
76 | "from scipy.signal import decimate\n",
77 | "from scipy.io import savemat, loadmat\n",
78 | "import time\n",
79 | "\n",
80 | "precomp_Ji = np.array([0.685216346451926,0.685992054216534,0.687098519611814,0.688312823361645,0.689933557851172,0.691893836415375,0.694345167686177,0.697215870607475,0.700692284923842,0.704778992315311,0.709954147508085,0.716148286212684,0.723580689725627,0.732613833807214,0.743592238592289,0.756771067717338,0.772620860095290,0.791505287876342,0.813801438796014,0.839854599310192,0.869924742040147,0.904149808913073,0.942494887272832,0.984746379444041,1.03050103376096,1.07914853079897,1.12996101886773,1.18204515159652,1.23444008343165,1.28622762992412,1.33650030882016,1.38448756524300,1.42957109640756,1.47128875300492,1.50935820603458,1.54366221669168,1.57421664767453,1.60115810274441,1.62470008824564,1.64510732265226,1.66267658738453,1.67771304548578,1.69051782046346,1.70137113552461,1.71069947747479,1.71857901030852,1.72506373314467,1.73049739346561,1.73483536204369,1.73862911827088])\n",
81 | "EI_ratios = np.array([0.0100000000000000,0.0120679264063933,0.0145634847750124,0.0175751062485479,0.0212095088792019,0.0255954792269954,0.0308884359647748,0.0372759372031494,0.0449843266896945,0.0542867543932386,0.0655128556859551,0.0790604321090770,0.0954095476349994,0.115139539932645,0.138949549437314,0.167683293681101,0.202358964772516,0.244205309454865,0.294705170255181,0.355648030622313,0.429193426012878,0.517947467923121,0.625055192527397,0.754312006335462,0.910298177991522,1.09854114198756,1.32571136559011,1.59985871960606,1.93069772888325,2.32995181051537,2.81176869797423,3.39322177189533,4.09491506238043,4.94171336132384,5.96362331659464,7.19685673001152,8.68511373751353,10.4811313415469,12.6485521685530,15.2641796717523,18.4206996932672,22.2299648252619,26.8269579527972,32.3745754281764,39.0693993705462,47.1486636345739,56.8986602901830,68.6648845004300,82.8642772854684,100])\n",
82 | "avg_amp = np.array([0.380829947321191,0.380877159390326,0.380915638277359,0.380970464208165,0.381024464512404,0.381088142081944,0.381154310699540,0.381241825658585,0.381343588341392,0.381472524970465,0.381596375310174,0.381743668014100,0.381913652359438,0.382093476359578,0.382274534067167,0.382461224424883,0.382640739985981,0.382802265365622,0.382937089989333,0.383033573472654,0.383080734038639,0.383069455827669,0.382993077861340,0.382847572723408,0.382632201905675,0.382349033195327,0.382002788125072,0.381600847467822,0.381153007026132,0.380670753178813,0.380166864825744,0.379654214927884,0.379144768662123,0.378649798932226,0.378178588830914,0.377738162117173,0.377333221581767,0.376966118933746,0.376637616328989,0.376347025876583,0.376092518860384,0.375871505165434,0.375677445340847,0.375514271079489,0.375336259480559,0.375176786495383,0.375076196656209,0.374991496514183,0.374959166927603,0.374899830114759])\n",
83 | "\n",
84 | "start = time.time()\n",
85 | "#################################################\n",
86 | "##### PARAMETERS ################################\n",
87 | "#################################################\n",
88 | "#EI_ratio_i = 30\n",
89 | "#rng_seed = 2222144\n",
90 | "EI_ratio_i = int(sys.argv[1]) - 1\n",
91 | "EI_ratio = EI_ratios[EI_ratio_i-1]\n",
92 | "rng_seed = int(sys.argv[2])\n",
93 | "seed(rng_seed) # Important: vary RNG seed in re-simulations\n",
94 | "contrast = float(sys.argv[3])\n",
95 | "#contrast = 0.8\n",
96 | "#contrast = 6.4\n",
97 | "#J_i_val = precomp_Ji[EI_ratio_i-1]\n",
98 | "J_i_val = 1.0\n",
99 | "\n",
100 | "# contrast and consequential sensory currents of DM experiment\n",
101 | "I_appA = 0.0118 * (1 + contrast / 100);\n",
102 | "I_appB = 0.0118 * (1 - contrast / 100);\n",
103 | "\n",
104 | "# parameters for normalization of large-scale input currents \n",
105 | "# MW_input = LS - mean_ampl\n",
106 | "mean_ampl = 0.379 # mean amplitude of synaptic input currents (for EI=4.0949)\n",
107 | "std_norm_fact= 4.61 * 2 # that's the maximum std (for EI=100)-->we want to bring it to target_std\n",
108 | "target_std = 0.007347\n",
109 | "\n",
110 | "# simulation lengths\n",
111 | "FIC_ts = 20 * 1000 # number of time steps for FIC tuning\n",
112 | "ts = FIC_ts + 5 * 1000 # (ms) total simulation time\n",
113 | "\n",
114 | "# stuctual connectivity toy model\n",
115 | "SC = np.array([[0, 1.0],\n",
116 | " [1.0, 0]])\n",
117 | "\n",
118 | "# Excitation-Inhibition ratio is the ratio of long-range excitation\n",
119 | "# (LRE) to feedforward inhibition (FFI)\n",
120 | "# compute LRE and FFI based on solving a system of two equations\n",
121 | "# (1) LRE / FFI = EI_ratio\n",
122 | "# (2) LRE + FFI = 1\n",
123 | "# That is, the coefficients LRE and FFI should always sum to 1, in\n",
124 | "# order to not change the sum total of global coupling, because this\n",
125 | "# would in turn affect currents. \n",
126 | "FFI = 1 / (EI_ratio + 1)\n",
127 | "LRE = EI_ratio * FFI\n",
128 | "\n",
129 | "\n",
130 | "# Hemodynamic response function\n",
131 | "hrf = loadmat('HRF_200Hz.mat')\n",
132 | "hrf = hrf['HRF_200Hz'].T[:,0]\n",
133 | "\n",
134 | "\n",
135 | "#################################################\n",
136 | "##### Helper functions ##########################\n",
137 | "#################################################\n",
138 | "\n",
139 | "# Eq. 4 Murray2017\n",
140 | "def MW_noise(I_noise):\n",
141 | " dt = 1.0\n",
142 | " tau_AMPA = 2.0 # (ms) AMPA noise time constant\n",
143 | " sigma_noise = 0.009 # (nA) noise strength\n",
144 | " I_noise = I_noise + dt * ( (-I_noise + randn(I_noise.shape[0]) * np.sqrt(tau_AMPA * sigma_noise**2)) / tau_AMPA )\n",
145 | " return I_noise\n",
146 | "\n",
147 | "# Eq. 3 Murray2017 \n",
148 | "def fI_A1(S_A1, S_A2, S_B1, S_B2, I_net_bg, I_appA):\n",
149 | " J_same_M1 = 0.3169\n",
150 | " J_diff_M1 = -0.0330\n",
151 | " J_same_M2_to_M1 = 0.02\n",
152 | " J_diff_M2_to_M1 = -0.02\n",
153 | " I_0 = 0.334 \n",
154 | " I = J_same_M1 * S_A1 + J_diff_M1 * S_B1 + J_same_M2_to_M1 * S_A2 + J_diff_M2_to_M1 * S_B2 + I_0 + I_net_bg + I_appA\n",
155 | " return I\n",
156 | "\n",
157 | "def fI_B1(S_A1, S_A2, S_B1, S_B2, I_net_bg, I_appB):\n",
158 | " J_same_M1 = 0.3169\n",
159 | " J_diff_M1 = -0.0330\n",
160 | " J_same_M2_to_M1 = 0.02\n",
161 | " J_diff_M2_to_M1 = -0.02\n",
162 | " I_0 = 0.334 \n",
163 | " I = J_diff_M1 * S_A1 + J_same_M1 * S_B1 + J_diff_M2_to_M1 * S_A2 + J_same_M2_to_M1 * S_B2 + I_0 + I_net_bg + I_appB\n",
164 | " return I\n",
165 | "\n",
166 | "def fI_A2(S_A1, S_A2, S_B1, S_B2, I_net_bg):\n",
167 | " J_same_M2 = 0.351\n",
168 | " J_diff_M2 = -0.0671\n",
169 | " J_same_M1_to_M2 = 0.075\n",
170 | " J_diff_M1_to_M2 = -0.075\n",
171 | " I_0 = 0.334 \n",
172 | " I = J_same_M1_to_M2 * S_A1 + J_diff_M1_to_M2 * S_B1 + J_same_M2 * S_A2 + J_diff_M2 * S_B2 + I_0 + I_net_bg\n",
173 | " return I\n",
174 | "\n",
175 | "def fI_B2(S_A1, S_A2, S_B1, S_B2, I_net_bg):\n",
176 | " J_same_M2 = 0.351\n",
177 | " J_diff_M2 = -0.0671\n",
178 | " J_same_M1_to_M2 = 0.075\n",
179 | " J_diff_M1_to_M2 = -0.075\n",
180 | " I_0 = 0.334 \n",
181 | " I = J_diff_M1_to_M2 * S_A1 + J_same_M1_to_M2 * S_B1 + J_diff_M2 * S_A2 + J_same_M2 * S_B2 + I_0 + I_net_bg\n",
182 | " return I\n",
183 | "\n",
184 | "# Eq. 1 Murray2017\n",
185 | "def S_AB(S, I):\n",
186 | " dt = 1.0\n",
187 | " tau = 60.0 # (ms) NMDA time constant\n",
188 | " gamma = 0.641 # rate of saturation of S \n",
189 | " fr = r(I)\n",
190 | " S = S + dt * ( -S / tau + gamma * (1.0 - S) * fr / 1000.0 )\n",
191 | " if S<0: S = 0.0 \n",
192 | " if S>1: S = 1.0\n",
193 | " return S, fr\n",
194 | "\n",
195 | "# Eq. 2 Murray2017\n",
196 | "def r(I):\n",
197 | " a = 270.0 # (Hz/nA)\n",
198 | " b = 108.0 # (Hz)\n",
199 | " c = 0.154 # (s)\n",
200 | " phi = (a * I - b) / (1 - np.exp(-c * (a * I - b)))\n",
201 | " return phi\n",
202 | "\n",
203 | "# Eq. 3 Deco2014\n",
204 | "def rww_I_E(S_E, S_I, J_i, SC, LRE):\n",
205 | " W_E = 1.0\n",
206 | " I_0 = 0.382 # (nA)\n",
207 | " w_p = 1.4\n",
208 | " J_NMDA = 0.15 # (nA) \n",
209 | " E_loc = w_p * J_NMDA * S_E\n",
210 | " E_glob = J_NMDA * LRE * np.dot(SC, S_E)\n",
211 | " I_loc = J_i * S_I\n",
212 | " I = W_E * I_0 + E_loc + E_glob - I_loc\n",
213 | " #I = W_E * I_0 + w_p * J_NMDA * S_E + J_NMDA * LRE * np.dot(SC, S_E) - J_i * S_I\n",
214 | " return I, E_glob, E_loc, I_loc\n",
215 | "\n",
216 | "# Eq. 4 Deco2014\n",
217 | "def rww_I_I(S_E, S_I, SC, FFI):\n",
218 | " W_I = 0.7\n",
219 | " I_0 = 0.382 # (nA)\n",
220 | " J_NMDA = 0.15 # (nA)\n",
221 | " I = W_I * I_0 + J_NMDA * S_E - S_I + J_NMDA * FFI * np.dot(SC, S_E)\n",
222 | " return I\n",
223 | "\n",
224 | "# Eq. 5 Deco2014\n",
225 | "def rww_r_E(I):\n",
226 | " a = 310.0 # (Hz/nA)\n",
227 | " b = 125.0 # (Hz)\n",
228 | " d = 0.16 # (s) \n",
229 | " tmp = a * I - b\n",
230 | " phi = tmp / (1.0 - np.exp(-d * tmp))\n",
231 | " return phi\n",
232 | "\n",
233 | "# Eq. 6 Deco2014\n",
234 | "def rww_r_I(I):\n",
235 | " a = 615.0 # (Hz/nA)\n",
236 | " b = 177.0 # (Hz)\n",
237 | " d = 0.087 # (s) \n",
238 | " tmp = a * I - b\n",
239 | " phi = tmp / (1.0 - np.exp(-d * tmp))\n",
240 | " return phi\n",
241 | "\n",
242 | "# Eq. 7 Deco2014\n",
243 | "def rww_S_E(S_E, r_E):\n",
244 | " dt = 1.0\n",
245 | " tau_E = 100.0 # (ms)\n",
246 | " gamma_E = 0.641/1000.0 # /1000: all units in ms not s\n",
247 | " sigma = 0.01\n",
248 | " dS = -S_E / tau_E + (1.0 - S_E) * gamma_E * r_E \n",
249 | " S = S_E + dt * dS + np.sqrt(dt) * sigma * randn(S_E.shape[0])\n",
250 | " S[S<0] = 0 \n",
251 | " S[S>1] = 1\n",
252 | " return S\n",
253 | "\n",
254 | "# Eq. 8 Deco2014\n",
255 | "def rww_S_I(S_I, r_I):\n",
256 | " dt = 1.0\n",
257 | " tau_I = 10.0 # (ms)\n",
258 | " gamma_I = 1.0/1000.0 # /1000: all units in ms not s\n",
259 | " sigma = 0.01\n",
260 | " dS = -S_I / tau_I + gamma_I * r_I \n",
261 | " S = S_I + dt * dS + np.sqrt(dt) * sigma * randn(S_I.shape[0])\n",
262 | " S[S<0] = 0 \n",
263 | " S[S>1] = 1\n",
264 | " return S\n",
265 | "\n",
266 | "# Inhibitory synaptic plasticity as in Vogels et al. Science\n",
267 | "def ISP(J_i, pre, post): \n",
268 | " eta = 0.0001 # smaller eta than in Vogels article\n",
269 | " r0 = 4.0 # target firing rate \n",
270 | " J_i = J_i + eta * (pre * post - r0 * pre)\n",
271 | " J_i[J_i<0] = 0\n",
272 | " return J_i\n",
273 | "\n",
274 | "# convolve synaptic gating with HRF to simulate fMRI\n",
275 | "def compute_BOLD(y, HRF):\n",
276 | " y = decimate(y, 5) # downsample to 200 Hz\n",
277 | " y = np.convolve(y, HRF, mode='valid'); # convolve with HRF\n",
278 | " y = y[::200] # downsample to 1 Hz\n",
279 | " return y\n",
280 | "\n",
281 | "\n",
282 | "\n",
283 | "\n",
284 | "#################################################\n",
285 | "##### Initialize state variables ################\n",
286 | "#################################################\n",
287 | "N = SC.shape[0]\n",
288 | "\n",
289 | "# RWW variables\n",
290 | "S_E = np.zeros((N))\n",
291 | "S_I = np.zeros((N))\n",
292 | "J_i = J_i_val * np.ones((N))\n",
293 | "\n",
294 | "# noise processes for each of the four populations\n",
295 | "I_noise = np.zeros((4))\n",
296 | "\n",
297 | "# MW variables\n",
298 | "S_A1 = 0.0\n",
299 | "S_B1 = 0.0\n",
300 | "S_A2 = 0.0\n",
301 | "S_B2 = 0.0\n",
302 | "\n",
303 | "# RWW output variables \n",
304 | "J_iout = np.zeros((ts,N))\n",
305 | "S_Eout = np.zeros((ts,N))\n",
306 | "S_Iout = np.zeros((ts,N))\n",
307 | "r_Eout = np.zeros((ts,N))\n",
308 | "r_Iout = np.zeros((ts,N))\n",
309 | "\n",
310 | "# Large-scale input to small-scale populations\n",
311 | "LSI_A1out = np.zeros((ts))\n",
312 | "LSI_A2out = np.zeros((ts))\n",
313 | "LSI_B1out = np.zeros((ts))\n",
314 | "LSI_B2out = np.zeros((ts))\n",
315 | "LSI_PFCout = np.zeros((ts))\n",
316 | "LSI_PPCout = np.zeros((ts))\n",
317 | "E_global = np.zeros((ts,N))\n",
318 | "E_local = np.zeros((ts,N))\n",
319 | "I_local = np.zeros((ts,N))\n",
320 | "\n",
321 | "# MW output variables\n",
322 | "r_A1out = np.zeros((ts))\n",
323 | "r_A2out = np.zeros((ts))\n",
324 | "r_B1out = np.zeros((ts))\n",
325 | "r_B2out = np.zeros((ts))\n",
326 | "\n",
327 | "############################################\n",
328 | "##### Integrate brain model ################\n",
329 | "############################################\n",
330 | "for ii in range(ts):\n",
331 | " # integrate RWW (i.e. compute Eqs. 3 to 8 from Deco2014)\n",
332 | " I_E, E_global[ii,:], E_local[ii,:], I_local[ii,:] = rww_I_E(S_E, S_I, J_i, SC, LRE)\n",
333 | " I_I = rww_I_I(S_E, S_I, SC, FFI)\n",
334 | " r_E, r_I = rww_r_E(I_E), rww_r_I(I_I)\n",
335 | " S_E, S_I = rww_S_E(S_E, r_E), rww_S_I(S_I, r_I)\n",
336 | "\n",
337 | " # store results\n",
338 | " S_Eout[ii,:], S_Iout[ii,:], r_Eout[ii,:], r_Iout[ii,:] = S_E, S_I, r_E, r_I\n",
339 | "\n",
340 | " \n",
341 | " if ii >= FIC_ts: # only integrate MW after burn-in\n",
342 | " I_noise = MW_noise(I_noise) \n",
343 | " LSI = (I_E - avg_amp[EI_ratio_i-1]) / std_norm_fact + avg_amp[EI_ratio_i-1] - mean_ampl\n",
344 | " \n",
345 | " LSI_A1, LSI_B1 = I_noise[0:2] / 2 + LSI[0]\n",
346 | " LSI_A2, LSI_B2 = I_noise[2:] / 2 + LSI[1]\n",
347 | " \n",
348 | " LSI_A1out[ii], LSI_B1out[ii], LSI_A2out[ii], LSI_B2out[ii] = LSI_A1, LSI_B1, LSI_A2, LSI_B2\n",
349 | " \n",
350 | " # integrate MW\n",
351 | " I_A1, I_A2, I_B1, I_B2 = fI_A1(S_A1, S_A2, S_B1, S_B2, LSI_A1, I_appA), fI_A2(S_A1, S_A2, S_B1, S_B2, LSI_A2), fI_B1(S_A1, S_A2, S_B1, S_B2, LSI_B1, I_appB), fI_B2(S_A1, S_A2, S_B1, S_B2, LSI_B2)\n",
352 | " S_A1, r_A1out[ii] = S_AB(S_A1, I_A1)\n",
353 | " S_A2, r_A2out[ii] = S_AB(S_A2, I_A2)\n",
354 | " S_B1, r_B1out[ii] = S_AB(S_B1, I_B1)\n",
355 | " S_B2, r_B2out[ii] = S_AB(S_B2, I_B2)\n",
356 | " #S_A1out[ii] = S_A1\n",
357 | " #S_B1out[ii] = S_B1\n",
358 | " #S_A2out[ii] = S_A2\n",
359 | " #S_B2out[ii] = S_B2\n",
360 | " \n",
361 | " \n",
362 | " J_iout[ii,:] = J_i;\n",
363 | "\n",
364 | "## Make sure that FIC tuning converged\n",
365 | "#if np.sum(np.abs(np.mean(r_Eout[FIC_ts-20000:,:], axis=0) - 4.0) > 0.5) > 0:\n",
366 | "# print('Error: FIC tuning did not sufficiently converge.')\n",
367 | "# sys.exit(\"Exit with error: FIC did not converge\") \n",
368 | "\n",
369 | "# compute BOLD signal of dummy regions\n",
370 | "#BOLD_A1 = compute_BOLD(S_Eout[FIC_ts:, 8 ], hrf)\n",
371 | "#BOLD_B1 = compute_BOLD(S_Eout[FIC_ts:, 9 ], hrf)\n",
372 | "#BOLD_A2 = compute_BOLD(S_Eout[FIC_ts:, 10], hrf)\n",
373 | "#BOLD_B2 = compute_BOLD(S_Eout[FIC_ts:, 11], hrf)\n",
374 | "\n",
375 | "\n",
376 | "\n",
377 | "############################################\n",
378 | "##### Compute result statistics ############\n",
379 | "############################################\n",
380 | "\n",
381 | "# compute synaptic input current correlations\n",
382 | "ccsyn_M1 = np.corrcoef(LSI_A1out[FIC_ts:], LSI_B1out[FIC_ts:])[0,1]\n",
383 | "ccsyn_M2 = np.corrcoef(LSI_A2out[FIC_ts:], LSI_B2out[FIC_ts:])[0,1]\n",
384 | "# compute fMRI correlations\n",
385 | "#ccfMRI_M1 = np.corrcoef(BOLD_A1, BOLD_B1)[0,1]\n",
386 | "#ccfMRI_M2 = np.corrcoef(BOLD_A2, BOLD_B2)[0,1]\n",
387 | "ccfMRI_M1 = np.nan\n",
388 | "ccfMRI_M2 = np.nan\n",
389 | "# compute average synaptic input current amplitudes\n",
390 | "ampsyn_PFC = np.mean(LSI_PFCout[FIC_ts:]) \n",
391 | "ampsyn_PPC = np.mean(LSI_PPCout[FIC_ts:]) \n",
392 | "ampsyn_M1 = (np.mean(LSI_A1out[FIC_ts:]) + np.mean(LSI_B1out[FIC_ts:])) / 2\n",
393 | "ampsyn_M2 = (np.mean(LSI_A2out[FIC_ts:]) + np.mean(LSI_B2out[FIC_ts:])) / 2\n",
394 | "# compute variance of synaptic input current amplitudes\n",
395 | "varsyn_PFC = np.var(LSI_PFCout[FIC_ts:]) \n",
396 | "varsyn_PPC = np.var(LSI_PPCout[FIC_ts:]) \n",
397 | "varsyn_M1 = (np.var(LSI_A1out[FIC_ts:]) + np.var(LSI_B1out[FIC_ts:])) / 2\n",
398 | "varsyn_M2 = (np.var(LSI_A2out[FIC_ts:]) + np.var(LSI_B2out[FIC_ts:])) / 2\n",
399 | "# compute mean global exc. input\n",
400 | "ampsyn_E_glob_M1 = np.mean(E_global[FIC_ts:, 0]) \n",
401 | "ampsyn_E_glob_M2 = np.mean(E_global[FIC_ts:, 1]) \n",
402 | "# compute mean local exc. input\n",
403 | "ampsyn_E_locl_M1 = np.mean(E_local[FIC_ts:, 0]) \n",
404 | "ampsyn_E_locl_M2 = np.mean(E_local[FIC_ts:, 1]) \n",
405 | "# compute mean local inh. input\n",
406 | "ampsyn_I_locl_M1 = np.mean(I_local[FIC_ts:, 0]) \n",
407 | "ampsyn_I_locl_M2 = np.mean(I_local[FIC_ts:, 1]) \n",
408 | "\n",
409 | "EI_ratio_curr_M1 = (0.382 + ampsyn_E_glob_M1 + ampsyn_E_locl_M1) / ampsyn_I_locl_M1\n",
410 | "EI_ratio_curr_M2 = (0.382 + ampsyn_E_glob_M2 + ampsyn_E_locl_M2) / ampsyn_I_locl_M2\n",
411 | "\n",
412 | "\n",
413 | "\n",
414 | "##### Compute DM outcome ############\n",
415 | "#####################################\n",
416 | "r_A1out, r_A2out, r_B1out, r_B2out = r_A1out[FIC_ts+1:], r_A2out[FIC_ts+1:], r_B1out[FIC_ts+1:], r_B2out[FIC_ts+1:]\n",
417 | "correct_response = np.mean(r_A2out[-200:]) > 30 and np.mean(r_B2out[-200:]) < 30\n",
418 | "dec_time_A, dec_time_B = np.argmax(r_A1out>25), np.argmax(r_B1out>25)\n",
419 | "if dec_time_A==1: dec_time_A = np.nan\n",
420 | "if dec_time_B==1: dec_time_B = np.nan\n",
421 | "\n",
422 | "\n",
423 | "\n",
424 | "res = {'EI_ratio': EI_ratio, 'LRE': LRE, 'FFI': FFI, 'ccsyn_M1': ccsyn_M1, 'ccsyn_M2': ccsyn_M2, 'ccfMRI_M1': ccfMRI_M1, 'ccfMRI_M2': ccfMRI_M2,\n",
425 | " 'ampsyn_M1': ampsyn_M1, 'ampsyn_M2': ampsyn_M2, 'varsyn_M1': varsyn_M1, 'varsyn_M2': varsyn_M2,\n",
426 | " 'ampsyn_PFC': ampsyn_PFC, 'ampsyn_PPC': ampsyn_PPC, 'varsyn_PFC': varsyn_PFC, 'varsyn_PPC': varsyn_PFC,\n",
427 | " 'ampsyn_E_glob_M1': ampsyn_E_glob_M1, 'ampsyn_E_glob_M2': ampsyn_E_glob_M2,\n",
428 | " 'ampsyn_E_locl_M1': ampsyn_E_locl_M1, 'ampsyn_E_locl_M2': ampsyn_E_locl_M2,\n",
429 | " 'ampsyn_I_locl_M1': ampsyn_I_locl_M1, 'ampsyn_I_locl_M2': ampsyn_I_locl_M2,\n",
430 | " 'EI_ratio_curr_M1': EI_ratio_curr_M1, 'EI_ratio_curr_M2': EI_ratio_curr_M2,\n",
431 | " 'correct_response': correct_response, 'dec_time_A': dec_time_A, 'dec_time_B': dec_time_B,\n",
432 | " 'contrast': contrast, 'rng_seed': rng_seed}\n",
433 | "\n",
434 | "filename = \"res_msBNM_DM_EI\" + str(EI_ratio_i) + '_seed' + str(rng_seed) + '_contrast' + str(contrast) + \".mat\"\n",
435 | "savemat(filename, res)\n",
436 | "end = time.time()\n",
437 | "print(\"Elapsed time: \", end - start, 's')\n",
438 | "#import matplotlib.pyplot as plt\n",
439 | "#plt.plot(r_A1out,label='A1')\n",
440 | "#plt.plot(r_A2out,label='A2')\n",
441 | "#plt.plot(r_B1out,label='B1')\n",
442 | "#plt.plot(r_B2out,label='B2')\n",
443 | "#plt.legend()\n",
444 | "#np.mean(LSI_A1out[FIC_ts:]),np.mean(LSI_A2out[FIC_ts:]),np.mean(LSI_B1out[FIC_ts:]),np.mean(LSI_B2out[FIC_ts:])\n",
445 | "#print(dec_time_A)"
446 | ]
447 | }
448 | ],
449 | "metadata": {
450 | "kernelspec": {
451 | "display_name": "Python 3 (ipykernel)",
452 | "language": "python",
453 | "name": "python3"
454 | },
455 | "language_info": {
456 | "codemirror_mode": {
457 | "name": "ipython",
458 | "version": 3
459 | },
460 | "file_extension": ".py",
461 | "mimetype": "text/x-python",
462 | "name": "python",
463 | "nbconvert_exporter": "python",
464 | "pygments_lexer": "ipython3",
465 | "version": "3.9.7"
466 | }
467 | },
468 | "nbformat": 4,
469 | "nbformat_minor": 4
470 | }
471 |
--------------------------------------------------------------------------------