2021-11-03 10:22:06 +00:00
|
|
|
process FREEBAYES {
|
2021-10-20 13:19:31 +00:00
|
|
|
tag "$meta.id"
|
|
|
|
label 'process_low'
|
|
|
|
|
|
|
|
conda (params.enable_conda ? "bioconda::freebayes=1.3.5" : null)
|
2021-11-26 07:58:40 +00:00
|
|
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
|
|
|
'https://depot.galaxyproject.org/singularity/freebayes:1.3.5--py38ha193a2f_3' :
|
|
|
|
'quay.io/biocontainers/freebayes:1.3.5--py38ha193a2f_3' }"
|
2021-10-20 13:19:31 +00:00
|
|
|
|
|
|
|
input:
|
2022-02-10 09:34:22 +00:00
|
|
|
tuple val(meta), path(input_1), path(input_1_index), path(input_2), path(input_2_index), path(target_bed)
|
2021-10-29 15:05:06 +00:00
|
|
|
path fasta
|
2021-11-26 07:58:40 +00:00
|
|
|
path fasta_fai
|
2021-10-29 15:05:06 +00:00
|
|
|
path samples
|
|
|
|
path populations
|
|
|
|
path cnv
|
2021-10-20 13:19:31 +00:00
|
|
|
|
|
|
|
output:
|
2021-11-26 07:58:40 +00:00
|
|
|
tuple val(meta), path("*.vcf.gz"), emit: vcf
|
|
|
|
path "versions.yml" , emit: versions
|
2021-10-20 13:19:31 +00:00
|
|
|
|
2022-02-04 08:53:32 +00:00
|
|
|
when:
|
|
|
|
task.ext.when == null || task.ext.when
|
|
|
|
|
2021-10-20 13:19:31 +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-11-03 10:22:06 +00:00
|
|
|
def input = input_2 ? "${input_1} ${input_2}" : "${input_1}"
|
2022-02-10 09:34:22 +00:00
|
|
|
def targets_file = target_bed ? "--target ${target_bed}" : ""
|
2021-10-29 15:05:06 +00:00
|
|
|
def samples_file = samples ? "--samples ${samples}" : ""
|
|
|
|
def populations_file = populations ? "--populations ${populations}" : ""
|
|
|
|
def cnv_file = cnv ? "--cnv-map ${cnv}" : ""
|
|
|
|
|
2021-10-20 13:19:31 +00:00
|
|
|
if (task.cpus > 1) {
|
|
|
|
"""
|
|
|
|
freebayes-parallel \\
|
2021-11-26 07:58:40 +00:00
|
|
|
<(fasta_generate_regions.py $fasta_fai 10000) $task.cpus \\
|
2021-10-20 13:19:31 +00:00
|
|
|
-f $fasta \\
|
|
|
|
$targets_file \\
|
|
|
|
$samples_file \\
|
|
|
|
$populations_file \\
|
|
|
|
$cnv_file \\
|
2021-11-26 07:58:40 +00:00
|
|
|
$args \\
|
2021-11-03 10:22:06 +00:00
|
|
|
$input > ${prefix}.vcf
|
2021-10-20 13:19:31 +00:00
|
|
|
|
2022-01-31 09:11:39 +00:00
|
|
|
bgzip ${prefix}.vcf
|
2021-10-20 13:19:31 +00:00
|
|
|
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
2021-11-26 07:58:40 +00:00
|
|
|
"${task.process}":
|
|
|
|
freebayes: \$(echo \$(freebayes --version 2>&1) | sed 's/version:\s*v//g' )
|
2021-10-20 13:19:31 +00:00
|
|
|
END_VERSIONS
|
|
|
|
"""
|
|
|
|
|
|
|
|
} else {
|
|
|
|
"""
|
|
|
|
freebayes \\
|
|
|
|
-f $fasta \\
|
|
|
|
$targets_file \\
|
|
|
|
$samples_file \\
|
|
|
|
$populations_file \\
|
|
|
|
$cnv_file \\
|
2021-11-26 07:58:40 +00:00
|
|
|
$args \\
|
2021-10-29 15:05:06 +00:00
|
|
|
$input > ${prefix}.vcf
|
2021-10-20 13:19:31 +00:00
|
|
|
|
2022-01-31 09:11:39 +00:00
|
|
|
bgzip ${prefix}.vcf
|
2021-10-20 13:19:31 +00:00
|
|
|
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
2021-11-26 07:58:40 +00:00
|
|
|
"${task.process}":
|
|
|
|
freebayes: \$(echo \$(freebayes --version 2>&1) | sed 's/version:\s*v//g' )
|
2021-10-20 13:19:31 +00:00
|
|
|
END_VERSIONS
|
|
|
|
"""
|
|
|
|
}
|
|
|
|
}
|