|
0
|
1 process BWA_IDX_MEM {
|
|
|
2 tag "$meta.id"
|
|
|
3 label 'process_micro'
|
|
|
4
|
|
|
5 module (params.enable_module ? "${params.swmodulepath}${params.fs}bwa${params.fs}0.7.17" : null)
|
|
|
6 conda (params.enable_conda ? "bioconda::bwa=0.7.17 conda-forge::perl" : null)
|
|
|
7 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
|
|
8 'https://depot.galaxyproject.org/singularity/bwa:0.7.17--he4a0461_11' :
|
|
|
9 'quay.io/biocontainers/bwa:0.7.17--he4a0461_11' }"
|
|
|
10
|
|
|
11 input:
|
|
|
12 tuple val(meta), path(genome), path(reads)
|
|
|
13
|
|
|
14 output:
|
|
|
15 tuple val(meta), path("*.sam"), emit: aligned_sam
|
|
|
16 path "versions.yml" , emit: versions
|
|
|
17
|
|
|
18 when:
|
|
|
19
|
|
|
20
|
|
|
21 script:
|
|
|
22 def args = task.ext.args ?: ''
|
|
|
23 def args2 = task.ext.args2 ?: ''
|
|
|
24 def prefix = task.ext.prefix ?: "${meta.id}"
|
|
|
25 """
|
|
|
26
|
|
|
27 bwa index $args $genome
|
|
|
28 if [ "${params.fq_single_end}" = "false" ]; then
|
|
|
29 bwa mem \\
|
|
|
30 $args2 \\
|
|
|
31 -t $task.cpus \\
|
|
|
32 -a $genome \\
|
|
|
33 ${reads[0]} > ${prefix}.aligned_1.sam
|
|
|
34 bwa mem \\
|
|
|
35 $args2 \\
|
|
|
36 -t $task.cpus \\
|
|
|
37 -a $genome \\
|
|
|
38 ${reads[1]} > ${prefix}.aligned_2.sam
|
|
|
39 else
|
|
|
40 bwa mem \\
|
|
|
41 $args2 \\
|
|
|
42 -t $task.cpus \\
|
|
|
43 -a $genome \\
|
|
|
44 $reads > ${prefix}.aligned.sam
|
|
|
45
|
|
|
46 fi
|
|
|
47
|
|
|
48 cat <<-END_VERSIONS > versions.yml
|
|
|
49 "${task.process}":
|
|
|
50 bwa: \$(echo \$(bwa 2>&1) | sed 's/^.*Version: //; s/Contact:.*\$//')
|
|
|
51 END_VERSIONS
|
|
|
52 """
|
|
|
53 } |