afni_proc.py >> script creation failure for block 'regress' and failure to load in divorced timing files

Hello!
I am trying to rerun some individual level analyses and am running into 2 errors that I cannot understand:


I have checked the integrity of the divorced timing files (onset only) with file_tool -test -infile xxx but the output declares no bad characters and file type: Unix. I even created the FIXED.1D file with the -prefix command and the output was identical with no discernable changes from the original 1D timing file.
I don't know what to make of the failure to create script error, as several other folks seemed to have this problem fixed by fixing the timing files or adding a command which we already use in this code. Here is the code:

# **CHANGE ME**: Specify subject numbers in a single row. Include the s (e.g., s305)
set subjects = ( s4273 s305 s1571 s1712 s1146 s1585 s1603 s1622 s1671 s1696 s1718 s1754 s4075 s4096 s4148 s4142 s318 s563 s651 s747 s1541 s1562 s1573 s1577 s1587 s1591 s1610 s1614 s1629 s1639 s1692 s1693 s1714 s1722 s1746 s4084 s4089 s4130 s4136 s1521 s4111 s4128 s4164 s4201 s4207 s4209 s4211 s4220 s4242 s4262 s4228 )

#run s4273 s305 s1571 s1712 s1146 s1585 s1603 s1622 s1671 s1696 s1718 s1754 s4075 s4096 s4148 s4142 s318 s563 s651 s747 s1541 s1562 s1573 s1577 s1587 
#s1591 s1610 s1614 s1629 s1639 s1692 s1693 s1714 s1722 s1746 s4084 s4089 s4130 s4136 s1521 s4111 s4128 s4164 s4201 s4207 s4209 s4211 s4220 s4242 s4262 
#s4228

######################################################
# SPECIFY ANALYSIS NAME, MOTION AND TR EXCLUSION PREFERENCES
######################################################

# **CHECK ME**: Provide the name of the GLM you are running; The motion censor value will be appended to the end
set GLM = SEATReputationBLOCK
# **CHECK ME**: Specify the maximum amount of motion allowed without censoring
set motion_max = 1



######################################################
# SPECIFY LOCATIONS
######################################################

# Specify the top-most directory associated with the study
set topdir = /data/projects/STUDIES/SEAT/fMRI

# Specify the directory where subjects' neuroimaging data that have been run through the BIDS conversion
set subjfmridata = /data/projects/STUDIES/SEAT/fMRI/bids

# Specify the directory where subjects' timing/behavioral data are located
set subjecttiming = /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFiles

# Specify the directory where individual subject analysis afni_proc.py and results will be written
set results = /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/IndvlLvlAnalyses

set anat_dir = /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/ssw

############################################################################################
# THE ANALYSIS SCRIPT BEGINS HERE
############################################################################################

######################################################
# NAVIGATE TO PROPER LOCATION, AND FINISH SET-UP
######################################################

# Go to the results tree and work from there
cd $results

# For each of the subjects, specified in the subjects list...
foreach subj ( $subjects )

# Make a new subject results folder
mkdir $subj

# Change directories into that folder to work
cd $subj


##### Set subject-specific data to be used in afni_proc  ####

# Specify the subject's fMRI data directory path
set subj_dir = $subjfmridata/sub-$subj

# Specify the folder where the unmarried (onset only) stimulus timing files are located
set stimdurmoddir = $subjecttiming/sub-$subj

