Skip to content

Refactor optitype module to be more resilient to configuration issues - #229

Draft
SpikyClip wants to merge 10 commits into
nf-core:devfrom
SpikyClip:fix_optitype_mod
Draft

Refactor optitype module to be more resilient to configuration issues#229
SpikyClip wants to merge 10 commits into
nf-core:devfrom
SpikyClip:fix_optitype_mod

Conversation

@SpikyClip

Copy link
Copy Markdown
Contributor

I encountered an issue with the latest dev branch where moving --${meta.seq_type} from the module itself to modules.config's ext.args caused issues if you had pre-existing configs (in my case, ext.args = "--enumerate 3") that overrided the defaults, causing the seq type to not get supplied to optitype.

Fairly simple to solve without changing the source code but I figured that it was a good opportunity to refactor the module to be more resilient to configuration type issues. I took some inspiration from the ControlFREEC module which handles it quite elegantly by using a named list of parameters which removes a bit of friction from the user regarding the argument syntax, and also embeds sensible default fallbacks within the module itself, so the user doesn't have to supply every arg if they only need to override one.

I also fixed two issues:

  • the supply of threads to the cbc solver (which I believe can use them?) with a fallback to 1 thread if glpk is selected (single-threaded)
  • linking the beta parameter to the module via ext.args

Style-wise, I thought it would be clearer to prefix the optitype args now that multiple callers are present, and I removed the solver argument from the tests to deduplicate unnecessary code.

I've also added a test for the solver in nextflow_schema.json to allow only two valid options (If I'm not wrong, cplex is not installed in the container so it is not a working solver input in this case?).

I'm keen to here your feedback, and am happy to make any necessary changes.

- Expose optitype config args as named inputs via ext.args2 so user doesn't have to be concerned about key syntax
- Embed sensible defaults into module as fallback rather than relying on pipeline module args. This means if user only overrides 1 arg, the pipeline won't fail.
- Allow solver to use multiple threads if glpk is not used
- Extract seq_type independently of args, in my opinion there should be no reason for user to be able to override seq type in configs as it is already supplied by the samplesheet. This was the case in the prior version.
…style changes in schema and nextflow.config; test solver type.

fix: beta parameter was not previously supplied to optitype module, leading to silent errors
style: prefix optitype parameters now that pipeline has multiple hlatyping tools
style: minor wording changes in schema.json
test: test that solver parameter falls into only two valid options (cplex not bundled in optitype image?)
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Warning

Newer version of the nf-core template is available.

Your pipeline is using an old version of the nf-core template: 4.0.3.
Please update your pipeline to the latest version.

For more documentation on how to update your pipeline, please see the Synchronisation documentation.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

nf-core pipelines lint overall result: Failed ❌

Posted for pipeline commit 59cebad

+| ✅ 255 tests passed       |+
#| ❔   5 tests were ignored |#
-| ❌   2 tests failed       |-
Details

❌ Test failures:

  • container_configs - conf/containers_conda_lock_files_amd64.config is out of date – please regenerate the container configuration files.
  • container_configs - conf/containers_conda_lock_files_arm64.config is out of date – please regenerate the container configuration files.

❔ Tests ignored:

✅ Tests passed:

Run details

  • nf-core/tools version 4.0.3
  • Run at 2026-08-20 01:17:12

@SpikyClip
SpikyClip requested a review from jonasscheid August 5, 2026 23:28
@SpikyClip
SpikyClip marked this pull request as ready for review August 5, 2026 23:28

@jonasscheid jonasscheid left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for contributing! Sounds reasonable to expose more params here. Please make sure to add a changelog entry since the existing cli params were renamed. Also the new optitype version 1.5 landed on bioconda, would you be interested in updating the nf-core module?

Comment thread nextflow_schema.json
Comment thread conf/modules.config
@SpikyClip

Copy link
Copy Markdown
Contributor Author

Am waiting on approval for this module PR so that I can pull that into this branch. The only tests that are failing are non deterministic md5 hash issues from other modules so I am not sure how to get around it or if it can be manually approved.

@jonasscheid

Copy link
Copy Markdown
Contributor

Can you request a review in nf-core slack, I am not available until start of sept

@github-actions

Copy link
Copy Markdown

❌ nf-test failed with latest Nextflow version

Note

Tests with Nextflow's latest version failed but it will not cause a CI workflow failure.
Please check if the failure is expected with newer (edge-)releases of Nextflow or if it needs fixing.

  • docker | latest-everything | Shard 3/7

See the full run for details.

@jonasscheid

Copy link
Copy Markdown
Contributor

I just had a bit of time to review your optitype pr, could you implement these changes in a new PR?

@SpikyClip
SpikyClip marked this pull request as draft August 19, 2026 23:10
@SpikyClip

Copy link
Copy Markdown
Contributor Author

Lint error in nf-core pipelines lint --fix container_configs caused by this issue as experienced by others.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants