New computing cluster; new afni_proc error: "arg #1 (-subj_id) requires 1 params, found 0"

AFNI version info (afni -ver): afni/21.3.04

Hello,

I am again struggling with running another script (this time afni_proc) on our system's new supercomputer. On our previous system, ROAR, we would execute the afni_proc script using "\. filename", but this doesn't seem to be working as I get the following error (see below). However, I do assign a subject number in the script and this same script worked on our previous systerm. Is there another way I need to execute this script? Or do you see anything else that should be modified? Any help would be much appreciated.

Thank you!
----------------------------------------------------------------------------------------------------------------------------------------

\. updated_afni_proc.csh 
** error: arg #1 (-subj_id) requires 1 params, found 0
----------------------------------------------------------------------
** failed command (get_user_opts):

  afni_proc.py -subj_id -script proc. -scr_overwrite -copy_anat               \
      /anatSS.sub-951.nii -anat_has_skull no -dsets / -blocks tshift align    \
      tlrc volreg blur mask scale regress -radial_correlate_blocks tcat       \
      volreg -tcat_remove_first_trs 0 -align_opts_aea -cost lpc+ZZ            \
      -giant_move -check_flip -tlrc_base -tlrc_NL_warp -tlrc_NL_warped_dsets  \
      anatQQ.sub-951.nii anatQQ.sub-951.aff12.1D anatQQ.sub-951_WARP.nii      \
      -volreg_align_to MIN_OUTLIER -volreg_align_e2a -volreg_tlrc_warp        \
      -mask_epi_anat yes -blur_size 4.0 -regress_stim_times                   \
      /LoseBig_FB_Correct.1D /LoseBig_FB_Error.1D /LoseSmall_FB_Correct.1D    \
      /LoseSmall_FB_Error.1D /WinBig_FB_Correct.1D /WinBig_FB_Error.1D        \
      /WinSmall_FB_Correct.1D /WinSmall_FB_Error.1D /Neutral_FB_Correct.1D    \
      /Neutral_FB_Error.1D /PunBig_Anticipation.1D /PunSmall_Anticipation.1D  \
      /WinBig_Anticipation.1D /WinSmall_Anticipation.1D                       \
      /Neutral_Anticipation.1D -regress_stim_labels LB_FB_Correct LB_FB_Error \
      LS_FB_Correct LS_FB_Error WB_FB_Correct WB_FB_Error WS_FB_Correct       \
      WS_FB_Error Neutral_FB_Correct Neutral_FB_Error PB_Anticipation         \
      PS_Anticipation WB_Anticipation WS_Anticipation Neutral_Anticipation    \
      -regress_basis_multi 'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)'        \
      'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)'       \
      dmBLOCK dmBLOCK dmBLOCK dmBLOCK dmBLOCK -regress_stim_types times times \
      times times times times times times times times AM1 AM1 AM1 AM1 AM1     \
      -regress_censor_motion 0.3 -regress_censor_outliers 0.05                \
      -regress_motion_per_run -regress_opts_3dD -gltsym 'SYM: LB_FB_Correct   \
      -LB_FB_Error' -glt_label 1 LoseBig_FB_Correct-LoseBig_FB_Error -gltsym  \
      'SYM: LB_FB_Correct -LS_FB_Correct' -glt_label 2                        \
      LoseBig_FB_Correct-LoseSmall_FB_Correct -gltsym 'SYM: LB_FB_Error       \
      -LS_FB_Correct' -glt_label 3 LoseBig_FB_Error-LoseSmall_FB_Correct      \
      -gltsym 'SYM: 0.333*LB_FB_Correct +0.333*LB_FB_Error                    \
      +0.333*LS_FB_Correct' -glt_label 4 mean.LLL -gltsym 'SYM: LB_FB_Correct \
      -0.5*LB_FB_Error -0.5*LS_FB_Correct' -glt_label 5 L-LL                  \
      -regress_3dD_stop -regress_reml_exec -regress_compute_fitts             \
      -regress_make_ideal_sum sum_ideal.1D -regress_est_blur_epits            \
      -regress_est_blur_errts -regress_run_clustsim no -html_review_style     \
      pythonic -execute

Below is a cleaner version of the script:

#!/usr/bin/env tcsh

# set data directories
set top_dir   = /storage/group/qum17/default/anhedonia/tasks/MID/948

# set subject and group identifiers
set subj      = s948
set group_id  = g1
set basedset = MNI152_2009_template_SSW.nii.gz

