Entering edit mode
6.8 years ago
fufuyou
▴
110
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
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:
OK. Thanks. I will do next time as what you said. Fuyou