Hi everyone,
I’m hoping you can help me with what I thought would be a simple tcsh script to loop through my subjects and run 3dmasksave and 3dROIstats on each. Here’s my script:
#!/bin/tcsh
module load pkgsrc/2018Q3
module load pkgsrc/gcc-base
module load /directoryofafniprogram/07.17.2019
set datapath = /abunchofdirectories/
set output = /abunchofdirectories/outputdirectory
set sublist = (`cat subslist.txt`)
foreach sub ($sublist)
echo "You are on sub $sub"
3dmaskave -mask dACC_sigmask.nii ${datapath}/BETA_Subject${sub}_Condition001_Measure002_Component001.nii > ${output}/sub${sub}_day1_dACC_beta.txt
3dmaskave -mask dACC_sigmask.nii ${datapath}/BETA_Subject${sub}_Condition003_Measure002_Component001.nii > ${output}/sub${sub}_6mo_dACC_beta.txt
3dROIstats -mask dACC_sigmask.nii 'final_PCLReexp_LME.nii[8]' > ${output}/sub${sub}_ROIstat.1D
echo "sub $sub text file saved"
end
I am getting errors trying to set and loop through the sublist text file. For reference, the text file contents looks like this:
001
002
003
...
From the above script, the (cat subslist.txt
) gives me the error:
set: variable name must begin with a letter.
I have also tried loading the subslist.txt with the path name like this without changing the rest of the script and get the following error:
set sublist = abunchofdirectories/subslist.txt
foreach: Words not parenthesized.
These are the main two errors I am getting, and I have tried just about every combination of parentheses, double quotes, single quotes, back quotes, etc. that I can think of and none of them seem to work. I have looked on other forum posts and the AFNI Unix guide and can’t tell what I’m doing differently that is causing the issue. I’m hoping there’s just something super simple that I’m not noticing, but any answers would be helpful!!
Thanks,
Kyrie Amara