From 92096435391380a2ebfe2d877816a501eedfc221 Mon Sep 17 00:00:00 2001
From: Venkat Malladi <venkat.malladi@utsouthwestern.edu>
Date: Sat, 5 Jan 2019 07:35:53 -0600
Subject: [PATCH] Change order of process. Made diffPeaks a when opperative.

---
 workflow/main.nf | 53 ++++++++++++++++++++----------------------------
 1 file changed, 22 insertions(+), 31 deletions(-)

diff --git a/workflow/main.nf b/workflow/main.nf
index 7e421c7..4d32304 100644
--- a/workflow/main.nf
+++ b/workflow/main.nf
@@ -387,9 +387,6 @@ process consensusPeaks {
 
 }
 
-// Define channel to find number of unique experiments
-noUniqueExperiments = uniqueExperiments.splitCsv(sep: '\t', header: true).toList()
-
 // Annotate Peaks
 process peakAnnotation {
 
@@ -411,57 +408,51 @@ process peakAnnotation {
 
 }
 
-
-// Calculate Differential Binding Activity
-process diffPeaks {
+// Motif Search  Peaks
+process motifSearch {
 
   publishDir "$baseDir/output/${task.process}", mode: 'copy'
 
   input:
 
-  file designDiffPeaks
+  file designMotifSearch
 
   output:
 
-  file '*_diffbind.bed' into diffPeaks
-  file '*_diffbind.csv' into diffPeaksCounts
-  file '*.pdf' into diffPeaksStats
-  file 'normcount_peaksets.txt' into normCountPeaks
+  file "*memechip" into motifSearch
 
   script:
-  if (noUniqueExperiments.size() == 1) {
-    """
-    touch no_diffbind.bed
-    touch no_diffbind.csv
-    touch no_heatmap.pdf
-    touch no_pca.pdf
-    touch normcount_peaksets.txt
-    """
-  }
-  else {
-    """
-    Rscript $baseDir/scripts/diff_peaks.R $designDiffPeaks
-    """
-  }
 
+  """
+  python3 $baseDir/scripts/motif_search.py -d $designMotifSearch -g $fasta -p $topPeakCount
+  """
 }
 
-// Motif Search  Peaks
-process motifSearch {
+// Define channel to find number of unique experiments
+noUniqueExperiments = uniqueExperiments.splitCsv(sep: '\t', header: true).toList()
+
+// Calculate Differential Binding Activity
+process diffPeaks {
 
   publishDir "$baseDir/output/${task.process}", mode: 'copy'
 
   input:
 
-  file designMotifSearch
+  file designDiffPeaks
 
   output:
 
-  file "*memechip" into motifSearch
+  file '*_diffbind.bed' into diffPeaks
+  file '*_diffbind.csv' into diffPeaksCounts
+  file '*.pdf' into diffPeaksStats
+  file 'normcount_peaksets.txt' into normCountPeaks
+
+  when:
+  noUniqueExperiments.size() > 1
 
-  script:
 
+  script:
   """
-  python3 $baseDir/scripts/motif_search.py -d $designMotifSearch -g $fasta -p $topPeakCount
+  Rscript $baseDir/scripts/diff_peaks.R $designDiffPeaks
   """
 }
-- 
GitLab