nf-core_modules/modules/dastool/scaffolds2bin/main.nf
James A. Fellows Yates 240ee4328c
Dastool update to allow non-gzipped inputs (#1458)
* fix: remove left-over unnecessary code

* Make gzipping optional for DAS_Tool scaffolds2bin

* Add optional unzipping

* Make gunzip optional for DAS_Tool scaffolds2bin

* Apply suggestions from code review

Co-authored-by: Daniel Straub <42973691+d4straub@users.noreply.github.com>

* Update modules/dastool/scaffolds2bin/meta.yml

Co-authored-by: Daniel Straub <42973691+d4straub@users.noreply.github.com>
2022-03-28 16:29:46 +02:00

41 lines
1.3 KiB
Text

process DASTOOL_SCAFFOLDS2BIN {
tag "$meta.id"
label 'process_low'
conda (params.enable_conda ? "bioconda::das_tool=1.1.3" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/das_tool:1.1.3--r41hdfd78af_0' :
'quay.io/biocontainers/das_tool:1.1.3--r41hdfd78af_0' }"
input:
tuple val(meta), path(fasta)
val(extension)
output:
tuple val(meta), path("*.tsv"), emit: scaffolds2bin
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def file_extension = extension ? extension : "fasta"
def clean_fasta = fasta.toString() - ".gz"
def decompress_fasta = fasta.toString() == clean_fasta ? "" : "gunzip -q -f $fasta"
"""
$decompress_fasta
Fasta_to_Scaffolds2Bin.sh \\
$args \\
-i . \\
-e $file_extension \\
> ${prefix}.tsv
cat <<-END_VERSIONS > versions.yml
"${task.process}":
dastool: \$( DAS_Tool --version 2>&1 | grep "DAS Tool" | sed 's/DAS Tool version //' )
END_VERSIONS
"""
}