Skip to content

Commit

Permalink
Merge pull request #558 from nf-core/fix-cat-se-data-dev
Browse files Browse the repository at this point in the history
Fix malformed input to MEGAHIT with non-run-merged SEdata
  • Loading branch information
jfy133 authored Jan 26, 2024
2 parents 13212ab + ff0c4aa commit eb97cbd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 11 deletions.
8 changes: 4 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
"python.linting.flake8Path": "/opt/conda/bin/flake8",
"python.linting.pycodestylePath": "/opt/conda/bin/pycodestyle",
"python.linting.pydocstylePath": "/opt/conda/bin/pydocstyle",
"python.linting.pylintPath": "/opt/conda/bin/pylint"
"python.linting.pylintPath": "/opt/conda/bin/pylint",
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": ["ms-python.python", "ms-python.vscode-pylance", "nf-core.nf-core-extensionpack"]
}
}
"extensions": ["ms-python.python", "ms-python.vscode-pylance", "nf-core.nf-core-extensionpack"],
},
},
}
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### `Fixed`

- [#558](https://github.com/nf-core/mag/pull/558) - Fix bug in run merging when dealing with single end data (reported by @roberta-davidson, fix by @jfy133)

### `Dependencies`

### `Deprecated`
Expand Down
6 changes: 3 additions & 3 deletions subworkflows/local/ancient_dna.nf
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ workflow ANCIENT_DNA_ASSEMBLY_VALIDATION {
fasta: [ contigs ]
fai: [ fai ]
}
FREEBAYES ( freebayes_input.reads.dump(tag: 'reads'),
freebayes_input.fasta.dump(tag: 'fasta'),
freebayes_input.fai.dump(tag: 'fai'),
FREEBAYES ( freebayes_input.reads,
freebayes_input.fasta,
freebayes_input.fai,
[],
[],
[] )
Expand Down
16 changes: 12 additions & 4 deletions workflows/mag.nf
Original file line number Diff line number Diff line change
Expand Up @@ -350,15 +350,23 @@ workflow MAG {
.groupTuple()
.branch {
meta, reads ->
cat: ( meta.single_end && reads.size() == 1 ) || ( !meta.single_end && reads.size() >= 2 )
cat: reads.size() >= 2 // SE: [[meta], [S1_R1, S2_R1]]; PE: [[meta], [[S1_R1, S1_R2], [S2_R1, S2_R2]]]
skip_cat: true // Can skip merging if only single lanes
}

CAT_FASTQ ( ch_short_reads_forcat.cat.map { meta, reads -> [ meta, reads.flatten() ]} )

ch_short_reads = Channel.empty()
ch_short_reads = CAT_FASTQ.out.reads.mix( ch_short_reads_forcat.skip_cat ).map { meta, reads -> [ meta, reads.flatten() ]}
ch_versions = ch_versions.mix(CAT_FASTQ.out.versions.first())
// Ensure we don't have nests of nests so that structure is in form expected for assembly
ch_short_reads_catskipped = ch_short_reads_forcat.skip_cat
.map { meta, reads ->
def new_reads = meta.single_end ? reads[0] : reads.flatten()
[ meta, new_reads ]
}

// Combine single run and multi-run-merged data
ch_short_reads = Channel.empty()
ch_short_reads = CAT_FASTQ.out.reads.mix(ch_short_reads_catskipped)
ch_versions = ch_versions.mix(CAT_FASTQ.out.versions.first())

if ( params.bbnorm ) {
if ( params.coassemble_group ) {
Expand Down

0 comments on commit eb97cbd

Please sign in to comment.