annotate 0.4.0/modules/centrifuge/classify/main.nf @ 101:ce6d9548fe89

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