Module Samtools
Contents |
|---|
Interactive job
Open an interactive session to a compute node. Adjust the number of CPUs (--cpus-per-task 8) and the amount of memory (--mem 16G) needed for your job.
srun --cpus-per-task 8 --mem 16G --pty bash
Load samtools module.
module load samtools
Run samtools.
samtools sort -n -@8 file.cram
[user@athena1 ~]$ srun --cpus-per-task 8 --mem 16G --pty bash
[user@athena101 ~]$ module load samtools
[user@athena101 ~]$ samtools sort -n -@8 file.cram
...
Batch job
Create the Slurm script file. Adjust the number of CPUs (--cpus-per-task 8) and the amount of memory (--mem 16G) needed for your job.
samtools_slurm_script.sh
#!/bin/bash
#SBATCH --job-name samtools_job
#SBATCH --output samtools_job_output.log
#SBATCH --error samtools_job_error.log
#SBATCH --cpus-per-task 8
#SBATCH --mem 16G
module load samtools
samtools sort -n -@$SLURM_CPUS_PER_TASK file.cram
Submit the job to Slurm.
sbatch samtools_slurm_script.shMonitor the execution of your job in the Slurm queue.
squeue -u $USERThe job may show up in the queue as running (R) or pending (PD). When the job completes, it will disappear from the queue and you can check the output.
[user@athena1 ~]$ sbatch samtools_slurm_script.sh
Submitted batch job 123
[user@athena1 ~]$ squeue -u $USER
JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON) ## Job is running with JOBID 123
123 cpu samtools_job user R 0:01 1 athena101
[user@athena1 ~]$ squeue -u $USER
JOBID PARTITION NAME USER ST TIME NODES NODELIST(REASON) ## JOBID 123 completed and exited the queue
[user@athena1 ~]$ cat samtools_job_output.log
...