annotate 0.3.0/modules/centrifuge/classify/main.nf @ 92:295c2597a475

"planemo upload"
author kkonganti
date Tue, 19 Jul 2022 10:07:24 -0400
parents
children
rev   line source
kkonganti@92 1 process CENTRIFUGE_CLASSIFY {
kkonganti@92 2 tag "$meta.id"
kkonganti@92 3 label 'process_medium'
kkonganti@92 4
kkonganti@92 5 module (params.enable_module ? 'centrifuge' : null)
kkonganti@92 6 conda (params.enable_conda ? "bioconda::centrifuge=1.0.4_beta" : null)
kkonganti@92 7 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
kkonganti@92 8 'https://depot.galaxyproject.org/singularity/centrifuge:1.0.4_beta--h9a82719_6' :
kkonganti@92 9 'quay.io/biocontainers/centrifuge:1.0.4_beta--h9a82719_6' }"
kkonganti@92 10
kkonganti@92 11 input:
kkonganti@92 12 tuple val(meta), path(reads)
kkonganti@92 13
kkonganti@92 14 output:
kkonganti@92 15 tuple val(meta), path('*.report.txt') , emit: report
kkonganti@92 16 tuple val(meta), path('*.output.txt') , emit: output
kkonganti@92 17 tuple val(meta), path('*.kreport.txt') , emit: kreport
kkonganti@92 18 tuple val(meta), path('*.sam') , optional: true, emit: sam
kkonganti@92 19 tuple val(meta), path('*.mapped.fastq{,.1,.2}.gz') , optional: true, emit: fastq_mapped
kkonganti@92 20 tuple val(meta), path('*.unmapped.fastq{,.1,.2}.gz') , optional: true, emit: fastq_unmapped
kkonganti@92 21 path "versions.yml" , emit: versions
kkonganti@92 22
kkonganti@92 23 when:
kkonganti@92 24 task.ext.when == null || task.ext.when
kkonganti@92 25
kkonganti@92 26 script:
kkonganti@92 27 def args = task.ext.args ?: ''
kkonganti@92 28 def prefix = task.ext.prefix ?: "${meta.id}"
kkonganti@92 29 def paired = meta.single_end ? "-U ${reads}" : "-1 ${reads[0]} -2 ${reads[1]}"
kkonganti@92 30 def db = meta.centrifuge_x ?: ''
kkonganti@92 31 def db_name = db.toString().replace(".tar.gz","")
kkonganti@92 32 def unaligned = ''
kkonganti@92 33 def aligned = ''
kkonganti@92 34 if (meta.single_end) {
kkonganti@92 35 unaligned = params.centrifuge_save_unaligned ? "--un-gz ${prefix}.unmapped.fastq.gz" : ''
kkonganti@92 36 aligned = params.centrifuge_save_aligned ? "--al-gz ${prefix}.mapped.fastq.gz" : ''
kkonganti@92 37 } else {
kkonganti@92 38 unaligned = params.centrifuge_save_unaligned ? "--un-conc-gz ${prefix}.unmapped.fastq.gz" : ''
kkonganti@92 39 aligned = params.centrifuge_save_aligned ? "--al-conc-gz ${prefix}.mapped.fastq.gz" : ''
kkonganti@92 40 }
kkonganti@92 41 def sam_output = params.centrifuge_out_fmt_sam ? "--out-fmt 'sam'" : ''
kkonganti@92 42 """
kkonganti@92 43 centrifuge \\
kkonganti@92 44 -x $db \\
kkonganti@92 45 -p $task.cpus \\
kkonganti@92 46 $paired \\
kkonganti@92 47 --report-file ${prefix}.centrifuge.report.txt \\
kkonganti@92 48 -S ${prefix}.centrifuge.output.txt \\
kkonganti@92 49 $unaligned \\
kkonganti@92 50 $aligned \\
kkonganti@92 51 $sam_output \\
kkonganti@92 52 $args
kkonganti@92 53
kkonganti@92 54 centrifuge-kreport -x $db_name ${prefix}.centrifuge.output.txt > ${prefix}.centrifuge.kreport.txt
kkonganti@92 55
kkonganti@92 56 cat <<-END_VERSIONS > versions.yml
kkonganti@92 57 "${task.process}":
kkonganti@92 58 centrifuge: \$( centrifuge --version | sed -n 1p | sed 's/^.*centrifuge-class version //')
kkonganti@92 59 END_VERSIONS
kkonganti@92 60 """
kkonganti@92 61 }