|
0
|
1 process SEQTK_SEQ {
|
|
|
2 tag "$meta.id"
|
|
|
3 label 'process_mem_low'
|
|
|
4
|
|
|
5 module (params.enable_module ? "${params.swmodulepath}${params.fs}seqtk${params.fs}1.3-r106" : null)
|
|
|
6 conda (params.enable_conda ? "bioconda::seqtk=1.3 conda-forge::gzip" : null)
|
|
|
7 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
|
|
|
8 'https://depot.galaxyproject.org/singularity/seqtk:1.3--h5bf99c6_3' :
|
|
|
9 'quay.io/biocontainers/seqtk:1.3--h5bf99c6_3' }"
|
|
|
10
|
|
|
11 input:
|
|
|
12 tuple val(meta), path(fastx)
|
|
|
13
|
|
|
14 output:
|
|
|
15 tuple val(meta), path("*.gz"), emit: fastx
|
|
|
16 path "versions.yml" , emit: versions
|
|
|
17
|
|
|
18 when:
|
|
|
19 task.ext.when == null || task.ext.when
|
|
|
20
|
|
|
21 script:
|
|
|
22 def args = task.ext.args ?: ''
|
|
|
23 def prefix = task.ext.prefix ?: "${meta.id}"
|
|
|
24
|
|
|
25 def extension = "fastq"
|
|
|
26 if ("$fastx" ==~ /.+\.fasta|.+\.fasta.gz|.+\.fa|.+\.fa.gz|.+\.fas|.+\.fas.gz|.+\.fna|.+\.fna.gz/ || "$args" ==~ /\-[aA]/ ) {
|
|
|
27 extension = "fasta"
|
|
|
28 }
|
|
|
29 """
|
|
|
30 seqtk \\
|
|
|
31 seq \\
|
|
|
32 $args \\
|
|
|
33 $fastx | \\
|
|
|
34 gzip -c > ${prefix}.seqtk-seq.${task.index}.${extension}.gz
|
|
|
35
|
|
|
36 cat <<-END_VERSIONS > versions.yml
|
|
|
37 "${task.process}":
|
|
|
38 seqtk: \$(echo \$(seqtk 2>&1) | sed 's/^.*Version: //; s/ .*\$//')
|
|
|
39 gzip: \$( echo \$(gzip --version 2>&1) | sed 's/^.*(gzip) //; s/gzip //; s/ Copyright.*\$//' )
|
|
|
40 END_VERSIONS
|
|
|
41 """
|
|
|
42 } |