0

I'm trying to run a variation of the doDecon.sh AFNI script in the OpenScience_Scripts repository that will process the functional neuroimaging data for each of the three tasks I am analyzing separately, but I keep running into an error with the '3Ddeconvolve" command saying gltsym and -fout not found, fatal error.

The error code is pasted in here

I've tried making sure all my AFNI packages are installed, and I've set AFNI to run in the background, but this error pops up every time I try to run the script. Note that I'm working off of a Windows computer with a Linux shell and I know that can cause problems sometimes.

If anyone has seen this error code before or notes any problems in my script, I'd love to hear any ideas...

#!/bin/tcsh

if ( $#argv > 0 ) then
    set subj = $argv[1]
else
    set subj = s01
endif

3dDeconvolve -input rsem_scale.nii                            \
    -mask mask/mask_func_sem.nii.gz                      \
    -polort 1                                                                \
    -xout -progress                                                     \
    -num_stimts 11                                                           \
    -stim_times 1 stimuli/sem.1D 'BLOCK(2,1)'                          \
    -stim_label 1 sem                                                  \
    -stim_times 2 stimuli/sem_ctrl.1D 'BLOCK(2,1)'                          \
    -stim_label 2 sem_ctrl                                               \
    -stim_file 3 regressors/trans_x_sem_noHead_tmp.txt'[0]' -stim_base 3 -stim_label 3 trans_x_sem   \
    -stim_file 4 regressors/trans_y_sem_noHead_tmp.txt'[0]' -stim_base 4 -stim_label 4 trans_y_sem   \
    -stim_file 5 regressors/trans_z_sem_noHead_tmp.txt'[0]' -stim_base 5 -stim_label 5 trans_z_sem   \
    -stim_file 6 regressors/rot_x_sem_noHead_tmp.txt'[0]' -stim_base 6 -stim_label 6 rot_x_sem     \
    -stim_file 7 regressors/rot_y_sem_noHead_tmp.txt'[0]' -stim_base 7 -stim_label 7 rot_y_sem     \
    -stim_file 8 regressors/rot_z_sem_noHead_tmp.txt'[0]' -stim_base 8 -stim_label 8 rot_z_sem     \
    -stim_file 9 regressors/global_signal_sem_noHead_tmp.txt'[0]' -stim_base 9 -stim_label 9 global_signal_sem     \
    -stim_file 10 regressors/csf_sem_noHead_tmp.txt'[0]' -stim_base 10 -stim_label 10 csf_sem     \
    -stim_file 11 regressors/white_matter_sem_noHead_tmp.txt'[0]' -stim_base 11 -stim_label 11 white_matter_sem     \
    -jobs 8  \
    # tells AFNI to run GLT based on label names
    -gltsym 'SYM: sem -sem_ctrl'                     \
    -glt_label 1 sem -ctrl                       \
    -gltsym 'SYM: sem_ctrl -sem'                     \
    -glt_label 2 ctrl -sem                       

    -fout -tout -rout -x1D X.xmat.1D -xjpeg X.jpg                                  \
    -x1D_uncensored X.nocensor.xmat.1D                                       \
    -fitts fitts.$subj.sem                                                       \
    -errts errts.${subj}.sem                                                     \
    -bucket stats.$subj.sem                                                   

3dDeconvolve -input rplaus_scale.nii                            \
    -mask mask/mask_func_plaus.nii.gz                        \
    -polort 1                                                                \
    -xout -progress                                                     \
    -num_stimts 11                                                           \
    -stim_times 1 stimuli/plaus.1D 'BLOCK(2,1)'                          \
    -stim_label 1 plaus                                                  \
    -stim_times 2 stimuli/plaus_ctrl.1D 'BLOCK(2,1)'                          \
    -stim_label 2 plaus_ctrl                                               \
    -stim_file 3 regressors/trans_x_plaus_noHead_tmp.txt'[0]' -stim_base 3 -stim_label 3 trans_x_plaus   \
    -stim_file 4 regressors/trans_y_plaus_noHead_tmp.txt'[0]' -stim_base 4 -stim_label 4 trans_y_plaus   \
    -stim_file 5 regressors/trans_z_plaus_noHead_tmp.txt'[0]' -stim_base 5 -stim_label 5 trans_z_plaus   \
    -stim_file 6 regressors/rot_x_plaus_noHead_tmp.txt'[0]' -stim_base 6 -stim_label 6 rot_x_plaus     \
    -stim_file 7 regressors/rot_y_plaus_noHead_tmp.txt'[0]' -stim_base 7 -stim_label 7 rot_y_plaus     \
    -stim_file 8 regressors/rot_z_plaus_noHead_tmp.txt'[0]' -stim_base 8 -stim_label 8 rot_z_plaus     \
    -stim_file 9 regressors/global_signal_plaus_noHead_tmp.txt'[0]' -stim_base 9 -stim_label 9 global_signal_plaus     \
    -stim_file 10 regressors/csf_plaus_noHead_tmp.txt'[0]' -stim_base 10 -stim_label 10 csf_plaus     \
    -stim_file 11 regressors/white_matter_plaus_noHead_tmp.txt'[0]' -stim_base 11 -stim_label 11 white_matter_plaus     \
    -jobs 8  \
    # tells AFNI to run GLT based on label names
    -gltsym 'SYM: plaus -plaus_ctrl'                     \
    -glt_label 1 plaus -ctrl                         \
    -gltsym 'SYM: plaus_ctrl -plaus'                     \
    -glt_label 2 ctrl -plaus                         \

     -fout -tout -rout -x1D X.xmat.1D -xjpeg X.jpg                                  \
    -x1D_uncensored X.nocensor.xmat.1D                                       \
    -fitts fitts.$subj.plaus                                                      \
    -errts errts.${subj}.plaus                                                    \
    -bucket stats.$subj.plaus                        
    
3dDeconvolve -input rgram_scale.nii                            \
    -mask mask/mask_func_gram.nii.gz                         \
    -polort 1                                                                \
    -xout -progress                                                     \
    -num_stimts 11                                                           \
    -stim_times 1 stimuli/gram.1D 'BLOCK(2,1)'                          \
    -stim_label 1 gram                                                  \
    -stim_times 2 stimuli/gram_ctrl.1D 'BLOCK(2,1)'                          \
    -stim_label 2 gram_ctrl                                               \
    -stim_file 3 regressors/trans_x_gram_noHead_tmp.txt'[0]' -stim_base 3 -stim_label 3 trans_x_gram   \
    -stim_file 4 regressors/trans_y_gram_noHead_tmp.txt'[0]' -stim_base 4 -stim_label 4 trans_y_gram   \
    -stim_file 5 regressors/trans_z_gram_noHead_tmp.txt'[0]' -stim_base 5 -stim_label 5 trans_z_gram   \
    -stim_file 6 regressors/rot_x_gram_noHead_tmp.txt'[0]' -stim_base 6 -stim_label 6 rot_x_gram     \
    -stim_file 7 regressors/rot_y_gram_noHead_tmp.txt'[0]' -stim_base 7 -stim_label 7 rot_y_gram     \
    -stim_file 8 regressors/rot_z_gram_noHead_tmp.txt'[0]' -stim_base 8 -stim_label 8 rot_z_gram     \
    -stim_file 9 regressors/global_signal_gram_noHead_tmp.txt'[0]' -stim_base 9 -stim_label 9 global_signal_gram     \
    -stim_file 10 regressors/csf_gram_noHead_tmp.txt'[0]' -stim_base 10 -stim_label 10 csf_gram     \
    -stim_file 11 regressors/white_matter_gram_noHead_tmp.txt'[0]' -stim_base 11 -stim_label 11 white_matter_gram     \
    -jobs 8  \
    # tells AFNI to run GLT based on label names
    -gltsym 'SYM: gram -gram_ctrl'                   \
    -glt_label 1 gram -ctrl                      \
    -gltsym 'SYM: gram_ctrl -gram'                   \
    -glt_label 2 ctrl -gram                      \

     -fout -tout -rout -x1D X.xmat.1D -xjpeg X.jpg                                  \
    -x1D_uncensored X.nocensor.xmat.1D                                       \
    -fitts fitts.$subj.gram                                                       \
    -errts errts.${subj}.gram                                                     \
    -bucket stats.$subj.gram 
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
anamarz
  • 1
  • 1
  • I think you're missing some \ at the end of that command; you can't put comments or blank lines between things if you're using line continuation like that. – Martin Tournoij Aug 03 '22 at 08:44
  • Removing the comment before the offending line should fix it. – alle_meije Aug 08 '22 at 18:57
  • It's `` **really** `` weird to give a `.sh` extension to a `tcsh` script. Threw me off, to the point where I voted to close as trivial user error. (Shell scripts should not have any extension at all, anyway.) – tripleee Aug 29 '22 at 06:11

1 Answers1

0

As said in the (stackoverflow) comments above, it may not be possible to use (shell) comments inside multi-line commands. In bash, the lines

ls \
   # comment 
   -lrt

do not work but the lines

ls \
   -lrt

do.

In your script, the line

         -glt_label 2 ctrl -sem                       

should also end with a \, as there are 5 more options below.

Aligning those backslashes may look nice, but finding the missing one is easier without the extra whitespace :)

alle_meije
  • 2,424
  • 1
  • 19
  • 40
  • This is using `tcsh`, not Bash. By brief experimentation, `tcsh` reads the string after the backslash as an argument, not as a comment. But yeah, the script appears to be broken. (Writing a script in `tcsh` in 2020 is pretty broken in the first place.) – tripleee Aug 29 '22 at 06:14
  • Ah, so the original script was a mix of `tcsh` and `bash` syntax? I'm not an avid `tcsh` user myself... Apparently it lives on in `FreeBSD`. – alle_meije Sep 01 '22 at 12:31