# run afni_proc.py to create a single subject processing script
afni_proc.py \
	-subj_id $subj \
	-script proc.$subj -scr_overwrite \
        -copy_anat $top_dir/anatSS.sub-948.nii \
	-anat_has_skull no \
	-test_stim_files no \
	-dsets \
            $top_dir/warped+orig.BRIK \
	-blocks tshift align tlrc volreg blur mask scale regress \
	-radial_correlate_blocks tcat volreg \
	-tcat_remove_first_trs 0 \
        -align_opts_aea -cost lpc+ZZ -giant_move -check_flip \
        -tlrc_base $basedset \
	-tlrc_NL_warp \
	-tlrc_NL_warped_dsets \
		anatQQ.sub-948.nii \
		anatQQ.sub-948.aff12.1D \
		anatQQ.sub-948_WARP.nii \
	-volreg_align_to MIN_OUTLIER \
        -volreg_align_e2a \
        -volreg_tlrc_warp \
       	-mask_epi_anat yes \
	-blur_size 4.0 \
        -regress_stim_times \
            $top_dir/LoseBig_FB_Correct.1D \
            $top_dir/LoseBig_FB_Error.1D \
            $top_dir/LoseSmall_FB_Correct.1D \
	    $top_dir/LoseSmall_FB_Error.1D \
	    $top_dir/WinBig_FB_Correct.1D \
            $top_dir/WinBig_FB_Error.1D \
            $top_dir/WinSmall_FB_Correct.1D \
	    $top_dir/WinSmall_FB_Error.1D \
	    $top_dir/Neutral_FB_Correct.1D \
            $top_dir/Neutral_FB_Error.1D \
	    $top_dir/PunBig_Anticipation.1D \
	    $top_dir/PunSmall_Anticipation.1D \
	    $top_dir/WinBig_Anticipation.1D \
	    $top_dir/WinSmall_Anticipation.1D \
	    $top_dir/Neutral_Anticipation.1D \
        -regress_stim_labels \
            LB_FB_Correct LB_FB_Error LS_FB_Correct LS_FB_Error WB_FB_Correct WB_FB_Error WS_FB_Correct WS_FB_Error Neutral_FB_Correct Neutral_FB_Error PB_Anticipation PS_Anticipation WB_Anticipation WS_Anticipation Neutral_Anticipation \
        -regress_basis_multi 'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)' 'dmBLOCK' 'dmBLOCK' 'dmBLOCK' 'dmBLOCK' 'dmBLOCK'  \
        -regress_stim_types times times times times times times times times times times AM1 AM1 AM1 AM1 AM1 \
        -regress_censor_motion 0.3 \
	-regress_censor_outliers 0.05 \
	-regress_motion_per_run \
        -regress_opts_3dD \
            -gltsym 'SYM: LB_FB_Correct -LB_FB_Error' \
	    -glt_label 1 LoseBig_FB_Correct-LoseBig_FB_Error \
            -gltsym 'SYM: LB_FB_Correct -LS_FB_Correct' \
	    -glt_label 2 LoseBig_FB_Correct-LoseSmall_FB_Correct \
            -gltsym 'SYM: LB_FB_Error -LS_FB_Correct' \
	    -glt_label 3 LoseBig_FB_Error-LoseSmall_FB_Correct \
            -gltsym 'SYM: 0.333*LB_FB_Correct +0.333*LB_FB_Error +0.333*LS_FB_Correct' \
	    -glt_label 4 mean.LLL \
            -gltsym 'SYM: LB_FB_Correct -0.5*LB_FB_Error -0.5*LS_FB_Correct' \
	    -glt_label 5 L-LL \
	-regress_3dD_stop \
	-regress_reml_exec \
	-regress_compute_fitts \
        -regress_make_ideal_sum sum_ideal.1D \
        -regress_est_blur_epits \
        -regress_est_blur_errts \
	-regress_run_clustsim no \
	-html_review_style pythonic \
	-execute

Hi-

While your "cleaner" script looks reasonably formatted, your initial command shows that, in line 13, there is no argument after the -subj_id opt. That is, you need to provide a value after that for the subject ID.

Your current line 13:

  afni_proc.py -subj_id -script proc. -scr_overwrite -copy_anat               \

... but it should be something like:

  afni_proc.py -subj_id SOMETHING -script proc. -scr_overwrite -copy_anat               \

Maybe that was generated without your script or something, or before the $subj was defined?


Just for simplicity of reading, this is your AP command with vertically aligned opts/args:

afni_proc.py                                                                 \
    -subj_id                  $subj                                          \
    -script                   proc.$subj                                     \
    -scr_overwrite                                                           \
    -copy_anat                $top_dir/anatSS.sub-948.nii                    \
    -anat_has_skull           no                                             \
    -test_stim_files          no                                             \
    -dsets                    $top_dir/warped+orig.BRIK                      \
    -blocks                   tshift align tlrc volreg blur mask scale       \
                              regress                                        \
    -radial_correlate_blocks  tcat volreg                                    \
    -tcat_remove_first_trs    0                                              \
    -align_opts_aea           -cost lpc+ZZ                                   \
                              -giant_move                                    \
                              -check_flip                                    \
    -tlrc_base                $basedset                                      \
    -tlrc_NL_warp                                                            \
    -tlrc_NL_warped_dsets     anatQQ.sub-948.nii anatQQ.sub-948.aff12.1D     \
                              anatQQ.sub-948_WARP.nii                        \
    -volreg_align_to          MIN_OUTLIER                                    \
    -volreg_align_e2a                                                        \
    -volreg_tlrc_warp                                                        \
    -mask_epi_anat            yes                                            \
    -blur_size                4.0                                            \
    -regress_stim_times       $top_dir/LoseBig_FB_Correct.1D                 \
                              $top_dir/LoseBig_FB_Error.1D                   \
                              $top_dir/LoseSmall_FB_Correct.1D               \
                              $top_dir/LoseSmall_FB_Error.1D                 \
                              $top_dir/WinBig_FB_Correct.1D                  \
                              $top_dir/WinBig_FB_Error.1D                    \
                              $top_dir/WinSmall_FB_Correct.1D                \
                              $top_dir/WinSmall_FB_Error.1D                  \
                              $top_dir/Neutral_FB_Correct.1D                 \
                              $top_dir/Neutral_FB_Error.1D                   \
                              $top_dir/PunBig_Anticipation.1D                \
                              $top_dir/PunSmall_Anticipation.1D              \
                              $top_dir/WinBig_Anticipation.1D                \
                              $top_dir/WinSmall_Anticipation.1D              \
                              $top_dir/Neutral_Anticipation.1D               \
    -regress_stim_labels      LB_FB_Correct LB_FB_Error LS_FB_Correct        \
                              LS_FB_Error WB_FB_Correct WB_FB_Error          \
                              WS_FB_Correct WS_FB_Error Neutral_FB_Correct   \
                              Neutral_FB_Error PB_Anticipation               \
                              PS_Anticipation WB_Anticipation                \
                              WS_Anticipation Neutral_Anticipation           \
    -regress_basis_multi      'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)'    \
                              'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)' 'BLOCK(2)'    \
                              'BLOCK(2)' 'BLOCK(2)' 'dmBLOCK' 'dmBLOCK'      \
                              'dmBLOCK' 'dmBLOCK' 'dmBLOCK'                  \
    -regress_stim_types       times times times times times times times      \
                              times times times AM1 AM1 AM1 AM1 AM1          \
    -regress_censor_motion    0.3                                            \
    -regress_censor_outliers  0.05                                           \
    -regress_motion_per_run                                                  \
    -regress_opts_3dD         -gltsym 'SYM: LB_FB_Correct -LB_FB_Error'      \
                              -glt_label 1                                   \
                              LoseBig_FB_Correct-LoseBig_FB_Error            \
                              -gltsym 'SYM: LB_FB_Correct -LS_FB_Correct'    \
                              -glt_label 2                                   \
                              LoseBig_FB_Correct-LoseSmall_FB_Correct        \
                              -gltsym 'SYM: LB_FB_Error -LS_FB_Correct'      \
                              -glt_label 3                                   \
                              LoseBig_FB_Error-LoseSmall_FB_Correct          \
                              -gltsym                                        \
                              'SYM: 0.333*LB_FB_Correct +0.333*LB_FB_Error +0.333*LS_FB_Correct' \
                              -glt_label 4 mean.LLL                          \
                              -gltsym                                        \
                              'SYM: LB_FB_Correct -0.5*LB_FB_Error -0.5*LS_FB_Correct' \
                              -glt_label 5 L-LL                              \
    -regress_3dD_stop                                                        \
    -regress_reml_exec                                                       \
    -regress_compute_fitts                                                   \
    -regress_make_ideal_sum   sum_ideal.1D                                   \
    -regress_est_blur_epits                                                  \
    -regress_est_blur_errts                                                  \
    -regress_run_clustsim     no                                             \
    -html_review_style        pythonic                                       \
    -execute

For human FMRI processing, we have found that this option tends to help EPI-anatomical alignment in the cases of notable EPI inhomogeneity:

-align_unifize_epi        local

It also doesn't seem to harm in cases without it---I would generally use it, I find it generally beneficial.

Just for some additional QC items in the output APQC HTML, I might change line 11 here to be:

    -radial_correlate_blocks  tcat volreg regress                            \

and add in this opt -volreg_compute_tsnr yes.

Re. using dmBLOCK: that can be a reasonable way to use it with amplitude modulation. I will just point out some notes we have put together on the uses of dmBLOCK and dmUBLOCK:
https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/statistics/deconvolve_block.html
Basically, people should probably be using one of the cases where amplitude changes with block duration---you have this property in yours, so that is good. The benefit of using dmUBLOCK with a negative argument is that you clearly specify what you want the reference duration to be, while also having that property. This is just a minor point, but might be useful for clarity/specificity.

And other folks might have some suggestions here, too, but those were a couple things that I noticed.

--pt

I might guess that the top line showing:

 \. updated_afni_proc.py

is the problem. You are basically sourcing the file, and your command shell is probably bash or zsh, so $subj is not actually getting set. Try running it with either:

./updated_afni_proc

or preferably with:

tcsh updated_afni_proc

-rick