Skip to content

Commit

Permalink
Merge branch 'CW-3239' into 'dev'
Browse files Browse the repository at this point in the history
fix medakaVariant using more CPU than allocated [CW-3239]

Closes CW-3239

See merge request epi2melabs/workflows/wf-amplicon!57
  • Loading branch information
julibeg committed Jan 2, 2024
2 parents fe92ff3 + ed8b152 commit 8314146
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [v1.0.2]
### Fixed
- Incorrect CPU use specification for the `medakaVariant` process.

## [v1.0.1]
### Changed
- Default for `--reads_downsampling_size` to 1500 to limit memory usage.
Expand Down
23 changes: 12 additions & 11 deletions lib/ingress.nf
Original file line number Diff line number Diff line change
Expand Up @@ -149,28 +149,24 @@ def xam_ingress(Map arguments)

def input = get_valid_inputs(margs, xam_extensions)

// check BAM headers to see if any samples are uBAM
ch_result = input.dirs
| map { meta, path -> [meta, get_target_files_in_dir(path, xam_extensions)] }
| mix(input.files)

ch_is_unaligned = ch_result
| checkBamHeaders
| map { meta, is_unaligned_env, mixed_headers_env ->
| map { meta, paths, is_unaligned_env, mixed_headers_env ->
// convert the env. variables from strings ('0' or '1') into bools
boolean is_unaligned = is_unaligned_env as int as boolean
boolean mixed_headers = mixed_headers_env as int as boolean
// throw an error if there was a sample with mixed headers
if (mixed_headers) {
error "Found mixed headers in (u)BAM files of sample '${meta.alias}'."
}
[meta, is_unaligned]
// add `is_unaligned` to the metamap (note the use of `+` to create a copy of
// `meta` to avoid modifying every item in the channel;
// https://github.com/nextflow-io/nextflow/issues/2660)
[meta + [is_unaligned: is_unaligned], paths]
}

ch_result = ch_result | join(ch_is_unaligned)
// add `is_unaligned` to the metamap (note the use of `+` to create a copy of `meta`
// to avoid modifying every item in the channel;
// https://github.com/nextflow-io/nextflow/issues/2660)
| map { meta, paths, is_unaligned -> [meta + [is_unaligned: is_unaligned], paths] }
| branch { meta, paths ->
// set `paths` to `null` for uBAM samples if unallowed (they will be added to
// the results channel in shape of `[meta, null]` at the end of the function
Expand Down Expand Up @@ -245,7 +241,12 @@ process checkBamHeaders {
output:
// set the two env variables by `eval`-ing the output of the python script
// checking the XAM headers
tuple val(meta), env(IS_UNALIGNED), env(MIXED_HEADERS)
tuple(
val(meta),
path("input_dir/reads*.bam", includeInputs: true),
env(IS_UNALIGNED),
env(MIXED_HEADERS),
)
script:
"""
workflow-glue check_bam_headers_in_dir input_dir > env.vars
Expand Down
2 changes: 1 addition & 1 deletion modules/local/variant-calling.nf
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ process medakaConsensus {

process medakaVariant {
label "medaka"
cpus 1
cpus 2
memory "8 GB"
input:
tuple val(meta),
Expand Down
2 changes: 1 addition & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ manifest {
description = 'Amplicon workflow'
mainScript = 'main.nf'
nextflowVersion = '>=23.04.2'
version = 'v1.0.1'
version = 'v1.0.2'
}

epi2melabs {
Expand Down

0 comments on commit 8314146

Please sign in to comment.