11process DRAGMAP_ALIGN {
2- tag " $meta . id "
2+ tag " ${ meta.id} "
33 label ' process_high'
44
55 conda " ${ moduleDir} /environment.yml"
6- container " ${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
7- 'https://depot.galaxyproject.org/singularity/mulled-v2-580d344d9d4a496cd403932da8765f9e0187774d:7eed251370ac7f3537c3d9472cdb2f9f5d8da1c5-0':
8- 'biocontainers/mulled-v2-580d344d9d4a496cd403932da8765f9e0187774d:7eed251370ac7f3537c3d9472cdb2f9f5d8da1c5-0' } "
6+ // WARN: Do not update this tool to 1.3.0 until https://github.com/Illumina/DRAGMAP/issues/47 is resolved
7+ container " ${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container
8+ ? 'https://depot.galaxyproject.org/singularity/mulled-v2-580d344d9d4a496cd403932da8765f9e0187774d:df80ed8d23d0a2c43181a2b3dd1b39f2d00fab5c-0'
9+ : 'biocontainers/mulled-v2-580d344d9d4a496cd403932da8765f9e0187774d:df80ed8d23d0a2c43181a2b3dd1b39f2d00fab5c-0'} "
910
1011 input:
11- tuple val(meta) , path(reads)
12+ tuple val(meta), path(reads)
1213 tuple val(meta2), path(hashmap)
1314 tuple val(meta3), path(fasta)
14- val sort_bam
15+ val sort_bam
1516
1617 output:
17- tuple val(meta), path(" *.sam" ) , emit: sam , optional: true
18- tuple val(meta), path(" *.bam" ) , emit: bam , optional: true
19- tuple val(meta), path(" *.cram" ) , emit: cram , optional: true
20- tuple val(meta), path(" *.crai" ) , emit: crai , optional: true
21- tuple val(meta), path(" *.csi" ) , emit: csi , optional: true
22- tuple val(meta), path(' *.log' ) , emit: log
23- path " versions.yml" , emit: versions
18+ tuple val(meta), path(" *.sam" ), emit: sam, optional: true
19+ tuple val(meta), path(" *.bam" ), emit: bam, optional: true
20+ tuple val(meta), path(" *.cram" ), emit: cram, optional: true
21+ tuple val(meta), path(" *.crai" ), emit: crai, optional: true
22+ tuple val(meta), path(" *.csi" ), emit: csi, optional: true
23+ tuple val(meta), path(' *.log' ), emit: log
24+ path " versions.yml" , emit: versions
2425
2526 when:
2627 task. ext. when == null || task. ext. when
@@ -29,22 +30,24 @@ process DRAGMAP_ALIGN {
2930 def args = task. ext. args ?: ' '
3031 def args2 = task. ext. args2 ?: ' '
3132 def prefix = task. ext. prefix ?: " ${ meta.id} "
32- def reads_command = meta. single_end ? " -1 $reads " : " -1 ${ reads[0]} -2 ${ reads[1]} "
33- def samtools_command = sort_bam ? ' sort' : ' view'
34- def extension_pattern = / (-- output- fmt|- O)+ \s+ (\S+ )/
35- def extension_matcher = (args2 =~ extension_pattern)
36- def extension = extension_matcher. getCount() > 0 ? extension_matcher[0 ][2 ]. toLowerCase() : " bam"
37- def reference = fasta && extension== " cram" ? " --reference ${ fasta} " : " "
38- if (! fasta && extension== " cram" ) error " Fasta reference is required for CRAM output"
33+ def reads_command = meta. single_end ? " -1 ${ reads} " : " -1 ${ reads[0]} -2 ${ reads[1]} "
34+ def samtools_command = sort_bam ? ' sort' : ' view'
35+ def extension_pattern = / (-- output- fmt|- O)+ \s+ (\S+ )/
36+ def extension_matcher = (args2 =~ extension_pattern)
37+ def extension = extension_matcher. getCount() > 0 ? extension_matcher[0 ][2 ]. toLowerCase() : " bam"
38+ def reference = fasta && extension == " cram" ? " --reference ${ fasta} " : " "
39+ if (! fasta && extension == " cram" ) {
40+ error(" Fasta reference is required for CRAM output" )
41+ }
3942
4043 """
4144 dragen-os \\
42- -r $hashmap \\
43- $args \\
44- --num-threads $task . cpus \\
45- $reads_command \\
45+ -r ${ hashmap} \\
46+ ${ args} \\
47+ --num-threads ${ task.cpus} \\
48+ ${ reads_command} \\
4649 2> >(tee ${ prefix} .dragmap.log >&2) \\
47- | samtools $samtools_command $ args2 --threads $task . cpus ${ reference} -o ${ prefix} .${ extension} -
50+ | samtools ${ samtools_command} ${ args2} --threads ${ task.cpus} ${ reference} -o ${ prefix} .${ extension} -
4851
4952 cat <<-END_VERSIONS > versions.yml
5053 "${ task.process} ":
@@ -58,14 +61,17 @@ process DRAGMAP_ALIGN {
5861 def args2 = task. ext. args2 ?: ' '
5962 def prefix = task. ext. prefix ?: " ${ meta.id} "
6063 def extension_pattern = / (-- output- fmt|- O)+ \s+ (\S+ )/
61- def extension_matcher = (args2 =~ extension_pattern)
64+ def extension_matcher = (args2 =~ extension_pattern)
6265 def extension = extension_matcher. getCount() > 0 ? extension_matcher[0 ][2 ]. toLowerCase() : " bam"
63- if (! fasta && extension== " cram" ) error " Fasta reference is required for CRAM output"
66+ if (! fasta && extension == " cram" ) {
67+ error(" Fasta reference is required for CRAM output" )
68+ }
6469
6570 def create_index = " "
6671 if (extension == " cram" ) {
6772 create_index = " touch ${ prefix} .crai"
68- } else if (extension == " bam" ) {
73+ }
74+ else if (extension == " bam" ) {
6975 create_index = " touch ${ prefix} .csi"
7076 }
7177
0 commit comments