From 283613159e079152f1336cef0db1c836086206e0 Mon Sep 17 00:00:00 2001 From: Daniel Straub <42973691+d4straub@users.noreply.github.com> Date: Mon, 14 Oct 2024 11:47:35 +0200 Subject: [PATCH] Update MaxBin2: allow multiple abund files (#6776) * allow multiple abund files * Apply suggestions from code review Co-authored-by: James A. Fellows Yates * Update modules/nf-core/maxbin2/main.nf Co-authored-by: James A. Fellows Yates --------- Co-authored-by: James A. Fellows Yates --- modules/nf-core/maxbin2/main.nf | 12 +++++++++++- modules/nf-core/maxbin2/meta.yml | 15 +++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/modules/nf-core/maxbin2/main.nf b/modules/nf-core/maxbin2/main.nf index 9b7a0fd41c2..845c8e4ed91 100644 --- a/modules/nf-core/maxbin2/main.nf +++ b/modules/nf-core/maxbin2/main.nf @@ -13,6 +13,7 @@ process MAXBIN2 { output: tuple val(meta), path("*.fasta.gz") , emit: binned_fastas tuple val(meta), path("*.summary") , emit: summary + tuple val(meta), path("*.abundance") , emit: abundance , optional: true tuple val(meta), path("*.log.gz") , emit: log tuple val(meta), path("*.marker.gz") , emit: marker_counts tuple val(meta), path("*.noclass.gz") , emit: unbinned_fasta @@ -27,7 +28,16 @@ process MAXBIN2 { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def associate_files = reads ? "-reads $reads" : "-abund $abund" + if (reads && abund) { error("ERROR: MaxBin2 can only accept one of `reads` or `abund`, no both. Check input.") } + def associate_files = "" + if ( reads ) { + associate_files = "-reads $reads" + } else if ( abund instanceof List ) { + associate_files = "-abund ${abund[0]}" + for (i in 2..abund.size()) { associate_files += " -abund$i ${abund[i-1]}" } + } else { + associate_files = "-abund $abund" + } """ mkdir input/ && mv $contigs input/ run_MaxBin.pl \\ diff --git a/modules/nf-core/maxbin2/meta.yml b/modules/nf-core/maxbin2/meta.yml index 538ba07f3fd..9546afb1aaa 100644 --- a/modules/nf-core/maxbin2/meta.yml +++ b/modules/nf-core/maxbin2/meta.yml @@ -35,8 +35,8 @@ input: supply at the same time as abundance files. pattern: "*.fasta" - abund: - type: file - description: Contig abundance files, i.e. reads against each contig. See MaxBin2 + type: list + description: One or more contig abundance files, i.e. average depth of reads against each contig. See MaxBin2 README for details. Do not supply at the same time as read files. output: - binned_fastas: @@ -60,6 +60,17 @@ output: description: Summary file describing which contigs are being classified into which bin pattern: "*.summary" + - abundance: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.abundance": + type: file + description: Abundance of each bin if multiple abundance files were supplied + which bin + pattern: "*.abundance" - log: - meta: type: map