2021-08-02 13:21:23 +00:00
|
|
|
process BWA_SAMSE {
|
|
|
|
tag "$meta.id"
|
|
|
|
label 'process_medium'
|
|
|
|
|
2022-02-28 22:13:11 +00:00
|
|
|
conda (params.enable_conda ? "bioconda::bwa=0.7.17 bioconda::samtools=1.15" : null)
|
2021-11-26 07:58:40 +00:00
|
|
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
2022-02-28 22:13:11 +00:00
|
|
|
'https://depot.galaxyproject.org/singularity/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:c56a3aabc8d64e52d5b9da1e8ecec2031668596d-0' :
|
|
|
|
'quay.io/biocontainers/mulled-v2-fe8faa35dbf6dc65a0f7f5d4ea12e31a79f73e40:c56a3aabc8d64e52d5b9da1e8ecec2031668596d-0' }"
|
2021-08-02 13:21:23 +00:00
|
|
|
|
|
|
|
input:
|
|
|
|
tuple val(meta), path(reads), path(sai)
|
|
|
|
path index
|
|
|
|
|
|
|
|
output:
|
|
|
|
tuple val(meta), path("*.bam"), emit: bam
|
2021-10-01 13:04:56 +00:00
|
|
|
path "versions.yml" , emit: versions
|
2021-08-02 13:21:23 +00:00
|
|
|
|
2022-02-04 08:53:32 +00:00
|
|
|
when:
|
|
|
|
task.ext.when == null || task.ext.when
|
|
|
|
|
2021-08-02 13:21:23 +00:00
|
|
|
script:
|
2021-11-26 07:58:40 +00:00
|
|
|
def args = task.ext.args ?: ''
|
2021-12-02 12:39:55 +00:00
|
|
|
def prefix = task.ext.prefix ?: "${meta.id}"
|
2021-08-02 13:21:23 +00:00
|
|
|
def read_group = meta.read_group ? "-r ${meta.read_group}" : ""
|
|
|
|
|
|
|
|
"""
|
|
|
|
INDEX=`find -L ./ -name "*.amb" | sed 's/.amb//'`
|
|
|
|
|
|
|
|
bwa samse \\
|
2021-11-26 07:58:40 +00:00
|
|
|
$args \\
|
2021-08-02 13:21:23 +00:00
|
|
|
$read_group \\
|
|
|
|
\$INDEX \\
|
|
|
|
$sai \\
|
|
|
|
$reads | samtools sort -@ ${task.cpus - 1} -O bam - > ${prefix}.bam
|
|
|
|
|
2021-09-27 08:41:24 +00:00
|
|
|
cat <<-END_VERSIONS > versions.yml
|
2021-11-26 07:58:40 +00:00
|
|
|
"${task.process}":
|
|
|
|
bwa: \$(echo \$(bwa 2>&1) | sed 's/^.*Version: //; s/Contact:.*\$//')
|
2021-09-28 13:37:47 +00:00
|
|
|
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
|
2021-09-27 08:41:24 +00:00
|
|
|
END_VERSIONS
|
2021-08-02 13:21:23 +00:00
|
|
|
"""
|
|
|
|
}
|