Skip to content

Adopt typed params for pipeline-specific parameters - #77

Merged
erikrikarddaniel merged 3 commits into
nf-core:devfrom
erikrikarddaniel:typed-params-74
Aug 28, 2026
Merged

Adopt typed params for pipeline-specific parameters#77
erikrikarddaniel merged 3 commits into
nf-core:devfrom
erikrikarddaniel:typed-params-74

Conversation

@erikrikarddaniel

Copy link
Copy Markdown
Member

PR checklist

  • This comment contains a description of changes (with reason).
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added a new tool - have you followed the pipeline conventions in the contribution docs
  • If necessary, also make a PR on the nf-core/phyloplace branch on the nf-core/test-datasets repository.
  • Make sure your code lints (nf-core pipelines lint).
  • Ensure the test suite passes (nextflow run . -profile test,docker --outdir <OUTDIR>).
  • Check for unexpected warnings in debug mode (nextflow run . -profile debug,test,docker --outdir <OUTDIR>).
  • Usage Documentation in docs/usage.md is updated.
  • Output Documentation in docs/output.md is updated.
  • CHANGELOG.md is updated.
  • README.md is updated (including new tool citations and authors/contributors).

Description

Closes #74.

Adopts Nextflow's typed params {} block for phyloplace's own pipeline-specific parameters, fixing the underlying bug: a boolean option can't be turned off from the command line with untyped params, since --save_domtblout false arrives as the truthy string 'false', not a coerced Boolean.

A few things worth knowing:

  • Typed params {} blocks are script-only syntax -- they can't live in nextflow.config. Params that nextflow.config itself reads directly at config-parse time (outdir, custom_config_base/custom_config_version, trace_report_suffix, monochrome_logs) stay declared there as before; everything else moved into a typed block at the top of main.nf. help also stays untyped, since its schema type is a boolean|string union (bare --help vs. --help <topic>) that doesn't map to a single Nextflow type.
  • This requires Nextflow >=26.04.0 (typed params don't compile on earlier versions), so the minimum version is bumped accordingly, along with the CI matrix and README badge. Also bumped nf-schema to the current latest, 2.8.0, while touching this.
  • nf-core/tools' nextflow_config and schema_params lint checks don't know about typed params yet and hard-fail against any schema param not also assigned in nextflow.config. Disabled both in .nf-core.yml, matching the same approach nf-core/ampliseq already uses on its dev branch for this exact transition (with the same TODO: Remove when tools supports parameter types note) -- their equivalent lint CI is green with this config, and there's no nf-core/tools issue yet tracking support for this.

Fixes boolean options (e.g. --save_domtblout false) not being turnable
off from the command line, since untyped params take the truthy string
"false" rather than a coerced Boolean. Params read directly within
nextflow.config itself (outdir, custom_config_base, trace_report_suffix,
monochrome_logs, etc.) can't use this syntax -- it's script-only -- and
stay declared there.

nf-core/tools' nextflow_config and schema_params lint checks don't yet
know about typed params and hard-fail against them, so those two checks
are disabled in .nf-core.yml, matching nf-core/ampliseq's own precedent
for this transition.

Raises the minimum Nextflow version to 26.04.0 (required for typed
params) and bumps nf-schema to 2.8.0.
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown

nf-core pipelines lint overall result: Passed ✅ ⚠️

Posted for pipeline commit ff6966f

+| ✅ 176 tests passed       |+
#| ❔  11 tests were ignored |#
!| ❗   1 tests had warnings |!
Details

❗ Test warnings:

❔ Tests ignored:

  • files_exist - File is ignored: conf/igenomes.config
  • files_exist - File is ignored: conf/igenomes_ignored.config
  • files_exist - File is ignored: .github/workflows/linting_comment.yml
  • nextflow_config - nextflow_config
  • files_unchanged - File ignored due to lint config: .gitattributes
  • files_unchanged - File ignored due to lint config: .github/workflows/branch.yml
  • files_unchanged - File ignored due to lint config: .github/workflows/linting.yml
  • files_unchanged - File ignored due to lint config: assets/nf-core-phyloplace_logo_light.png
  • files_unchanged - File ignored due to lint config: docs/images/nf-core-phyloplace_logo_light.png
  • files_unchanged - File ignored due to lint config: docs/images/nf-core-phyloplace_logo_dark.png
  • schema_params - schema_params

✅ Tests passed:

Run details

  • nf-core/tools version 4.1.0
  • Run at 2026-08-28 14:57:58

@erikrikarddaniel
erikrikarddaniel marked this pull request as ready for review August 27, 2026 10:41

@Joon-Klaps Joon-Klaps left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Don't want to approve yet as I'm not certain how critical the things are that I pinpointed.

Comment thread main.nf

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Was hesitant to review due to lack of experience on this. But given you posted twice.

Shouldn't these String? need to be Path? ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Tested it against real Nextflow (26.04.6): a Path?-typed param given an HTTPS URL fails with Input file '...' does not exist -- Nextflow resolves it as a local filesystem path rather than a remote URL. Since phyloplace's own test profiles pass file params as HTTPS URLs, Path? would break them, so String? is intentional here.

Comment thread nextflow.config
Comment on lines 15 to 16
outdir = null
publish_dir_mode = 'copy'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You can't add typed inputs here and in the other remaining ones of params scope in the config?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good push -- made us look again at what was actually still there and why.

Verified: a typed params { } block still hard-fails inside a .config file on current Nextflow (Unexpected input: '='), it's script-only syntax. That's why outdir, publish_dir_mode, custom_config_base/custom_config_version and trace_report_suffix stay here: they're all read directly by nextflow.config itself (or by conf/modules.config, included from it) at config-parse time, before main.nf -- where the typed block lives -- is even parsed. No restructuring moves those out. help stays for a separate reason: a boolean-or-string schema type with no single matching Nextflow type.

But your comment did make us re-check whether everything remaining here actually needed to stay, and it turned up a real one: monochrome_logs is a genuine Boolean that, apart from validation.monochromeLogs, isn't read at config-parse time at all, so it didn't need to be here. Moved it into the typed block (ff6966f), which fixes the exact same --foo false coercion bug for it too -- confirmed --monochrome_logs false was still evaluating truthy before that. Nothing else left in this params block is a Boolean, so there's nothing further to move.

Only nextflow.config's own validation.monochromeLogs assignment needs
it at config-parse time (undeclared params.* reads still work there);
every script-side use (main.nf's take: args, and the boilerplate
subworkflow's `if (monochrome_logs)` check) now gets a real coerced
Boolean, fixing the same CLI-string-coercion bug for this param that
PR nf-core#77 already fixed for the others.

Nothing else left in nextflow.config's untyped params block is a
Boolean, per review on nf-core#77.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dpvh3T7aVgU5XyjqcYQLQD
@erikrikarddaniel

Copy link
Copy Markdown
Member Author

Thanks @Joon-Klaps !

@erikrikarddaniel
erikrikarddaniel merged commit 0bb4ae3 into nf-core:dev Aug 28, 2026
23 checks passed
@erikrikarddaniel
erikrikarddaniel deleted the typed-params-74 branch August 28, 2026 17:10
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