Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove hard coded key prefix for schema in launcher #3432

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

### General

- remove hard coded key prefix for schema in launcher ([#3432](https://github.com/nf-core/tools/pull/3432))
- output passed to write_params_file as Path object ([#3435](https://github.com/nf-core/tools/pull/3435))
- chore(deps): update python:3.12-slim docker digest to 69ce3ae ([#3433](https://github.com/nf-core/tools/pull/3433))
- chore(deps): update pre-commit hook astral-sh/ruff-pre-commit to v0.9.4 ([#3438](https://github.com/nf-core/tools/pull/3438))
Expand Down
16 changes: 13 additions & 3 deletions nf_core/pipelines/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,10 +406,20 @@ def prompt_schema(self):
"""Go through the pipeline schema and prompt user to change defaults"""
answers = {}
# Start with the subschema in the definitions - use order of allOf
definitions_schemas = self.schema_obj.schema.get("$defs", self.schema_obj.schema.get("definitions", {})).items()
defs_notation = self.schema_obj.defs_notation
log.debug(f"defs_notation: {defs_notation}")
definitions_schemas = self.schema_obj.schema.get(defs_notation, {})
for allOf in self.schema_obj.schema.get("allOf", []):
d_key = allOf["$ref"][14:]
answers.update(self.prompt_group(d_key, definitions_schemas[d_key]))
# Extract the key from the $ref by removing the prefix
ref_value = allOf["$ref"]
prefix = f"#/{defs_notation}/"
d_key = ref_value[len(prefix) :] if ref_value.startswith(prefix) else ref_value
log.debug(f"d_key: {d_key}")
try:
answers.update(self.prompt_group(d_key, definitions_schemas[d_key]))
except KeyError:
log.warning(f"Could not find definition for {d_key}")
continue

# Top level schema params
for param_id, param_obj in self.schema_obj.schema.get("properties", {}).items():
Expand Down
Loading