This is a test version of Biostars. For the public version, visit https://www.biostars.org.
SGE job array for MaSuRCA pipeline

This is a sh file from MaSuRCA pipeline. I want to do this by SGE array job or single job submit to server since the pipeline will take long time in this step. I did not know how to set up $SGE_TASK_ID. Could you give me some suggestions? Thanks, Fuyou

#!/bin/sh

perl='/usr/bin/env perl'

jobid=$SGE_TASK_ID
if [ x$jobid = x -o x$jobid = xundefined -o x$jobid = x0 ]; then
  jobid=$1
fi
if [ x$jobid = x ]; then
  echo Error: I need SGE_TASK_ID set, or a job index on the command line.
  exit 1
fi

bat=`head -n $jobid /scratch/snyder/f/fu115/Genome_assembly/Lordec/masurca21/MaSuRCA/CA.mr.41.15.17.0.029/0-overlaptrim-overlap/ovlbat | tail -n 1`
job=`head -n $jobid /scratch/snyder/f/fu115/Genome_assembly/Lordec/masurca21/MaSuRCA/CA.mr.41.15.17.0.029/0-overlaptrim-overlap/ovljob | tail -n 1`
opt=`head -n $jobid /scratch/snyder/f/fu115/Genome_assembly/Lordec/masurca21/MaSuRCA/CA.mr.41.15.17.0.029/0-overlaptrim-overlap/ovlopt | tail -n 1`
jid=$$

if [ ! -d /scratch/snyder/f/fu115/Genome_assembly/Lordec/masurca21/MaSuRCA/CA.mr.41.15.17.0.029/0-overlaptrim-overlap/$bat ]; then
  mkdir /scratch/snyder/f/fu115/Genome_assembly/Lordec/masurca21/MaSuRCA/CA.mr.41.15.17.0.029/0-overlaptrim-overlap/$bat
fi

if [ -e /scratch/snyder/f/fu115/Genome_assembly/Lordec/masurca21/MaSuRCA/CA.mr.41.15.17.0.029/0-overlaptrim-overlap/$bat/$job.ovb.gz ]; then
  echo Job previously completed successfully.
  exit
fi

if [ x$bat = x ]; then
  echo Error: Job index out of range.
  exit 1
fi

AS_OVL_ERROR_RATE=0.06
AS_CNS_ERROR_RATE=0.06
AS_CGW_ERROR_RATE=0.15
AS_OVERLAP_MIN_LEN=40
AS_READ_MIN_LEN=64
export AS_OVL_ERROR_RATE AS_CNS_ERROR_RATE AS_CGW_ERROR_RATE AS_OVERLAP_MIN_LEN AS_READ_MIN_LEN

syst=`uname -s`
arch=`uname -m`
name=`uname -n`

if [ "$arch" = "x86_64" ] ; then
  arch="amd64"
fi
if [ "$arch" = "Power Macintosh" ] ; then
  arch="ppc"
fi

bin="/depot/bioinfo/apps/apps/MaSuRCA-3.2.3/CA8/$syst-$arch/bin"

$bin/overlapInCore -G --hashbits 22 --hashload 0.75 -t 20 \
  $opt \
  -k 22 \
  -k /scratch/snyder/f/fu115/Genome_assembly/Lordec/masurca21/MaSuRCA/CA.mr.41.15.17.0.029/0-mercounts/genome.nmers.obt.fasta \
  -o /scratch/snyder/f/fu115/Genome_assembly/Lordec/masurca21/MaSuRCA/CA.mr.41.15.17.0.029/0-overlaptrim-overlap/$bat/$job.ovb.WORKING.gz \
  /scratch/snyder/f/fu115/Genome_assembly/Lordec/masurca21/MaSuRCA/CA.mr.41.15.17.0.029/genome.gkpStore \
&& \
mv /scratch/snyder/f/fu115/Genome_assembly/Lordec/masurca21/MaSuRCA/CA.mr.41.15.17.0.029/0-overlaptrim-overlap/$bat/$job.ovb.WORKING.gz /scratch/snyder/f/fu115/Genome_assembly/Lordec/masurca21/MaSuRCA/CA.mr.41.15.17.0.029/0-overlaptrim-overlap/$bat/$job.ovb.gz

exit 0
assembly

I added code markup to your post for increased readability. You can do this by selecting the text and clicking the 101010 button. When you compose or edit a post that button is in your toolbar, see image below:

101010 Button

OK. Thanks. I will do next time as what you said. Fuyou

1 answer

Probably the simplest solution is to use useGrid=false.

If you do want a better solution, then you should answer these questions: how are you trying to run MaSuRCA? What are the error messages? Do your workstation / server / cluster have SGE installed? I guess you are using useGrid=true?

Log in to answer this question.