diff --git a/workflow/main.nf b/workflow/main.nf index 7e421c76fee7161c720c89e6f5737d7e1c1997a9..4d32304900c0d5700f734068ac446261c19f764c 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 """ }