Skip to content

Commit

Permalink
Update MaxBin2: allow multiple abund files (#6776)
Browse files Browse the repository at this point in the history
* allow multiple abund files

* Apply suggestions from code review

Co-authored-by: James A. Fellows Yates <[email protected]>

* Update modules/nf-core/maxbin2/main.nf

Co-authored-by: James A. Fellows Yates <[email protected]>

---------

Co-authored-by: James A. Fellows Yates <[email protected]>
  • Loading branch information
d4straub and jfy133 authored Oct 14, 2024
1 parent 7fd374e commit 2836131
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
12 changes: 11 additions & 1 deletion modules/nf-core/maxbin2/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \\
Expand Down
15 changes: 13 additions & 2 deletions modules/nf-core/maxbin2/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 2836131

Please sign in to comment.