2021-03-23 11:13:07 +00:00
|
|
|
process SAMTOOLS_FASTQ {
|
|
|
|
tag "$meta.id"
|
|
|
|
label 'process_low'
|
|
|
|
|
2021-11-18 21:24:47 +00:00
|
|
|
conda (params.enable_conda ? "bioconda::samtools=1.14" : null)
|
2021-11-26 07:58:40 +00:00
|
|
|
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
|
|
|
'https://depot.galaxyproject.org/singularity/samtools:1.14--hb421002_0' :
|
|
|
|
'quay.io/biocontainers/samtools:1.14--hb421002_0' }"
|
2021-03-23 11:13:07 +00:00
|
|
|
|
|
|
|
input:
|
|
|
|
tuple val(meta), path(bam)
|
|
|
|
|
|
|
|
output:
|
2021-03-23 17:43:52 +00:00
|
|
|
tuple val(meta), path("*.fastq.gz"), emit: fastq
|
2021-11-18 21:24:47 +00:00
|
|
|
path "versions.yml" , emit: versions
|
2021-03-23 11:13:07 +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-03-23 17:43:52 +00:00
|
|
|
def endedness = meta.single_end ? "-0 ${prefix}.fastq.gz" : "-1 ${prefix}_1.fastq.gz -2 ${prefix}_2.fastq.gz"
|
|
|
|
|
2021-03-23 11:13:07 +00:00
|
|
|
"""
|
2021-03-23 17:43:52 +00:00
|
|
|
samtools fastq \\
|
2021-11-26 07:58:40 +00:00
|
|
|
$args \\
|
2021-11-18 21:24:47 +00:00
|
|
|
--threads ${task.cpus-1} \\
|
2021-03-23 17:43:52 +00:00
|
|
|
$endedness \\
|
|
|
|
$bam
|
2021-09-27 08:41:24 +00:00
|
|
|
cat <<-END_VERSIONS > versions.yml
|
2021-11-26 07:58:40 +00:00
|
|
|
"${task.process}":
|
|
|
|
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
|
2021-09-27 08:41:24 +00:00
|
|
|
END_VERSIONS
|
2021-03-23 11:13:07 +00:00
|
|
|
"""
|
|
|
|
}
|