This is an old revision of the document!
Manny's Bioinformaics Workshop
contigs.fa.nr.sbatch) with the following heading. The #! MUST be the first line of the file. This tells the computer (or in this case snatch) to run the code using the bash shell interpreter. #!/bin/bash #SBATCH -p highmem #SBATCH -n 8
Normally any other # used in a bash script file means a comment follows. However since we are executing the sbatch file using sbatch command (see below) SBATCH knows to look for #SBATCH and use the information that follows. Here we are telling the SBATCH file to use the highmem partition (the mammoth server) and use 8 CPUs to perform the calculation. It is also important to tell that program you are running that it has 8 CPUs available so it will use them, else you will be reserving 8 CPUs but only using one.
blastx command is located I simply type:module load blast which blastx # note this will only work if you already have the blast module loaded. /export/apps/blast/2.2.28+/bin/blastx
From Alan's Blast sbatch script example on How to Use Slurm, I also know where the nr database is
/export/data/bio/ncbi/blast/db/nr
contigs.fa.nr.sbatch file to include all changes. Final script looks like this:#!/bin/bash #SBATCH -p highmem #SBATCH -n 8 /export/apps/blast/2.2.28+/bin/blastx -db /export/data/bio/ncbi/blast/db/nr -query /home/mkatari/ndl06-132-velvet31/contigs.fa -out /home/mkatari/ndl06-132-velvet31/contigs.fa.nr -num_threads 8 -outfmt 6 -evalue 0.00001
sbatch blast.sbatch
You can check the status of all jobs on the cluster by typing:
squeue
You can check the details of your specific job by typing:
scontrol show job <your jobid>
You can cancel your job by running
scancel <your jobid>
The standard output of your job is redirected to a file called
slurm-<your jobid>.out
#!/bin/bash #SBATCH -p batch #SBATCH -n 8 INPUT=$1 OUTPUT="$1".output echo $INPUT echo $OUTPUT /export/apps/blast/2.2.28+/bin/blastx -db /export/data/bio/ncbi/blast/db/nr -query $INPUT -out $OUTPUT -num_threads 8 -outfmt 6 -evalue 0.00001
Arguments on a command line are interpreted by the bash script in sequence. The values automatically inherit the variable $1, $2, $3 … as they are read from command line. It is a good idea to reassign these with variables that have names that make sense to us. Any string of characters (without spaces) provided after the script name will be assigned as $1 and then the variable INPUT will be assigned this value. In the script above we also see how to create a new variable OUTPUT which contains the same information as INPUT but now also contains a ".output"
Now to refer to the value saved in the variables we simply put $ infront as shown in the blast command line.
To execute this sbatch file you would simply provide the name of the input file as shown below.
sbatch /home/mkatari/blast.sbatch /home/mkatari/ndl06-132-velvet31/contigs.fa