User Tools

Site Tools


mkatari-bioinformatics-august-2013-more-slurm

Differences

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

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
mkatari-bioinformatics-august-2013-more-slurm [2014/06/09 07:53] – created mkatarimkatari-bioinformatics-august-2013-more-slurm [2014/06/09 07:58] – [Some more useful SLURM notes] mkatari
Line 20: Line 20:
  
 INPUT=$1 INPUT=$1
-OUTPUT=$INPUT.output2+OUTPUT=$INPUT.output
  
 module load blast/2.2.28+ module load blast/2.2.28+
Line 32: Line 32:
 </code> </code>
  
 +=== Generating sbatch scripts on the fly ===
 +
 +<code>
 +#!/bin/env bash                                                                                      
 +#SBATCH -p batch                                                                                     
 +#SBATCH -J blastn                                                                                    
 +#SBATCH -n 4                                                                                         
 +
 +#results of the ls command is captured in the variable FILES                                         
 +FILES=`ls test*fa`
 +
 +#loop through all files in FILES and each iteration, INPUT will have name of one file                
 +for INPUT in $FILES
 +do
 +
 +#this line gets printed into screen                                                                  
 +echo "file name "$INPUT
 +
 +#creating variables to store values                                                                  
 +SBATCH=$INPUT.blast.sbatch
 +OUTPUT=$INPUT.output
 +
 +#the following echo is going to be saved in sbatch file to be executed later                         
 +echo "#!/bin/env bash                                                                                
 +#SBATCH -p batch                                                                                     
 +#SBATCH -J blastn                                                                                    
 +#SBATCH -n 4                                                                                      
 +                                                                                                     
 +module load blast/2.2.28+                                                                            
 +                                                                                                     
 +echo \"Ready to run Blast\"                                                                          
 +                                                                                                     
 +blastn -query $INPUT -db nt -out $OUTPUT -num_threads 4                                              
 +echo \"Blast Done\"                                                                                  
 +" > $SBATCH
 +
 +#now that the file is done writing, execute the sbatch file                                          
 +sbatch $SBATCH
 +
 +#end of the loop. code will be repeated (starting at "do") until all files in FILES is done.         
 +done
 +
 +</code>
mkatari-bioinformatics-august-2013-more-slurm.txt · Last modified: 2014/06/09 08:19 by mkatari