maartenmennes/ICA-AROMA

How to run ICA-AROMA for many subjects in loop?

yangxiaokxmyt opened this issue · 3 comments

Dear ICA-AROMA experts,
I am currently work on a project and using the ICA-AROMA to remove the motion that may potential related in the resting-state data. After finishing the FSL FEAT analysis. I started to do ICA-AROMA for more than 100 participants. However, I didn't figure out how to do this preprocess in a loop.
I tried do this in the loop but I failed.

The error is: i: Undefined variable.

I was currently at /data/pkumar/xiaofeatloop
The scripts are as following:
for i in Sub00*; fsl_sub python2.7 /cm/shared/ICA-AROMA/ICA_AROMA.py -feat /data/pkumar/xiaofeatloop/${i}.feat -out /data/pkumar/xiaofeatloop/${i}.feat/ICA_AROMA/; done

the path is:
/data/pkumar/xiaofeatloop
/data/pkumar/xiaofeatloop/Sub001
/data/pkumar/xiaofeatloop/Sub002
...
/data/pkumar/xiaofeatloop/Sub009

Files are stored like this:
├───Sub001
│ └───EPI_Sub001_FEAT_388.feat
│ ├───.files
│ │ └───images
│ ├───logs
│ ├───mc
│ │ └───prefiltered_func_data_mcf.mat
│ └───reg
├───Sub002
│ └───EPI_Sub002_FEAT_388.feat
│ ├───.files
│ │ └───images
│ ├───logs
│ ├───mc
│ │ └───prefiltered_func_data_mcf.mat
│ └───reg
├───Sub003
│ └───EPI_Sub003_FEAT_388.feat
│ ├───.files
│ │ └───images
│ ├───logs
│ ├───mc
│ │ └───prefiltered_func_data_mcf.mat
│ └───reg
├───Sub004
│ └───EPI_Sub004_FEAT_388.feat
│ ├───.files
│ │ └───images
│ ├───logs
│ ├───mc
│ │ └───prefiltered_func_data_mcf.mat
│ └───reg
├───Sub005
│ └───EPI_Sub005_FEAT_388.feat
│ ├───.files
│ │ └───images
│ ├───logs
│ ├───mc
│ │ └───prefiltered_func_data_mcf.mat
│ └───reg
├───Sub006
│ └───EPI_Sub006_FEAT_388.feat
│ ├───.files
│ │ └───images
│ ├───logs
│ ├───mc
│ │ └───prefiltered_func_data_mcf.mat
│ └───reg
├───Sub007
│ └───EPI_Sub007_FEAT_388.feat
│ ├───.files
│ │ └───images
│ ├───logs
│ ├───mc
│ │ └───prefiltered_func_data_mcf.mat
│ └───reg
├───Sub008
│ └───EPI_Sub008_FEAT_388.feat
│ ├───.files
│ │ └───images
│ ├───logs
│ ├───mc
│ │ └───prefiltered_func_data_mcf.mat
│ └───reg
└───Sub009
└───EPI_Sub009_FEAT_388.feat
├───.files
│ └───images
├───logs
├───mc
│ └───prefiltered_func_data_mcf.mat
└───reg

Could you please tell me how can I do the ICA-AROMA analysis for these participants? Looking forward to hearing from you.
Thanks in advance!
Best wishes,
Xiao

I ran the ICA-AROMA and got the ICA_AROMA results for each participant one-by-one. However, it is difficult for people to do this one-by-one for hundreds of participants.
That would be greatly appreciated if you can help me with this problem.
Best regards,
Xiao

Hello,
your question is not related to the use of ICA-AROMA in itself. It is related to how you achieve a proper for loop across different inputs.

In your case, the 'for i in Sub00*' does not correctly capture your subjectpaths. I'm not sure what language you are writing this loop in, but if it is in bash you would have to do something along the lines of:

subs='ls -d Sub00*'
for i in $subs
do
fslsub...
done

In addition, in your command, it looks like the path to your .feat location is wrong. It should be: /data/pkumar/xiaofeatloop/${i}/EPI_${i}_FEAT_388.feat

hope this helps!

Hi,
Thank you very much for your advice.
I came up with an error that may be related to the use of ICA-AROMA. ICA-AROMA worked well with most of the subjects. However, three participants couldn't finish the preprocessing.
I checked these data again and tried several times. It still couldn't work. There are many files named thr_zstat00**.nii.gz in the ICA-AROMA folder. The errors were same as following:

An exception has been thrown
Logic error:- detected by Newmat: index error: requested index = 0

MatrixType = Rect # Rows = 1; # Cols = 3

Traceback (most recent call last):
File "/cm/shared/ICA-AROMA/ICA_AROMA.py", line 191, in
aromafunc.runICA(fslDir, inFile, outDir, melDir, mask, dim, TR)
File "/cm/shared/ICA-AROMA/ICA_AROMA_functions.py", line 94, in runICA
lenIC=int(float(subprocess.getoutput(cmd)))
ValueError: could not convert string to float: ERROR: Could not open file

By the way,
All the analysis were carried in the same server as well as the same software.
Could you help me with this problem?
Thank you very much.
Xiao