From be8528998134132c6f4823f627bbb0aec6a51747 Mon Sep 17 00:00:00 2001 From: "James A. Fellows Yates" Date: Thu, 9 Dec 2021 15:00:32 +0100 Subject: [PATCH] Update metabat2 output channels and compression (#1111) * feat: each output type has dedicated channel replace bgzip with gzip can only zip one at a time * Add condition moving of unbinned files * fix: solution for moving sometimes non-existant files * fix: update meta.yml to add the new channels * fix: remove most of the checksums due to variability * fix: tweaking of output * Update modules/metabat2/metabat2/main.nf Co-authored-by: Maxime Borry * Fix find commands * Fix find commands Co-authored-by: Maxime Borry --- modules/metabat2/metabat2/main.nf | 15 ++++++++++----- modules/metabat2/metabat2/meta.yml | 13 +++++++++++++ tests/modules/metabat2/metabat2/test.yml | 15 ++++++++------- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/modules/metabat2/metabat2/main.nf b/modules/metabat2/metabat2/main.nf index 2d01fdf6..a8af0ae9 100644 --- a/modules/metabat2/metabat2/main.nf +++ b/modules/metabat2/metabat2/main.nf @@ -11,9 +11,12 @@ process METABAT2_METABAT2 { tuple val(meta), path(fasta), path(depth) output: - tuple val(meta), path("bins/*.fa.gz") , optional:true , emit: fasta - tuple val(meta), path("*.tsv.gz"), optional:true , emit: membership - path "versions.yml" , emit: versions + tuple val(meta), path("*.tooShort.fa.gz") , optional:true , emit: tooshort + tuple val(meta), path("*.lowDepth.fa.gz") , optional:true , emit: lowdepth + tuple val(meta), path("*.unbinned.fa.gz") , optional:true , emit: unbinned + tuple val(meta), path("*.tsv.gz") , optional:true , emit: membership + tuple val(meta), path("bins/*.fa.gz") , optional:true , emit: fasta + path "versions.yml" , emit: versions script: def args = task.ext.args ?: '' @@ -33,8 +36,10 @@ process METABAT2_METABAT2 { mv metabat2/${prefix} ${prefix}.tsv mv metabat2 bins - bgzip --threads $task.cpus ${prefix}.tsv - bgzip --threads $task.cpus bins/*.fa + + gzip ${prefix}.tsv + find ./bins/ -name "*.fa" -type f | xargs -t -n 1 bgzip -@ ${task.cpus} + find ./bins/ -name "*[lowDepth,tooShort,unbinned].fa.gz" -type f -exec mv {} . \\; cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/metabat2/metabat2/meta.yml b/modules/metabat2/metabat2/meta.yml index a7f3a7ff..0ec07b02 100644 --- a/modules/metabat2/metabat2/meta.yml +++ b/modules/metabat2/metabat2/meta.yml @@ -46,6 +46,18 @@ output: type: file description: Bins created from assembled contigs in fasta file pattern: "*.fa.gz" + - tooshort: + type: file + description: Contigs that did not pass length filtering + pattern: "*.tooShort.fa.gz" + - lowdepth: + type: file + description: Contigs that did not have sufficient depth for binning + pattern: "*.lowDepth.fa.gz" + - unbinned: + type: file + description: Contigs that pass length and depth filtering but could not be binned + pattern: "*.unbinned.fa.gz" - membership: type: file description: cluster memberships as a matrix format. @@ -54,3 +66,4 @@ output: authors: - "@maxibor" + - "@jfy133" diff --git a/tests/modules/metabat2/metabat2/test.yml b/tests/modules/metabat2/metabat2/test.yml index 1a8660a7..9389295e 100644 --- a/tests/modules/metabat2/metabat2/test.yml +++ b/tests/modules/metabat2/metabat2/test.yml @@ -1,23 +1,24 @@ - name: metabat2 metabat2 test_metabat2_no_depth - command: nextflow run ./tests/modules/metabat2/metabat2 -entry test_metabat2_no_depth -c ./tests/config/nextflow.config -c ./tests/modules/metabat2/metabat2/nextflow.config + command: nextflow run tests/modules/metabat2/metabat2 -entry test_metabat2_no_depth -c tests/config/nextflow.config tags: - - metabat2/metabat2 - metabat2 + - metabat2/metabat2 files: - path: output/metabat2/bins/test.1.fa.gz md5sum: 0e9bce5b5a0033fd4411a21dec881170 - path: output/metabat2/test.tsv.gz - md5sum: ea77e8c4426d2337419905b57f1ec335 + - path: output/metabat2/versions.yml + md5sum: 5742a71af36c3a748fd5726d76924ba8 - name: metabat2 metabat2 test_metabat2_depth - command: nextflow run ./tests/modules/metabat2/metabat2 -entry test_metabat2_depth -c ./tests/config/nextflow.config -c ./tests/modules/metabat2/metabat2/nextflow.config + command: nextflow run tests/modules/metabat2/metabat2 -entry test_metabat2_depth -c tests/config/nextflow.config tags: - - metabat2/metabat2 - metabat2 + - metabat2/metabat2 files: - path: output/metabat2/bins/test.1.fa.gz md5sum: 0e9bce5b5a0033fd4411a21dec881170 - path: output/metabat2/test.tsv.gz - md5sum: ea77e8c4426d2337419905b57f1ec335 - path: output/metabat2/test.txt.gz - md5sum: 8f735aa408d6c90e5a0310e06ace7a9a + - path: output/metabat2/versions.yml + md5sum: 538c56b2df7d90580f05097218b5d5b1