|
0
|
1 process MINIMAP2_ALIGN {
|
|
|
2 tag "$meta.id"
|
|
|
3 label 'process_micro'
|
|
|
4
|
|
|
5 module (params.enable_module ?
|
|
|
6 "${params.swmodulepath}${params.fs}minimap2${params.fs}2.22:${params.swmodulepath}${params.fs}samtools${params.fs}1.13" : null)
|
|
|
7 conda (params.enable_conda ? "bioconda::minimap2=2.24 bioconda::samtools=1.18 conda-forge::perl" : null)
|
|
|
8 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
|
|
9 'https://depot.galaxyproject.org/singularity/mulled-v2-66534bcbb7031a148b13e2ad42583020b9cd25c4:365b17b986c1a60c1b82c6066a9345f38317b763-0' :
|
|
|
10 'quay.io/biocontainers/mulled-v2-66534bcbb7031a148b13e2ad42583020b9cd25c4:365b17b986c1a60c1b82c6066a9345f38317b763-0' }"
|
|
|
11
|
|
|
12 input:
|
|
|
13 tuple val(meta), path(reads)
|
|
|
14 tuple val(meta2), path(reference)
|
|
|
15 val bam_format
|
|
|
16 val align_bam_sorted
|
|
|
17 val cigar_paf_format
|
|
|
18 val cigar_bam
|
|
|
19
|
|
|
20 output:
|
|
|
21 tuple val(meta), path("*.paf"), emit: paf, optional: true
|
|
|
22 tuple val(meta), path("*.bam"), emit: bam, optional: true
|
|
|
23 tuple val(meta), path("*.bai"), emit: bai, optional: true
|
|
|
24 path "versions.yml" , emit: versions
|
|
|
25
|
|
|
26 when:
|
|
|
27 task.ext.when == null || task.ext.when
|
|
|
28
|
|
|
29 script:
|
|
|
30 def args = task.ext.args ?: ''
|
|
|
31 def prefix = task.ext.prefix ?: "${meta.id}"
|
|
|
32 def bam_sort = align_bam_sorted ? "samtools sort | samtools view -@${task.cpus} -b -h -o ${prefix}.bam; samtools index -@${task.cpus} ${prefix}.bam" : "samtools view -@${task.cpus} -b -h -o ${prefix}.bam"
|
|
|
33 def bam_output = bam_format ? "-a | ${bam_sort}" : "-o ${prefix}.paf"
|
|
|
34 def cigar_paf = cigar_paf_format && !bam_format ? "-c" : ''
|
|
|
35 def set_cigar_bam = cigar_bam && bam_format ? "-L" : ''
|
|
|
36 """
|
|
|
37 minimap2 \\
|
|
|
38 $args \\
|
|
|
39 -t $task.cpus \\
|
|
|
40 "${reference ?: reads}" \\
|
|
|
41 "$reads" \\
|
|
|
42 $cigar_paf \\
|
|
|
43 $set_cigar_bam \\
|
|
|
44 $bam_output
|
|
|
45
|
|
|
46 cat <<-END_VERSIONS > versions.yml
|
|
|
47 "${task.process}":
|
|
|
48 minimap2: \$(minimap2 --version 2>&1)
|
|
|
49 samtools: \$(samtools version | head -n1 | sed -e 's/samtools //' 2>&1)
|
|
|
50 END_VERSIONS
|
|
|
51 """
|
|
|
52 } |