diff --git a/main.nf b/main.nf index e883b9e..3727e82 100644 --- a/main.nf +++ b/main.nf @@ -29,11 +29,9 @@ if (!params.debug) { } // Adding the option to skip the alignment if skipAlignment is set to true. -(fastqPairs_ch, bamPairs_ch) = ( params.skipAlignment - ? [Channel.empty(), Channel.fromFilePairs( params.inputDir+'/'+params.inputPattern, checkIfExists: true ) ] - : [Channel.fromFilePairs( params.inputDir+'/'+params.inputPattern, size: 2, checkIfExists: true ), Channel.empty() ] ) - -bamPairs_ch.flatten().collate(3).set { newBamPairs_ch } +(fastqPairs_ch, bamPairs_ch) = (params.skipAlignment + ? [Channel.empty(), Channel.fromFilePairs(params.inputDir+'/'+params.inputPattern, size: 2, checkIfExists: true) ] + : [Channel.fromFilePairs(params.inputDir+'/'+params.inputPattern, size: 2, checkIfExists: true), Channel.empty() ] ) process ERValign { tag "${sample}" @@ -51,15 +49,13 @@ process ERValign { errorStrategy 'terminate' input: - tuple val(sample), path (reads) from fastqPairs_ch + tuple val (sample), path (reads) from fastqPairs_ch val (localOutputDir) from params.localOutputDir val (limitMemory) from params.limitMemory val (debug) from params.debug output: tuple sample, path ("${localOutputDir}/${sample}.Aligned.sortedByCoord.out.bam*") into star_bam_ch - // path ("${localOutputDir}/${sample}.Aligned.sortedByCoord.out.bam.bai") into star_bai_ch - // val (sample) into prefix_ch when: !params.skipAlignment @@ -67,34 +63,31 @@ process ERValign { shell: template 'ERValign.sh' } -star_bam_ch.subscribe{ println "File: ${it.name} => ${it.text}" } -// process ERVcount { -// tag "${sample}" +process ERVcount { + tag "${sample}" -// // executor configuration -// time '3h' -// memory '8.GB' -// scratch true -// storeDir params.outputDir + // executor configuration + time '3h' + memory '8.GB' + scratch true + storeDir params.outputDir -// // other configuration -// echo true -// errorStrategy 'terminate' -// stageInMode 'symlink' + // other configuration + echo true + errorStrategy 'terminate' + stageInMode 'symlink' -// input: -// tuple val(sample), path (bam), path (bai) from newBamPairs_ch -// val (debug) from params.debug -// // path (bam) from bam_ch.mix(star_bam_ch) // mixing with the channel from ERValign if started from FASTQs and skipAlignment=false -// // path (bai) from bai_ch.mix(star_bai_ch) // mixing with the channel from ERValign if started from FASTQs and skipAlignment=false + input: + tuple val (sample), path (bam) from bamPairs_ch.mix(star_bam_ch) // mixing with the channel from ERValign if started from FASTQs and skipAlignment=false + val (debug) from params.debug -// output: -// path ("${sample}"+'.ERVresults.txt') into final_results_ch + output: + path ("${sample}"+'.ERVresults.txt') into final_results_ch -// shell: -// template 'ERVcount.sh' -// } + shell: + template 'ERVcount.sh' +} // ~~~~~~~~~~~~~~~ PIPELINE COMPLETION EVENTS ~~~~~~~~~~~~~~~~~~~ // diff --git a/templates/ERVcount.sh b/templates/ERVcount.sh index 38a33b8..098d385 100644 --- a/templates/ERVcount.sh +++ b/templates/ERVcount.sh @@ -1,6 +1,6 @@ #!/bin/bash -BAM="!{bam}" +BAM="!{bam[0]}" _DEBUG="!{debug}" logMsg() {