annotate 0.2.1/modules/centrifuge/classify/main.nf @ 34:4f9f145d1946

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