Skip to content

Commit

Permalink
Merge pull request #463 from nf-core/master-to-dev
Browse files Browse the repository at this point in the history
Pull in recent patch release changes from master into dev
  • Loading branch information
jfy133 authored Jul 4, 2023
2 parents 36aa11b + 6da700a commit 0906f13
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 20 deletions.
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v2.3.1dev - [date]
## 2.4.0dev - [date]

### `Added`

Expand Down Expand Up @@ -39,6 +39,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
| BCFtools | 1.16 | 1.17 |
| SAMtools | 1.16.1 | 1.17 |

## v2.3.2 - [2023-06-23]

### `Fixed`

- [#461](https://github.com/nf-core/mag/pull/461) - Fix full-size AWS test profile paths (by @jfy133)
- [#461](https://github.com/nf-core/mag/pull/461) - Fix pyDamage results being overwritten (reported by @alexhbnr, fix by @jfy133)

## v2.3.1 - [2023-06-19]

### `Fixed`

- [#458](https://github.com/nf-core/mag/pull/458) - Correct the major issue in ancient DNA workflow of binning refinement being performed on uncorrected contigs instead of aDNA consensus recalled contigs (issue [#449](https://github.com/nf-core/mag/issues/449))
- [#451](https://github.com/nf-core/mag/pull/451) - Fix results file overwriting in Ancient DNA workflow (reported by @alexhbnr, fix by @jfy133, and integrated by @maxibor in [#458](https://github.com/nf-core/mag/pull/458) )

## v2.3.0 - [2023/03/02]

### `Added`
Expand Down
6 changes: 3 additions & 3 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,8 @@ process {
}

withName: BCFTOOLS_VIEW {
ext.args = "-v snps,mnps -i 'QUAL>=${params.bcftools_view_high_variant_quality} || (QUAL>=${params.bcftools_view_medium_variant_quality} && FORMAT/AO>=${params.bcftools_view_minimal_allelesupport})'"
ext.prefix = { "${meta.assembler}-${meta.id}.filtered" }
ext.args = "-v snps,mnps -i 'QUAL>=${params.bcftools_view_high_variant_quality} || (QUAL>=${params.bcftools_view_medium_variant_quality} && FORMAT/AO>=${params.bcftools_view_minimal_allelesupport})'"
publishDir = [
path: { "${params.outdir}/Ancient_DNA/variant_calling/filtered" },
mode: params.publish_dir_mode,
Expand Down Expand Up @@ -524,7 +524,7 @@ process {
withName: PYDAMAGE_ANALYZE {
ext.prefix = { "${meta.assembler}-${meta.id}" }
publishDir = [
path: {"${params.outdir}/Ancient_DNA/pydamage/analyze/${meta.assembler}-${meta.id}" },
path: {"${params.outdir}/Ancient_DNA/pydamage/analyze/${meta.assembler}-${meta.id}/" },
mode: params.publish_dir_mode
]
}
Expand All @@ -533,7 +533,7 @@ process {
ext.prefix = { "${meta.assembler}-${meta.id}" }
ext.args = "-t ${params.pydamage_accuracy}"
publishDir = [
path: {"${params.outdir}/Ancient_DNA/pydamage/filter/${meta.assembler}-${meta.id}" },
path: {"${params.outdir}/Ancient_DNA/pydamage/filter/${meta.assembler}-${meta.id}/" },
mode: params.publish_dir_mode
]
}
Expand Down
3 changes: 3 additions & 0 deletions lib/WorkflowMag.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ class WorkflowMag {
if (params.coassemble_group && params.binning_map_mode == 'own') {
Nextflow.error("Invalid combination of parameter '--binning_map_mode own' and parameter '--coassemble_group'. Select either 'all' or 'group' mapping mode when performing group-wise co-assembly.")
}
if (params.ancient_dna && params.binning_map_mode != 'own') {
Nextflow.error("Invalid combination of parameter '--binning_map_mode' and parameter '--ancient_dna'. Ancient DNA mode can only be executed with --binning_map_mode own. You supplied: --binning_map_mode ${params.binning_map_mode}")
}

// Check if specified cpus for SPAdes are available
if ( params.spades_fix_cpus > params.max_cpus ) {
Expand Down
4 changes: 2 additions & 2 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ params {
// ancient DNA assembly validation options
ancient_dna = false
pydamage_accuracy = 0.5
skip_ancient_damagecorrection = false
skip_ancient_damagecorrection = false
freebayes_ploidy = 1
freebayes_min_basequality = 20
freebayes_minallelefreq = 0.33
Expand Down Expand Up @@ -348,7 +348,7 @@ manifest {
description = """Assembly, binning and annotation of metagenomes"""
mainScript = 'main.nf'
nextflowVersion = '!>=22.10.1'
version = '2.3.1dev'
version = '2.4.0dev'
doi = '10.1093/nargab/lqac007'
}

Expand Down
1 change: 1 addition & 0 deletions subworkflows/local/binning_preparation.nf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ workflow BINNING_PREPARATION {
.map { group, assembly_meta, assembly, index, reads_meta, reads -> [ assembly_meta, assembly, index, reads_meta, reads ] }

} else {
// i.e. --binning_map_mode 'own'
// combine assemblies (not co-assembled) with reads from own sample
ch_reads_bowtie2 = reads.map{ meta, reads -> [ meta.id, meta, reads ] }
ch_bowtie2_input = BOWTIE2_ASSEMBLY_BUILD.out.assembly_index
Expand Down
18 changes: 7 additions & 11 deletions subworkflows/local/binning_refinement.nf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ include { RENAME_POSTDASTOOL } from

workflow BINNING_REFINEMENT {
take:
contigs
ch_contigs_for_dastool // channel: [ val(meta), path(contigs) ]
bins // channel: [ val(meta), path(bins) ]

main:
Expand All @@ -25,19 +25,15 @@ workflow BINNING_REFINEMENT {
// everything here is either unclassified or a prokaryote
ch_bins = bins
.map { meta, bins ->
meta_new = meta.clone()
meta_new.remove('domain')
def meta_new = meta - meta.subMap('domain')
[meta_new, bins]
}
.groupTuple()
.map {
meta, bins -> [meta, bins.flatten()]
}

// Drop unnecessary files
ch_contigs_for_dastool = contigs
.map {
meta, assembly, bams, bais ->
def meta_new = meta.clone()
[ meta_new, assembly ]
}

// prepare bins
ch_bins_for_fastatocontig2bin = RENAME_PREDASTOOL(ch_bins).renamed_bins
.branch {
metabat2: it[0]['binner'] == 'MetaBAT2'
Expand Down
24 changes: 21 additions & 3 deletions workflows/mag.nf
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,8 @@ workflow MAG {

if (!params.skip_binning){

if (params.ancient_dna && params.run_ancient_damagecorrection) {
// Make sure if running aDNA subworkflow to use the damage-corrected contigs for higher accuracy
if (params.ancient_dna && !params.skip_ancient_damagecorrection) {
BINNING (
BINNING_PREPARATION.out.grouped_mappings
.join(ANCIENT_DNA_ASSEMBLY_VALIDATION.out.contigs_recalled)
Expand All @@ -656,10 +657,20 @@ workflow MAG {
}

if ( params.bin_domain_classification ) {
DOMAIN_CLASSIFICATION ( ch_assemblies, BINNING.out.bins, BINNING.out.unbinned )

// Make sure if running aDNA subworkflow to use the damage-corrected contigs for higher accuracy
if (params.ancient_dna && !params.skip_ancient_damagecorrection) {
ch_assemblies_for_domainclassification = ANCIENT_DNA_ASSEMBLY_VALIDATION.out.contigs_recalled
} else {
ch_assemblies_for_domainclassification = ch_assemblies
}

DOMAIN_CLASSIFICATION ( ch_assemblies_for_domainclassification, BINNING.out.bins, BINNING.out.unbinned )
ch_binning_results_bins = DOMAIN_CLASSIFICATION.out.classified_bins
ch_binning_results_unbins = DOMAIN_CLASSIFICATION.out.classified_unbins
ch_versions = ch_versions.mix(DOMAIN_CLASSIFICATION.out.versions)


} else {
ch_binning_results_bins = BINNING.out.bins
.map { meta, bins ->
Expand Down Expand Up @@ -694,7 +705,14 @@ workflow MAG {
meta.domain == "eukarya"
}

BINNING_REFINEMENT ( BINNING_PREPARATION.out.grouped_mappings, ch_prokarya_bins_dastool )
if (params.ancient_dna) {
ch_contigs_for_binrefinement = ANCIENT_DNA_ASSEMBLY_VALIDATION.out.contigs_recalled
} else {
ch_contigs_for_binrefinement = BINNING_PREPARATION.out.grouped_mappings
.map{ meta, contigs, bam, bai -> [ meta, contigs ] }
}

BINNING_REFINEMENT ( ch_contigs_for_binrefinement, ch_prokarya_bins_dastool )

ch_refined_bins = ch_eukarya_bins_dastool.mix(BINNING_REFINEMENT.out.refined_bins)
ch_refined_unbins = BINNING_REFINEMENT.out.refined_unbins
Expand Down

0 comments on commit 0906f13

Please sign in to comment.