From f3c034a75d73878e33a75765f4b887f02ea823af Mon Sep 17 00:00:00 2001
From: Venkat Malladi <venkat.malladi@utsouthwestern.edu>
Date: Tue, 3 Oct 2017 14:33:53 -0500
Subject: [PATCH] Add in trimming step into workflow.

---
 astrocyte_pkg.yml |  4 +++-
 workflow/main.nf  | 17 +++++++++++++----
 2 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/astrocyte_pkg.yml b/astrocyte_pkg.yml
index b812c4a..c7ff94f 100644
--- a/astrocyte_pkg.yml
+++ b/astrocyte_pkg.yml
@@ -40,6 +40,8 @@ documentation_files:
 # A list of cluster environment modules that this workflow requires to run.
 # Specify versioned module names to ensure reproducability.
 workflow_modules:
+  - 'python/3.6.1-2-anaconda'
+  - 'trimgalore/0.4.1'
   - 'fastqc/0.11.5'
   - 'deeptools/2.3.5'
   - 'meme/4.11.1-gcc-openmpi'
@@ -114,7 +116,7 @@ vizapp_cran_packages:
   - shiny
   - shinyFiles
 
-# List of any Bioconductor packages, not provided by the modules, 
+# List of any Bioconductor packages, not provided by the modules,
 # that must be made available to the vizapp
 vizapp_bioc_packages:
   - qusage
diff --git a/workflow/main.nf b/workflow/main.nf
index 7648445..6ee87c6 100644
--- a/workflow/main.nf
+++ b/workflow/main.nf
@@ -62,7 +62,7 @@ rawReads = designFilePaths
 process trimReads {
 
   tag "$sampleId-$replicate"
-  publishDir "$baseDir/output/{task.process}/$sampleId-$replicate$/", mode: 'copy'
+  publishDir "$baseDir/output/{task.process}/$sampleId-$replicate/", mode: 'copy'
 
   input:
 
@@ -71,10 +71,19 @@ process trimReads {
   output:
 
   set sampleId, file('*.fq.gz'), biosample, factor, treatment, replicate, controlId into trimmedReads
+  file '*trimming_report.txt' into trimgalore_results
 
   script:
 
-  """
-  python $baseDir/scripts/trim_reads.py -f $reads
-  """
+  if (pairedEnd) {
+    """
+    python $baseDir/scripts/trim_reads.py -f $reads -p
+    """
+  }
+  else {
+    """
+    python $baseDir/scripts/check_design.py -f $reads
+    """
+  }
+
 }
-- 
GitLab