[TOC title:Table-of-Content]

## Sbatch script template

A job refers to a specific resource allocation by slum, the specifics are definied by the users and what runs in the job also.
Running a job can be in one line if simple enough, for example requesting interactive session on a compute node with 8GB RAM, 1 core on 1 node for 30minutes can be done like so,

```sh
salloc --nodes=1 --ntasks-per-node=1 --mem=8G --time=00:30:00 -p short
```

In other use cases, it is better to define a slurm batch script, below is a script prototype.

```sh
#!/bin/bash

# Example sbatch script

#SBATCH -J test                                                           # Job name
#SBATCH -o /work/<<USERNAME>>/job.%j.out   # Name of standard log file (%j expands to jobId)
#SBATCH -e /work/<<USERNAME>>/job.%j.err    # Name of error file (%j expands to jobId)
#SBATCH --nodes=1
#SBATCH -n 16                                                             # Total number of threads requested or total number of mpi tasks
#SBATCH --mem=2000                                               # Maximum amount of memory in Mb the job can use
#SBATCH -t 00:30:00                                                   # Run time ([d-]hh:mm:ss) 
#SBATCH --mail-type=ALL                                          # Will send you email notification everytime the status of your job changes
#SBATCH --mail-user=your.email@wur.nl

# Load your software/command
module load CMD/version

# Run your command
CMD [OPTIONS] INPUTS
```

to submit the job to slurm use the command below, let's assume the sbatch script file is called, my_job.sbatch

```sh
sbtach my_job.sbatch
```

Obviously, the above script will not work if run. It is a simple template to highlight the different parts of a batch script.

## Find and load software

The bioinformatics software are not directly installed on the machines but in a separate environment where they can be shared accross all machines. To use them users have to first load them, this is true for interactive or non-interactive jobs.

Use the command ```module``` for any software/tools operations.

* To check which programs are loaded (ready to be used), use the command below.

```
module list
```

* To check which software are available run the command,

```
module avail
```

* To search for a module,

```
module avail <<keyword>>
#OR
module spider <<keyword>>
```

* To load a module do,

```
module load <<MODULENAME/VERSION>>
```

## Complementary module commands

module unload [module_name/version]


module switch

module purge