2020-06-01 12:36:43 +00:00
|
|
|
#!/usr/bin/env nextflow
|
|
|
|
|
|
|
|
// Include NfUtils
|
2020-06-01 14:41:47 +00:00
|
|
|
params.classpath = "umi_tools/groovy/NfUtils.groovy"
|
2020-06-01 12:36:43 +00:00
|
|
|
Class groovyClass = new GroovyClassLoader(getClass().getClassLoader()).parseClass(new File(params.classpath));
|
|
|
|
GroovyObject nfUtils = (GroovyObject) groovyClass.newInstance();
|
|
|
|
|
|
|
|
// Define internal params
|
2020-06-01 14:41:47 +00:00
|
|
|
module_name = 'dedup'
|
2020-06-01 12:36:43 +00:00
|
|
|
|
|
|
|
// Specify DSL2
|
|
|
|
nextflow.preview.dsl = 2
|
|
|
|
|
|
|
|
// Local default params
|
2020-06-01 14:41:47 +00:00
|
|
|
params.internal_outdir = 'results'
|
|
|
|
params.internal_process_name = 'dedup'
|
2020-06-01 12:36:43 +00:00
|
|
|
|
|
|
|
// Check for internal parameter overrides
|
|
|
|
nfUtils.check_internal_overrides(module_name, params)
|
|
|
|
|
|
|
|
// dedup reusable component
|
2020-06-01 14:41:47 +00:00
|
|
|
process dedup {
|
|
|
|
publishDir "umi_tools/dedup/${params.internal_outdir}/${params.internal_process_name}",
|
2020-06-01 12:36:43 +00:00
|
|
|
mode: "copy", overwrite: true
|
|
|
|
|
|
|
|
input:
|
|
|
|
tuple val(sample_id), path(bai), path(bam)
|
|
|
|
|
|
|
|
output:
|
|
|
|
tuple val(sample_id), path(bam), emit: dedupBam
|
|
|
|
|
|
|
|
script:
|
|
|
|
"""
|
|
|
|
fileName=`basename $bam`
|
|
|
|
sampleName="\${fileName%.Aligned.sortedByCoord.out.bam}"
|
|
|
|
umi_tools dedup --umi-separator=":" -I $bam -S \${sampleName}.dedup.bam --output-stats=\${sampleName}
|
|
|
|
"""
|
|
|
|
}
|