can't find dataset error in bash script to automate 3dbucket

Hello,

I am trying to write a bash script to automate 3bbucket command in each subjects’ results folder and keep getting this error:

++ 3dbucket: AFNI version=AFNI_17.1.02 (Apr 27 2017) [64-bit]
can’t open dataset stats.A000488+tlrc.BRIK
++ 3dbucket: AFNI version=AFNI_17.1.02 (Apr 27 2017) [64-bit]
can’t open dataset stats.A000522+tlrc.BRIK

Here is the script:

#!/bin/tcsh

#created 5/22/17 to automate “3dbucket -prefix ceof.A000442.nii’stats.A000442+tlrc[1,4,7]'” for labeled V1
#must be run from /flash/whalen/DBURR/WHICHFEARREP/SUBJECTS/DAY2TASK/

foreach subject (A000499 A000500 A000526 A000588 A000602 A000606 A000613 A000619 A000635 A000651)

cd $subject

3dbucket -prefix coef.$subject.nii stats.$subject+tlrc'[1,4,7]'

cd ..

end

Any thoughts on this?

Thanks!

Hello,

It is a little odd that the errors show A000488 and
A000522, since they are not in that foreach list.

What is the output of this?

ls -l A000488/stats.A000488*
  • rick

Hi Rick,

I actually just pasted the the output from a different set of subjects, but it was the exact same message.

So basically, I get that message for every subject in the script, no matter what subject I put in:

Script:
#!/bin/tcsh

#created 5/22/17 to automate “3dbucket -prefix ceof.A000442.nii’stats.A000442+tlrc[1,4,7]'” for labeled V1
#must be run from /flash/whalen/DBURR/WHICHFEARREP/SUBJECTS/DAY2TASK/

foreach subject (A000452 A000454 A000455 A000479 A000484 A000485 A000499 A000500 A000526 A000575 A000588 A000602 A000606 A000613 A000619 A000635 A000651 A000661 A000686)

cd $subject

3dbucket -prefix coef.$subject.nii stats.$subject+tlrc'[1,4,7]'

cd ..

end

error:
++ 3dbucket: AFNI version=AFNI_17.1.02 (Apr 27 2017) [64-bit]
can’t open dataset stats.A000526+tlrc

also if its helpful, this is whats inside the results folder:
all_runs.A000488+tlrc.BRIK motion_A000488_CENSORTR.txt pb01.A000488.r04.tshift+orig.BRIK
all_runs.A000488+tlrc.HEAD motion_A000488_enorm.1D pb01.A000488.r04.tshift+orig.HEAD
anat_final.A000488+tlrc.BRIK.gz motion_demean.1D pb02.A000488.r01.volreg+tlrc.BRIK
anat_final.A000488+tlrc.HEAD motion_deriv.1D pb02.A000488.r01.volreg+tlrc.HEAD
anat_w_skull_warped+tlrc.BRIK mprage_al_junk_e2a_only_mat.aff12.1D pb02.A000488.r02.volreg+tlrc.BRIK
anat_w_skull_warped+tlrc.HEAD mprage_al_junk_mat.aff12.1D pb02.A000488.r02.volreg+tlrc.HEAD
censor_A000488_combined_2.1D mprage_al_junk+orig.BRIK.gz pb02.A000488.r03.volreg+tlrc.BRIK
coef.A000488.nii mprage_al_junk+orig.HEAD pb02.A000488.r03.volreg+tlrc.HEAD
corr_brain+tlrc.BRIK mprage_ns+orig.BRIK.gz pb02.A000488.r04.volreg+tlrc.BRIK
corr_brain+tlrc.HEAD mprage_ns+orig.HEAD pb02.A000488.r04.volreg+tlrc.HEAD
dfile.r01.1D mprage_ns+tlrc.BRIK.gz pb03.A000488.r01.blur+tlrc.BRIK
dfile.r02.1D mprage_ns+tlrc.HEAD pb03.A000488.r01.blur+tlrc.HEAD
dfile.r03.1D mprage_ns_WarpDrive.log pb03.A000488.r02.blur+tlrc.BRIK
dfile.r04.1D mprage_ns.Xaff12.1D pb03.A000488.r02.blur+tlrc.HEAD
dfile_rall.1D mprage_ns.Xat.1D pb03.A000488.r03.blur+tlrc.BRIK
@epi_review.A000488 mprage+orig.BRIK pb03.A000488.r03.blur+tlrc.HEAD
errts.A000488+tlrc.BRIK mprage+orig.HEAD pb03.A000488.r04.blur+tlrc.BRIK
errts.A000488+tlrc.HEAD out.cormat_warn.txt pb03.A000488.r04.blur+tlrc.HEAD
fitts.A000488+tlrc.BRIK outcount_A000488_censor.1D pb04.A000488.r01.scale+tlrc.BRIK
fitts.A000488+tlrc.HEAD outcount.r01.1D pb04.A000488.r01.scale+tlrc.HEAD
full_mask.A000488+tlrc.BRIK.gz outcount.r02.1D pb04.A000488.r02.scale+tlrc.BRIK
full_mask.A000488+tlrc.HEAD outcount.r03.1D pb04.A000488.r02.scale+tlrc.HEAD
gmean.errts.unit.1D outcount.r04.1D pb04.A000488.r03.scale+tlrc.BRIK
ideal_anxiety.1D outcount_rall.1D pb04.A000488.r03.scale+tlrc.HEAD
ideal_dominance.1D out.gcor.1D pb04.A000488.r04.scale+tlrc.BRIK
ideal_empathy.1D out.mask_ae_dice.txt pb04.A000488.r04.scale+tlrc.HEAD
ideal_sentence.1D out.mask_ae_overlap.txt @ss_review_basic
mask_anat.A000488+tlrc.BRIK.gz out.pre_ss_warn.txt @ss_review_driver
mask_anat.A000488+tlrc.HEAD out.ss_review.A000488.txt @ss_review_driver_commands
mask_epi_extents+tlrc.BRIK.gz pb00.A000488.r01.tcat+orig.BRIK stats.A000488+tlrc.BRIK
mask_epi_extents+tlrc.HEAD pb00.A000488.r01.tcat+orig.HEAD stats.A000488+tlrc.HEAD
mask_group.nii pb00.A000488.r02.tcat+orig.BRIK stats.REML_cmd
mask_group+tlrc.BRIK.gz pb00.A000488.r02.tcat+orig.HEAD stimuli
mask_group+tlrc.HEAD pb00.A000488.r03.tcat+orig.BRIK sum_ideal.1D
mat.r01.vr.aff12.1D pb00.A000488.r03.tcat+orig.HEAD TSNR.A000488+tlrc.BRIK
mat.r01.warp.aff12.1D pb00.A000488.r04.tcat+orig.BRIK TSNR.A000488+tlrc.HEAD
mat.r02.vr.aff12.1D pb00.A000488.r04.tcat+orig.HEAD warp.anat.Xat.1D
mat.r02.warp.aff12.1D pb01.A000488.r01.tshift+orig.BRIK X.jpg
mat.r03.vr.aff12.1D pb01.A000488.r01.tshift+orig.HEAD X.nocensor.xmat.1D
mat.r03.warp.aff12.1D pb01.A000488.r02.tshift+orig.BRIK X.stim.xmat.1D
mat.r04.vr.aff12.1D pb01.A000488.r02.tshift+orig.HEAD X.xmat.1D
mat.r04.warp.aff12.1D pb01.A000488.r03.tshift+orig.BRIK
motion_A000488_censor.1D pb01.A000488.r03.tshift+orig.HEAD

