2020-06-18 15:54:14 +00:00
|
|
|
#!/usr/bin/env nextflow
|
|
|
|
|
|
|
|
// Specify DSL2
|
|
|
|
nextflow.preview.dsl = 2
|
|
|
|
|
|
|
|
// Local default params
|
|
|
|
params.internal_process_name = 'umitools_dedup'
|
|
|
|
|
|
|
|
// Process definition
|
|
|
|
process umitools_dedup {
|
|
|
|
publishDir "${params.outdir}/${params.internal_process_name}",
|
|
|
|
mode: "copy", overwrite: true
|
|
|
|
|
|
|
|
container 'luslab/nf-modules-umitools:latest'
|
|
|
|
|
|
|
|
input:
|
2020-06-26 07:22:43 +00:00
|
|
|
tuple val(sample_id), path(bai), path(bam)
|
2020-06-18 15:54:14 +00:00
|
|
|
|
|
|
|
output:
|
2020-06-26 07:22:43 +00:00
|
|
|
tuple val(sample_id), path("*.dedup.bam"), emit: dedupBam
|
|
|
|
path "*.dedup.log", emit: report
|
2020-06-18 15:54:14 +00:00
|
|
|
|
2020-06-26 07:19:54 +00:00
|
|
|
script:
|
2020-06-18 15:54:14 +00:00
|
|
|
|
|
|
|
// Init
|
2020-06-19 14:55:45 +00:00
|
|
|
internal_prog = "umi_tools dedup"
|
2020-06-23 08:34:47 +00:00
|
|
|
args = "--log=${sample_id}.dedup.log"
|
2020-06-18 15:54:14 +00:00
|
|
|
|
|
|
|
// Check main args string exists and strip whitespace
|
|
|
|
if(params.umitools_dedup_args) {
|
2020-06-19 14:55:45 +00:00
|
|
|
ext_args = params.umitools_dedup_args
|
|
|
|
internal_args += " " + ext_args.trim()
|
2020-06-18 15:54:14 +00:00
|
|
|
}
|
2020-06-19 14:55:45 +00:00
|
|
|
|
|
|
|
// Contruct CL line
|
2020-06-23 08:34:57 +00:00
|
|
|
command = "${internal_prog} ${internal_args} -I $bam -S ${sample_id}.dedup.bam --output-stats=${sample_id}"
|
2020-06-19 14:55:45 +00:00
|
|
|
|
|
|
|
// Log
|
|
|
|
if (params.verbose){
|
|
|
|
println ("[MODULE] umi_tools/dedup exec: " + internal_cl)
|
2020-06-18 15:54:14 +00:00
|
|
|
}
|
|
|
|
|
2020-06-19 07:21:55 +00:00
|
|
|
//SHELL
|
2020-06-18 15:54:14 +00:00
|
|
|
"""
|
2020-06-19 14:55:45 +00:00
|
|
|
${internal_cl}
|
2020-06-18 15:54:14 +00:00
|
|
|
"""
|
2020-06-23 08:34:47 +00:00
|
|
|
}
|