Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MaxBin2 abundance input #690

Merged
merged 10 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- [#674](https://github.com/nf-core/mag/pull/674) - Make longread preprocessing a subworkflow (added by @muabnezor)
- [#674](https://github.com/nf-core/mag/pull/674) - Add porechop and filtlong logs to multiqc (added by @muabnezor)
- [#674](https://github.com/nf-core/mag/pull/674) - Change local filtlong module to the official nf-core/filtlong module (added by @muabnezor)
- [#690](https://github.com/nf-core/mag/pull/690) - MaxBin2 is using the abundance information from different samples now as expected (reported by @uel3 and fixed by @d4straub)
jfy133 marked this conversation as resolved.
Show resolved Hide resolved

### `Dependencies`

Expand Down
5 changes: 5 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,11 @@ process {
path: { "${params.outdir}/GenomeBinning/MaxBin2/discarded" },
mode: params.publish_dir_mode,
pattern: '*.tooshort.gz'
],
[
path: { "${params.outdir}/GenomeBinning/MaxBin2/" },
mode: params.publish_dir_mode,
pattern: '*.{summary,abundance}'
]
]
ext.prefix = { "${meta.assembler}-MaxBin2-${meta.id}" }
Expand Down
2 changes: 1 addition & 1 deletion modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
},
"maxbin2": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"git_sha": "283613159e079152f1336cef0db1c836086206e0",
"installed_by": ["modules"]
},
"metabat2/jgisummarizebamcontigdepths": {
Expand Down
19 changes: 16 additions & 3 deletions modules/local/convert_depths.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,27 @@ process CONVERT_DEPTHS {

output:
// need to add empty val because representing reads as we dont want maxbin to calculate for us.
tuple val(meta), path(fasta), val([]), path("*_mb2_depth.txt"), emit: output
path "versions.yml" , emit: versions
tuple val(meta), path(fasta), val([]), path("*.abund"), emit: output
path "versions.yml" , emit: versions

script:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
gunzip -f $depth
bioawk -t '{ { if (NR > 1) { { print \$1, \$3 } } } }' ${depth.toString() - '.gz'} > ${prefix}_mb2_depth.txt

# Determine the number of abundance columns
n_abund=\$(awk 'NR==1 {print int((NF-3)/2)}' ${depth.toString() - '.gz'})

# Get column names
read -r header<${depth.toString() - '.gz'}
header=(\$header)

# Generate abundance files for each read set
for i in \$(seq 1 \$n_abund); do
col=\$((i*2+2))
name=\$( echo \${header[\$col-1]} | sed s/\\.bam\$// )
bioawk -t '{if (NR > 1) {print \$1, \$'"\$col"'}}' ${depth.toString() - '.gz'} > \${name}.abund
done

cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
5 changes: 5 additions & 0 deletions modules/nf-core/maxbin2/environment.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions modules/nf-core/maxbin2/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

166 changes: 115 additions & 51 deletions modules/nf-core/maxbin2/meta.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions modules/nf-core/maxbin2/tests/main.nf.test

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions modules/nf-core/maxbin2/tests/main.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading