How to do regression with new regressors again without having to run all the code?

Hi, I’m new with AFNI software. I just used uber_subject.py GUI to do fMRI analysis. But now, I have new regressors so I want to use these new regressors to do the anlysis again. However, I do not want to run the whole proc.Subject again because it takes too much time. Does anybody know how to do GLM again with the new regressors without having to run all the code? Thanks.

There should be an afni_proc.py command script in the subject directory.
Copy it and add options like -write_3dD_script and -write_3dD_prefix,
which should allow you to create updated a 3dDeconvolve script.
Running the updated afni_proc.py command with those options, plus
the ones that include your new regressors, should work out.

  • rick

Hi Rick,

Thanks for your response. What do you mean add options like -write_3dD_script and -write_3dD_prefix? Do you mean I should copy the ‘proc.Subject’ command to a new folder and change the regressors and then just add '-write_3dD_script ’ and ‘-write_3dD_prefix’ these two command inside the ‘proc.Subject’ command? Thanks.

Those are afni_proc.py options. Add them to your modified
afni_proc.py command script (not the proc script), and it will
generated scripts to run a modified 3dDeconvolve command.

  • rick

Do you mean add the two command ‘-write_3dD_script’ and ‘-wtite_3dD_prefi’ into the ‘cmd.ap.Subj’ command script? In what position should I put these two commands? And after I place these two commands and add the new regressors, is it correct to rerun the script ‘cmd.ap.Subj’ like this: ‘tcsh -xef cmd.ap.Subj’ ?
Thanks.

Hi Rick,

I just re-run the ‘cmd.ap.Subj’ script like this: ’ tcsh -xef cmd.ap.Subj’. But there showed some errors saying that the ‘-write_3dD_script’ does not exis. Do you know how to solve this problem?

If it says “command not found”, then you need to fix the \ characters for line continuation. Can you post the exact error message, possibly along with your command.

  • rick

#!/usr/bin/env tcsh

created by uber_subject.py: version 0.40 (March 30, 2017)

creation date: Thu Aug 30 17:28:04 2018

set data directories

set top_dir = /data/ffang3/fMRI_analysis/Subj16_guo_kai
set anat_dir = $top_dir/Raw_Data
set epi_dir = $top_dir/Raw_Data
set stim_dir = $top_dir/Time

set subject and group identifiers

set subj = Subject16_GuoKai
set group_id = EmotionRegulationStudy

run afni_proc.py to create a single subject processing script

afni_proc.py
-write_3dD_script
-write_3dD_prefix
-subj_id $subj
-script proc.$subj -scr_overwrite
-blocks tshift align tlrc volreg blur mask scale regress
-copy_anat $anat_dir/guo_kai_T1.nii
-tcat_remove_first_trs 0
-dsets
$epi_dir/guo_kai_sess1.nii
$epi_dir/guo_kai_sess2.nii
$epi_dir/guo_kai_sess3.nii
$epi_dir/guo_kai_sess4.nii
-volreg_align_to third
-volreg_align_e2a
-volreg_tlrc_warp
-blur_size 3.0
-regress_stim_times
$stim_dir/stim.guo_kai.negEmoReg.1D
$stim_dir/stim.guo_kai.negative.1D
$stim_dir/stim.guo_kai.neutral.1D
$stim_dir/stim.guo_kai.netesting.1D
-regress_stim_labels
gEmoReg gative utral testing
-regress_basis ‘BLOCK(5,1)’
-regress_censor_motion 0.3
-regress_apply_mot_types demean deriv
-regress_opts_3dD
-jobs 4
-gltsym ‘SYM: gEmoReg -gative’ -glt_label 1 gEmoReg-gative
-gltsym ‘SYM: gEmoReg -utral’ -glt_label 2 gEmoReg-utral
-gltsym ‘SYM: gative -utral’ -glt_label 3 gative-utral
-gltsym ‘SYM: 0.333gEmoReg +0.333gative +0.333utral’
-glt_label 4 mean.GGU
-gltsym 'SYM: gEmoReg -0.5
gative -0.5*utral’ -glt_label 5 G-GU
-regress_compute_fitts
-regress_make_ideal_sum sum_ideal.1D
-regress_est_blur_epits
-regress_est_blur_errts

I have posted my command script. Is there anything wrong with it?

The error is: ‘-write_3dD_script: Common not found’

This is missing line continuation on the first line, which
is why it is viewing -write_3dD_script as a command,
which is then not found.

Note that each of those -write_3dD_* options takes one
parameter, the script name and the desired prefix,
respectively.

  • rick