2021-02-23 18:05:26 +00:00
|
|
|
process BCFTOOLS_MPILEUP {
|
|
|
|
tag "$meta.id"
|
2021-02-23 20:52:15 +00:00
|
|
|
label 'process_medium'
|
2021-02-23 18:05:26 +00:00
|
|
|
|
2021-07-28 08:10:44 +00:00
|
|
|
conda (params.enable_conda ? 'bioconda::bcftools=1.13' : null)
|
2021-11-26 07:58:40 +00:00
|
|
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
|
|
|
'https://depot.galaxyproject.org/singularity/bcftools:1.13--h3a49de5_0' :
|
|
|
|
'quay.io/biocontainers/bcftools:1.13--h3a49de5_0' }"
|
2021-02-23 18:05:26 +00:00
|
|
|
|
|
|
|
input:
|
|
|
|
tuple val(meta), path(bam)
|
|
|
|
path fasta
|
|
|
|
|
|
|
|
output:
|
|
|
|
tuple val(meta), path("*.gz") , emit: vcf
|
|
|
|
tuple val(meta), path("*.tbi") , emit: tbi
|
|
|
|
tuple val(meta), path("*stats.txt"), emit: stats
|
2021-10-01 13:04:56 +00:00
|
|
|
path "versions.yml" , emit: versions
|
2021-02-23 18:05:26 +00:00
|
|
|
|
|
|
|
script:
|
2021-11-26 07:58:40 +00:00
|
|
|
def args = task.ext.args ?: ''
|
|
|
|
def args2 = task.ext.args2 ?: ''
|
|
|
|
def args3 = task.ext.args3 ?: ''
|
|
|
|
def prefix = task.ext.suffix ? "${meta.id}${task.ext.suffix}" : "${meta.id}"
|
2021-02-23 18:05:26 +00:00
|
|
|
"""
|
|
|
|
echo "${meta.id}" > sample_name.list
|
2021-11-26 07:58:40 +00:00
|
|
|
|
2021-02-23 18:05:26 +00:00
|
|
|
bcftools mpileup \\
|
|
|
|
--fasta-ref $fasta \\
|
2021-11-26 07:58:40 +00:00
|
|
|
$args \\
|
2021-02-23 18:05:26 +00:00
|
|
|
$bam \\
|
2021-11-26 07:58:40 +00:00
|
|
|
| bcftools call --output-type v $args2 \\
|
2021-02-23 18:05:26 +00:00
|
|
|
| bcftools reheader --samples sample_name.list \\
|
2021-11-26 07:58:40 +00:00
|
|
|
| bcftools view --output-file ${prefix}.vcf.gz --output-type z $args3
|
|
|
|
|
2021-02-23 18:05:26 +00:00
|
|
|
tabix -p vcf -f ${prefix}.vcf.gz
|
2021-11-26 07:58:40 +00:00
|
|
|
|
2021-02-23 18:05:26 +00:00
|
|
|
bcftools stats ${prefix}.vcf.gz > ${prefix}.bcftools_stats.txt
|
2021-11-26 07:58:40 +00:00
|
|
|
|
2021-09-27 08:41:24 +00:00
|
|
|
cat <<-END_VERSIONS > versions.yml
|
2021-11-26 07:58:40 +00:00
|
|
|
"${task.process}":
|
|
|
|
bcftools: \$(bcftools --version 2>&1 | head -n1 | sed 's/^.*bcftools //; s/ .*\$//')
|
2021-09-27 08:41:24 +00:00
|
|
|
END_VERSIONS
|
2021-02-23 18:05:26 +00:00
|
|
|
"""
|
|
|
|
}
|