From 08c290989c45ef1c021fe59ba88de66a6f2ffe51 Mon Sep 17 00:00:00 2001
From: Holger Brandl <brandl@mpi-cbg.de>
Date: Thu, 23 Apr 2015 10:34:40 +0200
Subject: [PATCH] create local copy of spinnable script for better decoupling
 of analysis

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

diff --git a/dge_workflow/dge_utils.sh b/dge_workflow/dge_utils.sh
index 3c0c6dc..be190f0 100755
--- a/dge_workflow/dge_utils.sh
+++ b/dge_workflow/dge_utils.sh
@@ -298,8 +298,14 @@ fi
 
 bamsSplit=""
 for label in $(echo $labels | tr ", " " "); do
+    # DEBUG label="liver"; label="cyst"
     echo $label
-    labelBams=$(echo  "$allBams" | grep $label | xargs echo -n | tr ' ' ',')
+
+    ## grep the bam names excluding the path
+    echo  "$allBams" | xargs -n1 basename | grep $label > ${label}.cuff_bamlist
+    labelBams=$(echo "$allBams" | grep -Ff ${label}.cuff_bamlist | xargs echo -n | tr ' ' ',')
+    # echo "$allBams" | grep -Ff ${label}.bamlist | xargs -n1 echo
+
     bamsSplit+=$labelBams" "
 done
 #echo $bamsSplit
@@ -312,8 +318,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
+eval $cdCmd
+#mysub "${project}__cuffdiff" "$cdCmd"  -q long -n 4 -R span[hosts=1] | blockScript
 
 
 ## create a cuffdiff db using cummerbund in a temporary directory to avoid locking problems
@@ -324,7 +330,7 @@ cp -r . $tmpDbDir
 genome=$(echo $gtfFile | cut -f8 -d'/' | tr '[:upper:]' '[:lower:]'); echo "genome is $genome"
 
 ## make sure to use temp-r to avoid file locking problems
-export R_LIBS=/tmp/r_index
+#export R_LIBS=/tmp/r_index
 
 echo '
 require(cummeRbund)
@@ -333,7 +339,7 @@ gtfFile=commandArgs(T)[2]
 genome=commandArgs(T)[3]
 ## note without providing the gtf the db is much smaller
 readCufflinks(dir=dbDir, rebuild=T, gtf=gtfFile, genome=genome)
-' | R -q --no-save --no-restore --args $tmpDbDir $gtfFile $genome
+' | R -q --no-save --no-restore --args "$tmpDbDir" "$gtfFile" "$genome"
 
 if [ ! -f $tmpDbDir/cuffData.db ]; then
     >&2 echo "cummerbund failed to create cuffidff sqlite db"; return;
-- 
GitLab