fix: compare samplesheet enum values as strings in validator#396
Closed
JOhnsonKC201 wants to merge 1 commit into
Closed
fix: compare samplesheet enum values as strings in validator#396JOhnsonKC201 wants to merge 1 commit into
JOhnsonKC201 wants to merge 1 commit into
Conversation
CSV values are read as strings (e.g. "0") but enum allow-lists may be typed (e.g. integers [0, 1]), so the 'in' check rejected every valid sarek samplesheet. Normalize both sides to str before comparing.
Collaborator
|
Thanks for your interest! This repo only accepts contributions from Anthropic team members. If you'd like to submit a plugin to the marketplace, please submit your plugin here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
In
bio-research/skills/nextflow-development/scripts/utils/validators.py, the enum (allowed) check invalidate_samplesheetcompared raw CSV cell values against the configured allow-list with a plainin:CSV values are read as strings, but enum allow-lists in the pipeline configs can be typed. The sarek config (
scripts/config/pipelines/sarek.yaml) declares thestatuscolumn astype: integerwithallowed: [0, 1]. So the membership test"0" not in [0, 1]is alwaysTrue, and the validator rejected every valid sarek samplesheet with errors like:Fix
Normalize both sides to strings before comparing, so typed enums validate correctly while still rejecting genuinely invalid values:
Minimal, one-line behavioral change plus an explanatory comment.
Repro (manual — no test harness exists for these scripts)
Using a sarek-style integer enum column (
status: allowed [0, 1]) and a valid samplesheet (status="0"/"1"):valid: False—["Row 2: Invalid value '0' for 'status'. Allowed: [0, 1]", "Row 3: Invalid value '1' ..."]valid: True, no errorsNegative case still works: a genuinely invalid value
"2"is still rejected after the fix.python -m py_compileon the changed file passes.