Skip to content

Add config/rule drift checks for all semantic-type id lists#728

Open
gaurav wants to merge 4 commits into
mainfrom
add-config-expansion-rule-checks
Open

Add config/rule drift checks for all semantic-type id lists#728
gaurav wants to merge 4 commits into
mainfrom
add-config-expansion-rule-checks

Conversation

@gaurav

@gaurav gaurav commented Apr 22, 2026

Copy link
Copy Markdown
Collaborator

Adds a find_missing_id_prefixes() helper to src/snakefiles/util.py and
uses it in every semantic-type snakefile to verify that every prefix listed
in config.yaml's *_ids keys has a corresponding Snakemake rule producing
intermediate/<type>/ids/<prefix>. The check fires at DAG-construction time
(including --dry-run), so a config/rule mismatch is caught immediately
rather than part-way through a multi-hour pipeline run.

Snakefiles covered

  • anatomy.snakefileanatomy_ids
  • chemical.snakefilechemical_ids
  • diseasephenotype.snakefiledisease_ids
  • gene.snakefilegene_ids
  • genefamily.snakefilegenefamily_ids
  • process.snakefileprocess_ids
  • protein.snakefileprotein_ids
  • taxon.snakefiletaxon_ids

Changes

  • src/snakefiles/util.py: new find_missing_id_prefixes(workflow, ids_dir, config_list) — scans workflow.rules for concrete outputs under ids_dir and returns any prefixes from config_list not covered by any rule.
  • Each snakefile gets a 3-line block at the bottom that calls the helper and raises WorkflowError if anything is missing.

Raises WorkflowError at `snakemake --dry-run` if config.yaml protein_ids
lists a prefix with no rule producing intermediate/protein/ids/{prefix}.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gaurav
gaurav changed the base branch from master to add-pipeline-tests-for-shared-identifiers April 22, 2026 06:14
Base automatically changed from add-pipeline-tests-for-shared-identifiers to master April 27, 2026 05:56
@gaurav
gaurav marked this pull request as ready for review June 4, 2026 08:25
@gaurav
gaurav requested a review from Copilot June 4, 2026 08:25

Copilot AI 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.

Pull request overview

Adds a Snakemake-time validation to detect drift between config.yaml’s protein_ids list and the set of rules that actually generate intermediate_directory/protein/ids/{prefix}, so the workflow fails early (e.g., during --dry-run) when config expects an ID list that no rule produces.

Changes:

  • Import pathlib.Path for extracting output basenames.
  • Add a validation block that scans rule outputs under intermediate_directory/protein/ids/ and raises an error if any config["protein_ids"] prefixes are uncovered.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/snakefiles/protein.snakefile Outdated

# import src.filter_compendia as filter
import src.snakefiles.util as util
from pathlib import Path
@gaurav gaurav added this to the Improved testing milestone Jun 5, 2026
gaurav and others added 3 commits June 5, 2026 17:42
Moves the inline config-drift validation from protein.snakefile into a
shared util.find_missing_id_prefixes() so it can be reused across all
semantic-type snakefiles without copy-pasting the set comprehension logic.
Also removes the now-redundant `from pathlib import Path` import and
trims the verbose inline comments that restated what the WorkflowError
message already says.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds the find_missing_id_prefixes guard to anatomy, gene, chemical,
diseasephenotype, process, taxon, and genefamily snakefiles so that any
config.yaml *_ids entry without a matching rule fires a WorkflowError at
DAG-construction time rather than failing silently mid-run.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gaurav gaurav changed the title Add config expansion rule checks Add config/rule drift checks for all semantic-type id lists Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants