Skip to content

Instantly share code, notes, and snippets.

@alanorth
Created January 31, 2023 08:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alanorth/b4a9790cd570cd0c16bf70f61b1438f3 to your computer and use it in GitHub Desktop.
Save alanorth/b4a9790cd570cd0c16bf70f61b1438f3 to your computer and use it in GitHub Desktop.
Example of SLURM array job for Everlyn
#!/usr/bin/bash -l
#SBATCH -p batch
#SBATCH -n 8
#SBATCH -J prank
# Start a job array with eight CPUs total where we iterate over 1,000+ FASTA
# files and start a prank command for each one. SLURM ensures that there are
# no more than eight running at the same time within the same allocation.
#
# See: https://support.ceci-hpc.be/doc/_contents/QuickStart/SubmittingJobs/SlurmTutorial.html#packed-jobs-example
# Location of input files
DATA_DIR=/home/aorth/phyml
# Location to write output files in node's scratch space
SCRATCH_DIR=/var/scratch/aorth/2018-02-13-prank
# Create scratch directory and move into it
mkdir -p $SCRATCH_DIR
cd $SCRATCH_DIR
# Load a specific version of prank
module load prank/170427
# Change to directory of input files
cd $DATA_DIR
# Iterate over all FASTA files
for file in Hircus-*.fas; do
# Run prank with 1 CPU, output to scratch directory
srun -n1 --exclusive prank -d=$file -o=$SCRATCH_DIR/${file%.fas} -codon -F -f=paml &
done
wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment