From 76102f6cfa0fa821dbc1a13eb4af624408caa500 Mon Sep 17 00:00:00 2001
From: s181706 <jonathan.gesell@utsouthwestern.edu>
Date: Mon, 6 Jan 2020 16:38:35 -0600
Subject: [PATCH] Added Hisat2 alignment step.  Also made files transferable
 via links.

---
 workflow/conf/biohpc.config |  4 ++--
 workflow/rna-seq.nf         | 33 ++++++++++++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/workflow/conf/biohpc.config b/workflow/conf/biohpc.config
index 732ddb8..bbf3fdb 100755
--- a/workflow/conf/biohpc.config
+++ b/workflow/conf/biohpc.config
@@ -5,10 +5,10 @@ process {
 
   // Process specific configuration
   withName:splitData {
-    container = 'docker://bicf/gudmaprbkfilexfer:1.1'
+    container = 'docker://bicf/gudmaprbkfilexfer:1.3'
   }
   withName:getData {
-    container = 'docker://bicf/gudmaprbkfilexfer:1.1'
+    container = 'docker://bicf/gudmaprbkfilexfer:1.3'
   }
   withName:trimData {
     container = 'docker://bicf/trimgalore:1.1'
diff --git a/workflow/rna-seq.nf b/workflow/rna-seq.nf
index df727d5..813c9d7 100755
--- a/workflow/rna-seq.nf
+++ b/workflow/rna-seq.nf
@@ -17,6 +17,29 @@ bdbag = Channel
 outDir = params.outDir
 logsDir = "${outDir}/Logs"
 
+/*
+ * Pass in programs from the scripts directory, and any default files for later
+ */
+
+
+/*
+ *Checking the species and spike-in status
+ */
+if (params.spikein) {
+  if (params.species == "human") {
+    reference = file ("/project/BICF/BICF_Core/s181706/github/gudmap/rna-seq/References/GRCh38.p12-S/hisat2")
+  } else if (params.species == "mouse") {
+    reference = file ("/project/BICF/BICF_Core/s181706/github/gudmap/rna-seq/References/GRCm38.P6-S/hisat2")
+  } 
+} else if (params.species == "mouse") {
+  reference = file ("/project/BICF/BICF_Core/s181706/github/gudmap/rna-seq/References/GRCm38.P6/hisat2")
+} else if (params.species == "human") {
+  reference = file ("/project/BICF/BICF_Core/s181706/github/gudmap/rna-seq/References/GRCh38.p12/hisat2")
+} else {
+  print ("Warning: Reference genome not specified, defaulting to GRCm38.P6 with NO spike-in")
+  reference = file ("/project/BICF/BICF_Core/s181706/github/gudmap/rna-seq/References/GRCm38.P6/hisat2")
+}
+
 /*
  * splitData: split bdbag files by replicate so fetch can occure in parallel, and rename files to replicate rid
  */
@@ -112,5 +135,13 @@ process alignReads {
 
   input:
     set repID, fqs from aligning
+    file reference
+
+  output:
+    set repID, file ("${repID}.aln.gz"), file ("${repID}.unal.gz"), file ("${repID}.sam")
 
-  
+  script:
+    """
+    hisat2 -p `nproc` --add-chrname --mm --al-gz ${repID}.aln.gz --un-gz ${repID}.unal.gz -S ${repID}.sam -x ${reference}/genome -1 ${fqs[0]} -2 ${fqs[1]}
+    """  
+}  
-- 
GitLab