@@ -8,26 +8,49 @@ process SAMTOOLS_FIXMATE {
88 'biocontainers/samtools:1.21--h50ea8bc_0' } "
99
1010 input:
11- tuple val(meta), path(bam )
11+ tuple val(meta), path(input )
1212
1313 output:
14- tuple val(meta), path(" *.bam" ), emit: bam
15- path " versions.yml" , emit: versions
14+ tuple val(meta), path(" ${ prefix} .bam" ) , emit: bam , optional: true
15+ tuple val(meta), path(" ${ prefix} .cram" ), emit: cram, optional: true
16+ tuple val(meta), path(" ${ prefix} .sam" ) , emit: sam , optional: true
17+ path " versions.yml" , emit: versions
1618
1719 when:
1820 task. ext. when == null || task. ext. when
1921
2022 script:
2123 def args = task. ext. args ?: ' '
22- def prefix = task. ext. prefix ?: " ${ meta.id} "
23- if (" $bam " == " ${ prefix} .bam" ) error " Input and output names are the same, use \" task.ext.prefix\" to disambiguate!"
24+ prefix = task. ext. prefix ?: " ${ meta.id} _fixmate"
25+ def extension = args. contains(" --output-fmt sam" ) ? " sam" :
26+ args. contains(" --output-fmt bam" ) ? " bam" :
27+ args. contains(" --output-fmt cram" ) ? " cram" :
28+ " bam"
29+ if (" $input " == " ${ prefix} .${ extension} " ) error " Input and output names are the same, use \" task.ext.prefix\" to disambiguate!"
2430 """
2531 samtools \\
2632 fixmate \\
2733 $args \\
2834 --threads ${ task.cpus-1} \\
29- $bam \\
30- ${ prefix} .bam \\
35+ $input \\
36+ ${ prefix} .${ extension} \\
37+
38+ cat <<-END_VERSIONS > versions.yml
39+ "${ task.process} ":
40+ samtools: \$ (echo \$ (samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$ //')
41+ END_VERSIONS
42+ """
43+
44+ stub:
45+ def args = task. ext. args ?: ' '
46+ prefix = task. ext. prefix ?: " ${ meta.id} _fixmate"
47+ def extension = args. contains(" --output-fmt sam" ) ? " sam" :
48+ args. contains(" --output-fmt bam" ) ? " bam" :
49+ args. contains(" --output-fmt cram" ) ? " cram" :
50+ " bam"
51+ if (" $input " == " ${ prefix} .${ extension} " ) error " Input and output names are the same, use \" task.ext.prefix\" to disambiguate!"
52+ """
53+ touch ${ prefix} .${ extension}
3154
3255 cat <<-END_VERSIONS > versions.yml
3356 "${ task.process} ":
0 commit comments