open-discussion > RE: Reproducibility analysis mICA
Mar 28, 2018  10:03 PM | Will Khan - King's College London
RE: Reproducibility analysis mICA
Hi Tawfik, 

Apologies for the long post! I managed to get the py/splithalf.py and mica scripts to work in the order you specified so please ignore the last post. 

However, I am encountering some issues with the py/ic_corr.py script.

I run the command according to usage:

Usage: ic_corr.r in_prefix samples dims [just_read]

in_prefix path of the folder that contains samples folders
samples number of samplings
dims dimensionality range
[just_read] 0 is default. 1 will not perform fsl_cc and just reads any previously calculated cross-correlation file


This is the command: 
./ic_corr.py $working_dir/results/out_50 50 2-20 0

This is the error:
Traceback (most recent call last):
File "./ic_corr.py", line 73, in
dims = dims + dim
TypeError: can only concatenate list (not "range") to list




I have a hunch this may be due to the way dimensionality is supplied to the script. I have tried using 2,20, 2-20, and 1,2,3,4,5 ... and the same error persists. 

Also, silly question - does this script require that ICA is run in all dimensionalities as a prerequisite before peforming hungarian sorting? 

Any advice you have would be greatly appreciated! 

Thank you very much,

Cheers, 

Will





Originally posted by Will Khan:
Hi Tawfik, 

Thank you for your suggestions. 

In the mICA/bin folder I can locate the mica script which has the following options to perform ICA. 

Perform masked-ICA

Usage: mica [options]
input: a text file containing a list of all preprocessed functional images (nifti)
Options:
-mask mask file (nifti)
-dim ICA decomposition dimensions. Either one value, comma separated values (e.g. 20,30,40), or a range (e.g. 2-100). If more than one value was entered, the analysis would be repeated for each parameter value.
-merge-stats merge MELODIC mixture model stats in one 4D nifit files
-parcel generate ICA-based parcellation
-Sdes design matrix across subject-domain
-Scon t-contrast matrix across subject-domain
-Tdes design matrix across time-domain
-Tcon t-contrast matrix across time-domain
-dr perform Dual-Regression. permutations value for randomize (usually 500).
-inversion perform direct Back-Reconstruction (Inversion).
-extra pass the all following command-line arguments to MELODIC

I ran the command in bash as so: 

./mica $working_dir/mica_testing_list $working_dir/results/testing_mica -mask $working_dir/masks/PCC_and_Precuneus_mask_thr20_Harvard.nii.gz -dim 8 -extra -a concat --sep_vn --nobet --bgthreshold=10 --tr=1 --report --mmthresh=0.5 --Oall

and I get the following error: 

./mica: line 242: /Volumes/ImagingData_WillKhan/HCP_Data2018/results/testing_mica/mica_log.txt: No such file or directory
./mica: line 244: /Volumes/ImagingData_WillKhan/HCP_Data2018/results/testing_mica/mica_log.txt: No such file or directory
./mica: line 245: /Volumes/ImagingData_WillKhan/HCP_Data2018/results/testing_mica/mica_log.txt: No such file or directory
./mica: line 251: /Volumes/ImagingData_WillKhan/HCP_Data2018/results/testing_mica/mica_log.txt: No such file or directory


Could you please advise what I am doing here? I thought I would test each script separately on a few HCP datasets before I created a master wrapper script to execute everything. 

Thank you!

Cheers, 

Will


Originally posted by Tawfik Moher Alsady:
Hello Will,

it is possible to use mICA scripts through command line. However, some checks of input correctness might not be performed as they are implemented in the GUI. In addition, you might have to write a wrapper script to automatize the analysis.

For preprocessing, group/single-subject mICA and back-reconstruction you can use the bash scripts in the bin folder, which are documented. 

For reproducibility, you have to prepare the randomly splitted groups using splithalf.py
Usage: python splithalf.py list_filename permutations out_prefix
list_filename: path of a text file containing all preprocessed input data (list of nii files)
permutations: is the number of permutation as in the GUI (0 for test-retest)
out_prefix: path of output folder

step 2: is using mica (in bin directory) to perform mICA for each of sampled groups

step 3: calculate correlation using python ic_corr.py in_prefix samples dims [just_read]
in_prefix:  path of the folder that contains samples folders (out_prefix of the previous step)
samples:   number of samplings
dims:   dimensionality range
[just_read]:  0 is default. 1 will not perform fsl_cc and just reads any previously calculated cross-correlation files.

let me know if you need more help.

Greetings,
Tawfik

Threaded View

TitleAuthorDate
Will Khan Mar 21, 2018
Florian Beissner Mar 22, 2018
Will Khan Mar 26, 2018
Tawfik Moher Alsady Mar 27, 2018
Will Khan Mar 28, 2018
RE: Reproducibility analysis mICA
Will Khan Mar 28, 2018
Tawfik Moher Alsady Mar 29, 2018
Will Khan Apr 4, 2018
Tawfik Moher Alsady Apr 9, 2018
Will Khan Apr 9, 2018