comparison 0.4.2/modules/amrfinderplus/run/main.nf @ 130:04f6ac8ca13c

planemo upload
author kkonganti
date Wed, 03 Jul 2024 15:16:39 -0400
parents 52045ea4679d
children
comparison
equal deleted inserted replaced
129:1bb0dacefa6d 130:04f6ac8ca13c
1 process AMRFINDERPLUS_RUN {
2 tag "$meta.id"
3 label 'process_low'
4
5 module (params.enable_module ? "${params.swmodulepath}${params.fs}amrfinderplus${params.fs}3.10.24" : null)
6 conda (params.enable_conda ? "bioconda::ncbi-amrfinderplus=3.10.24 conda-forge::libgcc-ng" : null)
7 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
8 'https://depot.galaxyproject.org/singularity/ncbi-amrfinderplus%3A3.10.23--h17dc2d4_0':
9 'quay.io/biocontainers/ncbi-amrfinderplus:3.10.23--h17dc2d4_0' }"
10
11 input:
12 tuple val(meta), path(fasta)
13
14 output:
15 tuple val(meta), path("${prefix}.tsv") , emit: report
16 tuple val(meta), path("${prefix}-mutations.tsv"), emit: mutation_report, optional: true
17 path "versions.yml" , emit: versions
18
19 when:
20 (task.ext.when == null || task.ext.when) && fasta.size() > 0
21
22 script:
23 def args = task.ext.args ?: ''
24 def is_compressed = fasta.getName().endsWith(".gz") ? true : false
25 prefix = task.ext.prefix ?: "${meta.id}"
26 organism_param = meta.containsKey("organism") ? "--organism ${meta.organism} --mutation_all ${prefix}-mutations.tsv" : ""
27 fasta_name = fasta.getName().replace(".gz", "")
28 fasta_param = "-n"
29 if (meta.containsKey("is_proteins")) {
30 if (meta.is_proteins) {
31 fasta_param = "-p"
32 }
33 }
34 """
35 if [ "$is_compressed" == "true" ]; then
36 gzip -c -d $fasta > $fasta_name
37 fi
38
39 amrfinder \\
40 $fasta_param $fasta_name \\
41 $organism_param \\
42 $args \\
43 --threads $task.cpus > ${prefix}.tsv
44
45
46 cat <<-END_VERSIONS > versions.yml
47 "${task.process}":
48 amrfinderplus: \$(amrfinder --version)
49 gzip: \$( echo \$(gzip --version 2>&1) | sed 's/^.*(gzip) //; s/gzip //; s/ Copyright.*\$//' )
50 END_VERSIONS
51 """
52 }