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