From 8792bf4baca4c0e826aabb1306e1fb59ceff1919 Mon Sep 17 00:00:00 2001
From: "Gervaise H. Henry" <gervaise.henry@utsouthwestern.edu>
Date: Thu, 17 Dec 2020 10:27:38 -0600
Subject: [PATCH] Start changing model

---
 workflow/conf/replicate_export_config.json |  2 +-
 workflow/rna-seq.nf                        | 13 +++++++------
 workflow/scripts/bdbagFetch.sh             |  2 +-
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/workflow/conf/replicate_export_config.json b/workflow/conf/replicate_export_config.json
index ff17fa5..4380e46 100644
--- a/workflow/conf/replicate_export_config.json
+++ b/workflow/conf/replicate_export_config.json
@@ -1,6 +1,6 @@
 {
   "bag": {
-    "bag_name": "Replicate_{rid}",
+    "bag_name": "{rid}_inputBag",
     "bag_algorithms": [
       "md5"
     ],
diff --git a/workflow/rna-seq.nf b/workflow/rna-seq.nf
index 09d35d6..ccedc85 100644
--- a/workflow/rna-seq.nf
+++ b/workflow/rna-seq.nf
@@ -157,7 +157,7 @@ process getBag {
     path replicateExportConfig
 
   output:
-    path ("Replicate_*.zip") into bag
+    path ("*.zip") into bag
 
   when:
     inputBagForce == ""
@@ -222,7 +222,7 @@ process getData {
     echo -e "LOG: linked" >> ${repRID}.getData.log
 
     # get bag basename
-    replicate=\$(basename "${inputBag}" | cut -d "." -f1)
+    replicate=\$(basename "${inputBag}" | cut -d "_" -f1)
     echo -e "LOG: bag replicate name \${replicate}" >> ${repRID}.getData.log
 
     # unzip bag
@@ -1511,10 +1511,11 @@ process outputBag {
   hostname > ${repRID}.outputBag.log
   ulimit -a >> ${repRID}.outputBag.log
 
-  mkdir -p ./deriva/Seq/Workflow_Runs/${studyRID}/${executionRunRID}/
-  cp ${bam} ./deriva/Seq/Workflow_Runs/${studyRID}/${executionRunRID}/
-  cp ${bigwig} ./deriva/Seq/Workflow_Runs/${studyRID}/${executionRunRID}/
-  cp ${counts} ./deriva/Seq/Workflow_Runs/${studyRID}/${executionRunRID}/
+  mkdir -p ./deriva/Seq/pipeline/${studyRID}/${executionRunRID}/
+  cp ${bam} ./deriva/Seq/pipeline/${studyRID}/${executionRunRID}/
+  cp ${bai} ./deriva/Seq/pipeline/${studyRID}/${executionRunRID}/
+  cp ${bigwig} ./deriva/Seq/pipeline/${studyRID}/${executionRunRID}/
+  cp ${counts} ./deriva/Seq/pipeline/${studyRID}/${executionRunRID}/
 
   cookie=\$(cat credential.json | grep -A 1 '\\"${source}\\": {' | grep -o '\\"cookie\\": \\".*\\"')
   cookie=\${cookie:20:-1}
diff --git a/workflow/scripts/bdbagFetch.sh b/workflow/scripts/bdbagFetch.sh
index 606b883..1cab130 100644
--- a/workflow/scripts/bdbagFetch.sh
+++ b/workflow/scripts/bdbagFetch.sh
@@ -2,7 +2,7 @@
 
 if [ -z "${3}" ]
 then
-    bdbag --resolve-fetch all --fetch-filter filename\$*fastq.gz ${1}
+    bdbag --resolve-fetch all --fetch-filter filename\$*fastq.gz ${1}_inputBag
     for i in $(find */ -name "*R*.fastq.gz")
     do
         path=${2}.$(echo ${i##*/} | grep -o "R[1,2].fastq.gz")
-- 
GitLab