Skip to content

Replace update_references_file with nf-schema param substitution - #164

Merged
maxulysse merged 4 commits into
devfrom
feat/basepath-substitution
Oct 23, 2026
Merged

maxulysse merged 4 commits into
devfrom
feat/basepath-substitution

Conversation

@maxulysse

@maxulysse maxulysse commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

PR checklist

  • This comment contains a description of changes (for why/what changed, see CONTRIBUTING.md)
  • Container version(s) are updated/rebuilt and pin changed software (if needed)
  • CHANGELOG.md is updated
  • nextflow_schema.json is updated (if needed)
  • docs/usage.md is updated (if needed)
  • docs/output.md is updated (if needed)
  • assets/ is updated (if needed)
  • Remove all TODO comments
  • Test this locally and/or on CI (particularly with GPU/singularity tests)
  • For modules: nf-core/modules PR along with basic tests on Linux, macOS and Windows
  • For pipelines: template update at nf-core/tools along with basic tests (stub run on all profiles)

Description

Implements the #101 basepath strategy decided in the roadmap: drop the whole-YAML string rewrite and use nf-schema 3.0.0's allowParamsSubstitution instead.

update_references_file staged a copy of the datasheet into workflow.workDir/tmp/<uuid> and rewrote a hardcoded ['s3://ngi-igenomes/igenomes/'] prefix list. nf-schema substitutes ${params.X} placeholders in datasheet values in memory during samplesheetToList, so datasheets can carry a base path instead of a hardcoded root. The function and its work-dir mutation are deleted.

references_base_path now has an unconditional default in nextflow.config. Without it, an undefined param resolves the placeholder to the literal string null/... with only a warning, and the run fails later at file(checkIfExists: true) with a confusing message. The default preserves the zero-config behaviour: datasheets without placeholders are unaffected.

Slash convention: the placeholder carries the leading slash and the param value does not, so ${params.references_base_path}/GRCh38_chr21 against the default s3://ngi-igenomes/igenomes resolves to s3://ngi-igenomes/igenomes/GRCh38_chr21. The join point stays visible in the datasheet and the param value stays clean. A trailing slash on the param would double up.

allowParamsSubstitution is a no-op on datasheets containing no placeholders, so this is backwards-compatible with the current published datasheets. Re-authoring references-datasheets to use placeholders is a separate cross-repo change and is not part of this PR.

nf-core-utils moves 0.4.0 to 0.5.0 in the same PR. It fixes dumpParametersToJSON(), which the utils subworkflow imports, and adds ReferenceSelection with igenomes_base substitution. The plugin is not template-managed, so this adds no template divergence.

Docs

  • docs/usage.md gains a --references_base_path section under Asset input: the placeholder form, the default and the path it resolves to, the slash rule, and the --input distinction. The broken ../assets/asset.yml link in that section now points at the nf-core/references-datasheets repository. The five other local links in the docs were audited and all resolve.
  • The description and help_text for references_base_path were rewritten. Both still described the prefix rewriting this PR removes, and help_text is what --help_full prints, so it was the most visible stale doc.

Why nextflow_schema.json changed

The input param declared "schema": "subworkflows/local/utils_references/schema_references.json", so validateParameters() deep-validated the datasheet contents before samplesheetToList ran. That path does not substitute, so the literal placeholder failed validation first. The key is removed: samplesheetToList validates against the same schema file after substitution.

Scope note

references_base_path here means substitution into the datasheet. Substitution to the datasheet (locating the datasheet file from a genome key) is a different job, used only by bamtofastq, and is renamed to references_datasheets_path in that pipeline. This PR does not touch that.

Testing

  • nextflow lint clean; the 23 warnings are pre-existing when-section deprecations in nf-core modules.
  • nf-test test tests/ --profile=+docker: 27/27 passing, including a new test.
  • New tests/basepath_substitution.nf.test runs --tools faidx against a datasheet carrying ${params.references_base_path} placeholders and snapshots its output in the same style as the rest of the suite. If substitution regresses, the literal placeholder reaches file(checkIfExists: true) and the run fails, so workflow.success is a real assertion.
  • nf-core pipelines lint: 366 passed, 0 failed, 21 pre-existing warnings.
  • Prettier passes on the changed markdown and JSON; the schema parses as valid JSON.

Follow-ups (not in this PR)

  • Re-author references-datasheets with placeholders. Blocked on bamtofastq renaming its param, else its URL default would be spliced into every file path.
  • A real datasheet may need more than one placeholder root: test.config's datasheet uses test-datasets/references/ for fasta/gff and test-datasets/modules/data/ for VCFs, which one param cannot span.

Generated by OpenCode

Drop the whole-YAML string rewrite that staged a copy into
workflow.workDir/tmp and rewrote a hardcoded igenomes prefix. nf-schema
3.0.0 substitutes ${params.X} placeholders in datasheet values at load
time, so datasheets can carry a base path instead of a hardcoded root.

Drop the 'schema' key from the input param: it deep-validated the
datasheet during validateParameters(), before substitution could run.
samplesheetToList validates against the same schema afterwards.

Generated by OpenCode
@github-actions

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.1.0.
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 Oct 22, 2026 •

Copy link
Copy Markdown

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

Posted for pipeline commit 05b6a7a

+| ✅ 219 tests passed       |+
#| ❔  12 tests were ignored |#
!| ❗   8 tests had warnings |!
Details

❗ Test warnings:

  • files_exist - File not found: .github/workflows/awsfulltest.yml
  • pipeline_todos - TODO string in main.nf: Optionally add in-text citation tools to this list.
  • pipeline_todos - TODO string in main.nf: Optionally add bibliographic entries to this list.
  • pipeline_todos - TODO string in main.nf: Only uncomment below if logic in toolCitationText/toolBibliographyText has been filled!
  • pipeline_todos - TODO string in methods_description_template.yml: #Update the HTML below to your preferred methods description, e.g. add publication citation for this pipeline
  • pipeline_todos - TODO string in base.config: Check the defaults for all processes
  • pipeline_todos - TODO string in usage.md: Add documentation about anything specific to running your pipeline. For general topics, please point to (and add to) the main nf-core website.
  • pipeline_todos - TODO string in output.md: Write this documentation describing your workflow's output

❔ Tests ignored:

✅ Tests passed:

Run details

  • nf-core/tools version 4.1.0
  • Run at 2026-10-23 08:00:46

new File(...).absolutePath was a workaround for an error actually
caused by a GString test name; projectDir resolves the same way and
reads as intent.

Generated by OpenCode
The placeholder now owns the leading slash, so the base path value
stays clean and the join point stays visible in the datasheet.

Add the --references_base_path section to usage.md, and rewrite the
schema description and help_text, which still described the prefix
rewriting removed by the substitution change.

Convert the substitution test to the snapshot style used elsewhere in
the suite.

Generated by OpenCode
Fixes dumpParametersToJSON, which the utils subworkflow imports, and
adds ReferenceSelection with igenomes_base substitution.

Generated by OpenCode
@nf-core nf-core deleted a comment from github-actions Bot Oct 23, 2026
@maxulysse
maxulysse merged commit 6d6d195 into dev Oct 23, 2026
20 checks passed
@maxulysse
maxulysse deleted the feat/basepath-substitution branch October 23, 2026 08:14
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.

1 participant