From ae3d13405bc5e7010ae98be3a2bc8d73fbea7c7d Mon Sep 17 00:00:00 2001
From: Holger Brandl <holgerbrandl@gmail.com>
Date: Wed, 24 Feb 2016 08:40:52 +0100
Subject: [PATCH] rreplace mysub with jl submit

---
 dge_workflow/dge_utils.sh | 31 +++++++++++++++----------------
 1 file changed, 15 insertions(+), 16 deletions(-)

diff --git a/dge_workflow/dge_utils.sh b/dge_workflow/dge_utils.sh
index 216be8f..c000192 100755
--- a/dge_workflow/dge_utils.sh
+++ b/dge_workflow/dge_utils.sh
@@ -96,13 +96,10 @@ for fastqFile in $fastqFiles ; do
         continue;
     fi
     
-
-    mysub "fastqc__$(basename $fastqFile)" "fastqc -j /sw/bin/java -o $outputDir -f fastq $fastqFile" -q medium  | joblist .fastqc_jobs
+    jl submit -j .fastqc_jobs -q medium -n "fastqc__$(basename $fastqFile)" "fastqc -j /sw/bin/java -o $outputDir -f fastq $fastqFile"
 done
 
-
-wait4jobs .fastqc_jobs
-
+jl wait --report .fastqc_jobs
 
 rend.R ${NGS_TOOLS}/dge_workflow/fastqc_summary.R $outputDir
 
@@ -122,15 +119,13 @@ for fastqFile in $* ; do
     echo "cutadapting $caFastq into $caFastq"
 
     #todo use a more specific trimming model (trim just correct part on each side without using reverse complements
-    mysub "${project}__ca__$(basename $fastqFile .fastq.gz)" "cutadapt -b file:$Ill_ADAPTERS -m 20 -q 25 -o $caFastq $fastqFile"  -q long  | joblist .cajobs
+    jl submit -j .cajobs -q long -n "${project}__ca__$(basename $fastqFile .fastq.gz)" "cutadapt -b file:$Ill_ADAPTERS -m 20 -q 25 -o $caFastq $fastqFile"
 done
 
-wait4jobs .cajobs
+jl wait --report --email .cajobs
 
 spin.R ${NGS_TOOLS}/dge_workflow/cutadapt_summary.R .
 
-
-
 ## todo do a small report here about what has been trimmed away and why
 
 }
@@ -188,16 +183,18 @@ for fastqFile in $fastqFiles ; do
 
     ## uniquely mapping reads only:   http:/seqanswers.com/forums/showthread.php?s=93da11109ae12a773a128a637d69defe&t=3464
     ###     tophat -p6  -G $gtfFile -g1 -o test $bowtie_gindex $fastqFile
-    mysub "${project}__tophat__${fastqBaseName}" "
+
+    tophatCmd="
     tophat -p6  -G $gtfFile -g1 -o $outputdir $bowtie_gindex $fastqFile
 
     mv $outputdir/accepted_hits.bam $outputdir/$(basename $outputdir).bam
     samtools index $outputdir/$(basename $outputdir).bam
-    " -n 5 -R span[hosts=1] -q medium | joblist .tophatjobs
-done
+    "
 
-wait4jobs .tophatjobs
+    jl submit -j .tophatjobs -t 5 -q medium -n "${project}__tophat__${fastqBaseName}" "${tophatCmd}"
+done
 
+jl wait --report .tophatjobs
 
 
 ## see https://github.com/fidelram/deepTools/wiki/QC#bamCorrelate
@@ -270,10 +267,11 @@ fi
 for bamFile in $bamFiles; do
     sample=$(basename $bamFile .bam)
     echo "converting $bamFile to bigwig format"
-    mysub "${project}__bw__${sample}" "genomeCoverageBed -split -bg -ibam $bamFile  -g ${genomeFai} |  wigToBigWig -clip stdin ${genomeFai} ${sample}.bw" -q short | joblist .bigwig
+
+    jl submit -j .bigwig -q short -n "${project}__bw__${sample}" "genomeCoverageBed -split -bg -ibam $bamFile  -g ${genomeFai} |  wigToBigWig -clip stdin ${genomeFai} ${sample}.bw"
 done
 
-wait4jobs .bigwig
+jl wait --report .bigwig
 
 }
 export -f dge_bigwig
@@ -404,7 +402,8 @@ echo $gtfFile $bamsSplit | tr "," " "  | xargs ls -la
 cdCmd="cuffdiff -L $labels -o . -p 10 $gtfFile $bamsSplit"
 echo "cuffdiff cmd is: $cdCmd"
 #eval $cdCmd
-mysub "${project}__cuffdiff" "$cdCmd"  -q long -n 4 -R span[hosts=1] | blockScript
+
+jl submit --wait -t 4 -q long -n "${project}__cuffdiff" "$cdCmd"
 
 
 ## create a cuffdiff db using cummerbund in a temporary directory to avoid locking problems
-- 
GitLab