Laynii on Biowulf

Laynii is a set of tools to analyze layer fMRI datasets.

References:

Interactive job
Interactive jobs should be used for deb ugging, graphics, or applications that cannot be run as batch jobs.

Allocate an interactive session and run the program.
Sam ple session (user input in bold):

[user@biowulf]$ sinteractive
salloc.exe: Pending job allocation 46116226
salloc.exe: job 46116226 queued and waiting for resources
salloc.exe: job 46116226 has been allocated resources
salloc.exe: Granted job allocation 46116226
salloc.exe: Waiting for resource configuration
salloc.exe: Nodes cn3144 are ready for job

[user@cn3144 ~]$ module load laynii
[user@cn3144 ~]$ cd /data/${USER}
[user@cn3144 ~]$ cp -r ${LAYNII_HOME}/test_data .
[user@cn3144 ~]$ cd test_data
[user@cn3144 ~]$ LN2_LAYER_SMOOTH -input sc_VASO_act.nii.gz -layer_file sc_layers.nii.gz -FWHM 1
=======================
LayNii v2.9.0          
=======================
LN2_LAYER_SMOOTH

    File name: sc_VASO_act.nii.gz
    Image details: 648 X | 648 Y | 15 Z | 1 T 
    Voxel size = 0.200617 x 0.200617 x 0.32
    Datatype = 4

    File name: sc_layers.nii.gz
    Image details: 648 X | 648 Y | 15 Z | 1 T 
    Voxel size = 0.200617 x 0.200617 x 0.32
    Datatype = 4

  Vicinity = 9
  FWHM = 1
  There are 20 layers to smooth within.
  Smoothing in layer, not considering sulci.
    100%
  Smoothing is done. 
    Writing output as:
      sc_VASO_act_layer_smoothed.nii.gz
  Finished.

[user@cn3144 ~]$ LN_LAYER_SMOOTH -input sc_VASO_act.nii.gz -layer_file sc_layers.nii.gz -FWHM 0.3 -NoKissing
I will not smooth across sluci, this might make it longer though
15 slices    648 PhaseSteps     648 Read steps    1 timesteps 
 Voxel size    0.200617 x 0.200617 x 0.32
 datatye 1 = 16
 datatye 2 = 8
debug  2 
 vinc 2
 FWHM_val 0.3
 There are  20 layers/masks to smooth within  
 vinc 2
 FWHM_val 0.3
 starting within sulucal smoothing now  
 106%   smoothing done  
writing as = smoothed_sc_VASO_act.nii.gz

[user@cn3144 ~]$ LN_BOCO -Nulled lo_Nulled_intemp.nii.gz -BOLD lo_BOLD_intemp.nii.gz -trialBOCO 40 -shift
Do a correlation analysis with temporal shifts.
=======================
LayNii v2.9.0          
=======================
LN_BOCO

    File name: lo_Nulled_intemp.nii.gz
    Image details: 162 X | 162 Y | 3 Z | 80 T 
    Voxel size = 0.802469 x 0.802469 x 1.28
    Datatype = 4

    File name: lo_BOLD_intemp.nii.gz
    Image details: 162 X | 162 Y | 3 Z | 80 T 
    Voxel size = 0.802469 x 0.802469 x 1.28
    Datatype = 4

    !!!Warning!!! Input nifti header contains scl_scale !=0.
    Make sure to check the resulting output image.

  Calculating shift = -3
  Calculating shift = -2
  Calculating shift = -1
  Calculating shift = 0
  Calculating shift = 1
  Calculating shift = 2
  Calculating shift = 3
  Doing BOLD correction after trial average...
    Trial duration is 40. This means there are 2 trials recorded here.
    Writing output as:
      VASO_trialAV_LN
    Writing output as:
      BOLD_trialAV_LN
    Writing output as:
      VASO_LN
  Finished.

[user@cn3144 ~]$ exit
salloc.exe: Relinquishing job allocation 46116226
[user@biowulf ~]$

Batch job
Most jobs should be run as batch jobs.

Create a batch input file (e.g. laynii.sh). Example command below:

#!/bin/bash
#SBATCH --cpus-per-task=4
#SBATCH --job-name=laynii-test
#SBATCH --mem=8g
#SBATCH --time=1:00:00
#SBATCH --partition=norm

module load laynii

cd /data/${USER}/test_data
LN2_LAYER_SMOOTH -input sc_VASO_act.nii.gz -layer_file sc_layers.nii.gz -FWHM 1
LN_LAYER_SMOOTH -input sc_VASO_act.nii.gz -layer_file sc_layers.nii.gz -FWHM 0.3 -NoKissing
LN_BOCO -Nulled lo_Nulled_intemp.nii.gz -BOLD lo_BOLD_intemp.nii.gz -trialBOCO 40 -shift

Submit this job using the Slurm sbatch command.

sbatch laynii.sh
Swarm of Jobs
A swarm of jobs is an easy way to submit a set of independent commands requiring identical resources.

Create a swarmfile (e.g. laynii.swarm). For example:

cd /data/${USER}/test_data_01; \
LN2_LAYER_SMOOTH -input sc_VASO_act.nii.gz \
                 -layer_file sc_layers.nii.gz \
                 -FWHM 1; \
LN_LAYER_SMOOTH -input sc_VASO_act.nii.gz \
                -layer_file sc_layers.nii.gz \
                -FWHM 0.3 -NoKissing; \
LN_BOCO -Nulled lo_Nulled_intemp.nii.gz \
                -BOLD lo_BOLD_intemp.nii.gz \
                -trialBOCO 40 \
                -shift
cd /data/${USER}/test_data_02; \
LN2_LAYER_SMOOTH -input sc_VASO_act.nii.gz \
                 -layer_file sc_layers.nii.gz \
                 -FWHM 1; \
LN_LAYER_SMOOTH -input sc_VASO_act.nii.gz \
                -layer_file sc_layers.nii.gz \
                -FWHM 0.3 -NoKissing; \
LN_BOCO -Nulled lo_Nulled_intemp.nii.gz \
                -BOLD lo_BOLD_intemp.nii.gz \
                -trialBOCO 40 \
                -shift
cd /data/${USER}/test_data_03; \
LN2_LAYER_SMOOTH -input sc_VASO_act.nii.gz \
                 -layer_file sc_layers.nii.gz \
                 -FWHM 1; \
LN_LAYER_SMOOTH -input sc_VASO_act.nii.gz \
                -layer_file sc_layers.nii.gz \
                -FWHM 0.3 -NoKissing; \
LN_BOCO -Nulled lo_Nulled_intemp.nii.gz \
                -BOLD lo_BOLD_intemp.nii.gz \
                -trialBOCO 40 \
                -shift

Submit this job using the swarm command.

swarm -f laynii.swarm -g 8 -t 4 --partition norm --module laynii
where
-g # Number of Gigabytes of memory required for each process ( 1 line in the swarm command file)
-t # Number of threads/CPUs required for each process (1 line in the swarm command file).
--module laynii Loads the laynii module for each subjob in the swarm