I am trying to use PBS Arrays to submit in parallel 5 jobs using the same program on different files. PBS will start five different copies of the script, each with a different integer in the PBS_ARRAYID
variable. The script would be run with: qsub script.pbs
My current code is below; while it works as-is, it's calculating the list of files multiple times in each batch process. Is there a more efficient way to do this?
#PBS -S /bin/bash
#PBS -t 1-5 #Makes the $PBS_ARRAYID have the integer values 1-5
#PBS -V
workdir="/user/test"
samtools sort` `find ${workdir}/*.bam | sed ${PBS_ARRAYID}'!d'` > `find ${workdir}/*.bam | sed ${PBS_ARRAYID}'!d' | sed "s/.bam/.sorted.bam/"`