######################################################
# SPECIFY PARAMETERS FOR AFNI_PROC.PY
######################################################

    afni_proc.py -subj_id $subj 																\
	-dsets 			$subj_dir/func/sub-${subj}_task-seat_run-01_bold.nii.gz 					\
					$subj_dir/func/sub-${subj}_task-seat_run-02_bold.nii.gz 					\
					$subj_dir/func/sub-${subj}_task-seat_run-03_bold.nii.gz 					\
	-scr_overwrite 																				\
	-script $results/$subj/proc.$subj.$GLM.${motion_max}mm										\
	-out_dir $subj.results.$GLM.${motion_max}mm													\
	-blocks despike tshift align tlrc volreg blur mask scale regress							\
	-copy_anat         $anat_dir/sub-${subj}/anatSS.$subj.nii       							\
	-anat_has_skull    no                                 										\
	-anat_follower     anat_w_skull anat $anat_dir/sub-${subj}/anatU.$subj.nii  				\
	-mask_epi_anat     yes                                										\
	-tlrc_base MNI152_2009_template_SSW.nii.gz  												\
	-tshift_align_to -tzero 0																	\
	-align_opts_aea																				\
		-giant_move																				\
		-cost lpc+ZZ																			\
		-AddEdge																				\
	    -anat_uniform_method unifize															\
	-tlrc_NL_warp																				\
	-tlrc_NL_warped_dsets                       												\
			$anat_dir/sub-${subj}/anatQQ.${subj}.nii                							\
			$anat_dir/sub-${subj}/anatQQ.${subj}.aff12.1D           							\
			$anat_dir/sub-${subj}/anatQQ.${subj}_WARP.nii										\
	-volreg_align_to MIN_OUTLIER																\
	-volreg_align_e2a 																			\
	-volreg_tlrc_warp 																			\
	-volreg_warp_dxyz 3								 											\
	-blur_size 6 																				\
	-mask_dilate 1 																				\
	-scale_max_val 200																			\
	-regress_censor_outliers 0.1                      											\
	-regress_motion_per_run																		\
	-regress_censor_motion $motion_max                      									\
	-regress_est_blur_epits                               										\
	-regress_est_blur_errts                                 									\
	-regress_run_clustsim yes																	\
	-regress_compute_fitts																		\
	-html_review_style pythonic                           										\
	-regress_stim_times	   																		\
			    $stimdurmoddir/nodm_Mean_anticipation.1D_A										\
			    $stimdurmoddir/nodm_Mean_feedback.1D_A											\
			    $stimdurmoddir/nodm_Mean_response.1D_A											\
			    $stimdurmoddir/nodm_Nice_anticipation.1D_A										\
			    $stimdurmoddir/nodm_Nice_feedback.1D_A											\
			    $stimdurmoddir/nodm_Nice_response.1D_A											\
			    $stimdurmoddir/nodm_Unp_anticipation.1D_A										\
			    $stimdurmoddir/nodm_UnpMean_feedback.1D_A										\
			    $stimdurmoddir/nodm_UnpMean_response.1D_A										\
			    $stimdurmoddir/nodm_UnpNice_feedback.1D_A										\
			    $stimdurmoddir/nodm_UnpNice_response.1D_A										\
	-regress_stim_labels																		\
				Ant.Mean																		\
			    FB.Mean																			\
			    Resp.Mean																		\
			    Ant.Nice																		\
			    FB.Nice																			\
			    Resp.Nice																		\
			    Ant.Unp																			\
			    FB.UnpMean																		\
			    Resp.UnpMean																	\
			    FB.UnpNice																		\
			    Resp.UnpNice																	\
	-regress_stim_types 	   																	\
								'times'															\
	-regress_basis_multi 																		\
							'BLOCK(3,1)'														\
							'BLOCK(2,1)'														\
							'BLOCK(3,1)'														\
							'BLOCK(3,1)'														\
							'BLOCK(2,1)'														\
							'BLOCK(3,1)'														\
							'BLOCK(3,1)'														\
							'BLOCK(2,1)'														\
							'BLOCK(3,1)'														\
							'BLOCK(2,1)'														\
							'BLOCK(3,1)'														\
	-regress_make_ideal_sum IDEAL_sum.1D 														\
	-regress_opts_3dD 																			\
		-GOFORIT 10																				\
		-allzero_OK																				\
		-num_glt 15																				\
			-gltsym 'SYM: +Ant.Mean +FB.Mean +Resp.Mean +Ant.Nice +FB.Nice +Resp.Nice +Ant.Unp +FB.UnpMean +Resp.UnpMean +FB.UnpNice +Resp.Nice' -glt_label 1 Task.V.BL					\
			-gltsym 'SYM: +Ant.Mean +Ant.Nice +Ant.Unp' -glt_label 2 Ant.V.BL 																											\
			-gltsym 'SYM: +Ant.Mean -Ant.Nice' -glt_label 3 Ant.Mean.V.Nice 		 																									\
			-gltsym 'SYM: +Ant.Mean -Ant.Unp' -glt_label 4 Ant.Mean.V.Unp																												\
			-gltsym 'SYM: +Ant.Nice -Ant.Unp' -glt_label 5 Ant.Nice.V.Unp 		  																										\
			-gltsym 'SYM: +FB.Mean +FB.Nice +FB.UnpMean +FB.UnpNice' -glt_label 6 FB.V.BL 																								\
			-gltsym 'SYM: +FB.Mean +FB.UnpMean -FB.Nice -FB.UnpNice' -glt_label 7 FB.Mean.V.Nice																						\
			-gltsym 'SYM: +FB.Mean -FB.UnpMean' -glt_label 8 FB.Mean.V.UnpMean																											\
			-gltsym 'SYM: +FB.Nice -FB.UnpNice' -glt_label 9 FB.Nice.V.UnpNice																											\
			-gltsym 'SYM: +FB.Mean +FB.Nice -FB.UnpMean -FB.UnpNice' -glt_label 10 FB.Pred.V.Unp																						\
			-gltsym 'SYM: +Resp.Mean +Resp.Nice +Resp.UnpMean +Resp.UnpNice' -glt_label 11 Resp.V.BL																					\
			-gltsym 'SYM: +Resp.Mean -Resp.Nice' -glt_label 12 Resp.Mean.V.Nice																											\
			-gltsym 'SYM: +Resp.Mean -Resp.UnpMean' -glt_label 13 Resp.Mean.V.UnpMean																									\
			-gltsym 'SYM: +Resp.Nice -Resp.UnpNice' -glt_label 14 Resp.Nice.V.UnpNice																									\
			-gltsym 'SYM: +Resp.Mean +Resp.Nice -Resp.UnpMean -Resp.UnpNice' -glt_label 15 Resp.Pred.V.Unp																				\
		-cbucket cbucket.stats.$subj																																					\
		-jobs 30																																										\