It looks like you are just missing another directory. That
stats dataset is in the results directory, not just the subject
one. So consider:

3dbucket -prefix coef.$subject.nii $subject.results/stats.$subject+tlrc'[1,4,7]'
  • rick

see screenshot as well

hmm…exact same message comes out.

Let’s try to clarify this. From the DAY2TASK directory,
what is the output of this command?

find . name ‘stats.A000488+tlrc*’

Keep in mind that “3dbucket” is not important here.
You are just having trouble with directories and file
names. It would be good for you to try to run the
script by hand (typing in one command at a time),
mixed with some ‘ls’ commands to see what is where.

First locate the exact files using ‘ls’, and then use
that naming in the script.

  • rick

Hi Rick

Yup, the script is working by hand and correctly outputs
coef.A000441.nii

I ran find . name ‘stats.A000488+tlrc*’ it outputs
find: `stats.A000488+tlrc*': No such file or directory

Definitely having trouble with file names and directories because I also am getting this error
A000441.ulresults_fixalignment: No such file or directory.
for this script (below), even though it works by hand as well

for #!/bin/tcsh

#created 5/22/17 to automate “3dbucket -prefix ceof.A000442.nii’stats.A000442+tlrc[1,4,7]'” for unlabeled
#must be run from /flash/whalen/DBURR/WHICHFEARREP/SUBJECTS/DAY2TASK/

foreach subject (A000441 A000442 A000443 A000452 A000453 A000454 A000455 A000479 A000484 A000485 A000487 A000488 A000493 A000498 A000499 A000500 A000522 A000526 A000580 A000581 A000582 A000583 A000584 A000585 A000587 A000588 A000589 A000590 A000598 A000599 A000600 A000601 A000602 A000605 A000606 A000613 A000619 A000635 A000651 A000661 A000665 A000683 A000686 A000688 A000691 A000698)

cd $subject'.ulresults_fixalignment'

3dbucket -prefix coef.$subject.nii stats.$subject+tlrc'[1]'

cd ..

end

-Daisy

Sorry Daisy, somehow I missed the ‘-’ before
the -name option, it should have read:

find . -name ‘stats.A000488+tlrc*’

Or you can type ‘ls’ command until finding the
proper datasets. But the find command should
point them out.

  • rick