User Tools

Site Tools


mkatari-bioinformatics-august-2013-blastnotes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revisionBoth sides next revision
mkatari-bioinformatics-august-2013-blastnotes [2013/08/13 15:18] – created mkatarimkatari-bioinformatics-august-2013-blastnotes [2013/08/13 15:28] mkatari
Line 1: Line 1:
-########################## +====== Run Blast using sbatch ======
-Run Blast using sbatch +
-##########################+
  
-1) create a new sbatch file (call it blast.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. +  - Create a new sbatch file (call it ''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. 
  
-''+<code>
 #!/bin/bash #!/bin/bash
  
 #SBATCH -p highmem #SBATCH -p highmem
 #SBATCH -n 8 #SBATCH -n 8
-''+</code>
  
-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.+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.
  
-2) There are several different job managers and different ways of setting up HPC computer systems. In practice I prefer not to assume that a job that is submitted to a different server will know how to find the different commands or even files. So I like to include the full paths for both. In order to find where the blastx command is located I simply type:+  - There are several different job managers and different ways of setting up HPC computer systems. In practice I prefer not to assume that a job that is submitted to a different server will know how to find the different commands or even files. So I like to include the full paths for both. In order to find where the ''blastx'' command is located I simply type:
  
-----------------------------------------------+<code>
 module load blast module load blast
 which blastx # note this will only work if you already have the blast module loaded. which blastx # note this will only work if you already have the blast module loaded.
 /export/apps/blast/2.2.28+/bin/blastx /export/apps/blast/2.2.28+/bin/blastx
-----------------------------------------------+</code>
  
-From Alan's Blast sbatch script example on the wiki, I also know where the nr database is+From Alan's Blast sbatch script example on [[using-slurm|How to Use Slurm]], I also know where the nr database is
  
------------------------------------------------+<code>
 /export/data/bio/ncbi/blast/db/nr /export/data/bio/ncbi/blast/db/nr
------------------------------------------------+</code>
  
-3) Edit the contigs.fa.nr.sbatch file to include all changes. Final script looks like this:+  - Edit the ''contigs.fa.nr.sbatch'' file to include all changes. Final script looks like this:
  
-----------------------------+<code>
 #!/bin/bash #!/bin/bash
  
Line 37: Line 35:
  
 /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 /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
-------------------------------+</code>
  
-4) Run the sbatch file. As soon as you run the file a job id will be assigned to your submission.+  - Run the sbatch file. As soon as you run the file a job id will be assigned to your submission.
  
------------------------+<code>
 sbatch blast.sbatch sbatch blast.sbatch
------------------------+</code>
  
 You can check the status of all jobs on the cluster by typing: You can check the status of all jobs on the cluster by typing:
  
------------------------+<code>
 squeue squeue
------------------------+</code>
  
 You can check the details of your specific job by typing: You can check the details of your specific job by typing:
  
-----------------------------------------------+<code>
 scontrol show job <your jobid> scontrol show job <your jobid>
-----------------------------------------------+</code>
  
 You can cancel your job by running You can cancel your job by running
  
-----------------------------------------------+<code>
 scancel <your jobid> scancel <your jobid>
-----------------------------------------------+</code>
  
 The standard output of your job is redirected to a file called  The standard output of your job is redirected to a file called 
  
-----------------------------------------------+<code>
 slurm-<your jobid>.out slurm-<your jobid>.out
-----------------------------------------------+</code>
  
mkatari-bioinformatics-august-2013-blastnotes.txt · Last modified: 2015/06/04 12:38 by mkatari