cd ..
end

Hello,

This is probably a path issue, for the location/name of the file. To be sure,
what is the output from:

ls -l /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFiles/sub-s4273
ls -l /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFiles/sub-s4273/nodm_UnpNice_feedback.1D_A
  • rick

My mentor found that my divorced timing files all have a space before the beginning of each line, I bet that's what it is. Any tips on how to remove?
Here is that output you were looking for:
tur50860@cla19097:/data/projects/STUDIES/SEAT/fMRI/code/afni$ ls -l /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFiles/sub-s4273/nodm_UnpNice_feedback.1D_A.1D
-rw-rw-r-- 1 tur50860 domain^users 93 Oct 30 11:16 /data/projects/STUDIES/SEAT/fMRI/derivatives/afni/TimingFiles/sub-s4273/nodm_UnpNice_feedback.1D_A.1D

This command and output does not match the error or what I asked for. The error and afni_proc.py command show files that end in .1D_A, while the file you just displayed with ls -l ends in .1D_A.1D. I think the names in the afni_proc.py command are not quite correct, missing the final .1D.

It can be helpful to copy-and-paste questionable names from an error with an "ls -l" command, to be sure that the they are correct.

  • rick

Yes, this lack of the final .1D is also something my mentor pointed out. As when I copied in the command you gave me word for word the file/directory did not exist. Please disregard, as I think I need to take a step back and address another issue with the divorce command, remove the leading spaces in the timing files that are being properly divorced, and add the lack of the final .1D in the proc.py script. (divorce command is only splitting 8 out of 11 stim events, need to recoup and begin a new thread from the point of timing file creation)

Thanks so much

That sounds good. Note that spaces at the starts of lines should not matter.

  • rick