2020-06-18 15:54:14 +00:00
|
|
|
#!/usr/bin/env nextflow
|
|
|
|
|
|
|
|
// Define DSL2
|
|
|
|
nextflow.preview.dsl=2
|
|
|
|
|
|
|
|
// Log
|
2020-06-26 07:36:11 +00:00
|
|
|
log.info ("Starting tests for umi_tools dedup...")
|
2020-06-18 15:54:14 +00:00
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------------*/
|
|
|
|
/* Define params
|
|
|
|
--------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
params.umitools_dedup_args = '--umi-separator=":"'
|
|
|
|
params.verbose = true
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------------*/
|
|
|
|
/* Module inclusions
|
|
|
|
--------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
include umitools_dedup from '../main.nf'
|
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------------*/
|
|
|
|
/* Define input channels
|
|
|
|
--------------------------------------------------------------------------------------*/
|
|
|
|
|
2020-06-26 07:36:11 +00:00
|
|
|
// Define test data
|
|
|
|
testData = [
|
|
|
|
['sample1', "$baseDir/input/sample1.bam", "$baseDir/input/sample1.bai"],
|
|
|
|
['sample2', "$baseDir/input/sample2.bam", "$baseDir/input/sample2.bai"],
|
|
|
|
['sample3', "$baseDir/input/sample3.bam", "$baseDir/input/sample3.bai"],
|
|
|
|
['sample4', "$baseDir/input/sample4.bam", "$baseDir/input/sample4.bai"],
|
|
|
|
['sample5', "$baseDir/input/sample5.bam", "$baseDir/input/sample5.bai"],
|
|
|
|
['sample6', "$baseDir/input/sample6.bam", "$baseDir/input/sample6.bai"]
|
2020-06-18 15:54:14 +00:00
|
|
|
]
|
|
|
|
|
2020-06-26 07:36:11 +00:00
|
|
|
//Define test data input channel
|
2020-06-18 15:54:14 +00:00
|
|
|
Channel
|
2020-06-26 07:36:11 +00:00
|
|
|
.from(testData)
|
|
|
|
.map { row -> [ row[0], [file(row[1], checkIfExists: true), file(row[2], checkIfExists: true)]]}
|
|
|
|
.set {ch_bam}
|
2020-06-18 15:54:14 +00:00
|
|
|
|
|
|
|
/*------------------------------------------------------------------------------------*/
|
|
|
|
/* Run tests
|
|
|
|
--------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
workflow {
|
|
|
|
// Run dedup
|
2020-06-26 07:36:11 +00:00
|
|
|
umitools_dedup ( ch_bam )
|
2020-06-18 15:54:14 +00:00
|
|
|
|
|
|
|
// Collect file names and view output
|
|
|
|
umitools_dedup.out.dedupBam | view
|
2020-06-26 10:24:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
workflow.onComplete {
|
|
|
|
def proc = "$baseDir/verify-checksum.sh $baseDir/../../../results/umitools/dedup/*.bai $baseDir/output/*.bai".execute()
|
|
|
|
def b = new StringBuffer()
|
|
|
|
proc.consumeProcessErrorStream(b)
|
|
|
|
|
|
|
|
log.info proc.text
|
|
|
|
|
|
|
|
errorString = b.toString()
|
|
|
|
if(errorString != '')
|
|
|
|
log.error errorString
|
|
|
|
exit 1
|
2020-06-18 15:54:14 +00:00
|
|
|
}
|