New to FSL: want to create a batch file using a template FEAT fsf

Hello!

My lab is currently comparing pipelines for fmri analysis. Right now I am working on setting up our fsl pipeline. I’ve set up all of the appropriate inputs (BET’d anatomicals, events txt files, confounds txt files, slice timing files…) and have used the FSL gui to run FEAT on one subject. Following the instructions at this guide I saved the parameters as and FSF, then went through and replaced subject-specific data with variables.

e.g. this:

4D AVW data or FEAT directory (1)
set feat_files(1) “/oak/stanford/groups/russpold/data/uh2/aim1/BIDS_scans/sub-s999/ses-1/func/sub-s999_ses-1_task-DPX_run-1_bold”

and this:

Total volumes
set fmri(npts) 1100

became:

4D AVW data or FEAT directory (1)
set feat_files(1) “/oak/stanford/groups/russpold/data/uh2/aim1/BIDS_scans/{RELATIVE_BOLD}”

Total volumes
set fmri(npts) {NTP}

because the ntp varies based on how long the subject was comfortable in the scanner, I have a python script that looks at each nii.gz 's header and then writes a string like this to my sbatch file:

sed -e “s|{RELATIVE_BOLD}|/sub-s999/ses-1/func/sub-s999_ses1_task-DPX_run-1_bold|g” -e “s|{SUBJECT}|s999|g” -e “s|{NTP}|1100|g” template_DPX_fsl.fsf | feat

So my sbatch file will just be a long list of these strings (I’m sure there is a better way but am struggling to happen upon one).

Unfortunately, this is not working. the slurm .err file is blank, and the .out file is simply

Usage: feat <design.fsf>

Nothing else seems to be generated. My hope is that one of you knowledgeable readers will quickly (and with minimal judgement) catch my error, or know where to look for more information.

Best,
Henry

Hi @henrymj,

It seems like you’ve got a good start on trying to automate this process, which can certainly be a hassle at times. For what it’s worth, here are some other fields you may want to consider adjusting as well:

# Output directory
set fmri(outputdir) 

# Confound EVs text file for analysis 1
set confoundev_files(1)

# Custom EV file (EV 1)
set fmri(custom1)

I personally am not familiar with slurm (my institution uses the qsub scheduler); however, I think the issue may lie on how you’re submitting the slurm job. Whenever I run a script to generate a new .fsf file I also generate a bash file (let’s call it fsl_feat1.sh), and inside that bash file is the command feat /path/to/FSL/FEAT/fsl_feat1.fsf (provide the full path to the .fsf file you’ve made/edited). Finally, in my qsub command I have it execute the bash file which contains the command to run FEAT on the .fsf file. This approach may work for you as well, even though you’re using slurm.

This guide by Andy Jahn may also be helpful; it was what I used to help build my FEAT automation.

1 Like

Hi @dlevitas,

This was incredibly useful! I was able to set up the two step process of

  1. generate edited fsf (s999_DPX.fsf) and batch file (run_s999_DPX.batch)
    which contains

feat /path/to/s999_DPX.fsf

  1. then use slurm to run the batch file.

it’s working like a charm. Thank you for your guidance

MANAGED BY INCF