Skip to content

Commit

Permalink
updating channel structure
Browse files Browse the repository at this point in the history
  • Loading branch information
asboner committed Nov 21, 2020
1 parent e0488c8 commit e37abc2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 31 deletions.
53 changes: 23 additions & 30 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand All @@ -51,50 +49,45 @@ 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

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 ~~~~~~~~~~~~~~~~~~~ //

Expand Down
2 changes: 1 addition & 1 deletion templates/ERVcount.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

BAM="!{bam}"
BAM="!{bam[0]}"
_DEBUG="!{debug}"

logMsg() {
Expand Down

0 comments on commit e37abc2

Please sign in to comment.