Skip to content

feat: support per-group scenario templates#435

Open
johanneskoester wants to merge 6 commits intomasterfrom
feat/per-group-scenarios
Open

feat: support per-group scenario templates#435
johanneskoester wants to merge 6 commits intomasterfrom
feat/per-group-scenarios

Conversation

@johanneskoester
Copy link
Copy Markdown
Contributor

@johanneskoester johanneskoester commented Mar 17, 2026

Summary by CodeRabbit

  • New Features

    • Per-group scenario selection: scenarios can be customized per group with automatic fallback to the global template.
  • Documentation

    • Added guide for group-level configuration: required "group" column, optional metadata, and how per-group scenario overrides affect overview headers and scenario rendering.
  • Bug Fixes

    • Ensures missing per-group scenario entries are populated to prevent lookup failures.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

Group-aware scenario selection was added: workflows now look up a per-group scenario from group_annotation (e.g., config/groups.tsv) for rendering; if missing, the global config["calling"]["scenario"] is used. Documentation was updated to describe the optional group sheet and override behavior.

Changes

Cohort / File(s) Summary
Documentation
config/README.md
Added sections describing an optional config/groups.tsv (required group column), optional metadata columns, a scenario column for per-group template overrides, and how group data appears in variant-call overview headers.
Workflow rules
workflow/rules/calling.smk, workflow/rules/common.smk
render_scenario input.template changed to lookup per-group scenario from group_annotation; common.smk now ensures group_annotation["scenario"] exists, populating it from the global config and filling nulls where needed.

Sequence Diagram(s)

sequenceDiagram
    participant Rule as Snakemake rule render_scenario
    participant Groups as group_annotation (e.g., config/groups.tsv)
    participant Config as config (global scenario)
    participant Renderer as Template renderer

    Rule->>Groups: lookup(query="group == '{group}'", cols="scenario")
    alt per-group scenario found
        Groups-->>Rule: return per-group scenario path
        Rule->>Renderer: render using per-group template
    else no per-group scenario
        Rule->>Config: read config["calling"]["scenario"]
        Config-->>Rule: return global scenario path
        Rule->>Renderer: render using global template
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • dlaehnemann

Poem

🐰 I hopped through rows of group and name,
A tiny "scenario" lit a flame.
If none I find, the default I keep,
Now templates wake from group-wise sleep. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: support per-group scenario templates' accurately and concisely describes the main feature being added across all modified files: enabling scenario template selection on a per-group basis via group_annotation lookup.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/per-group-scenarios

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown
Contributor

Super-linter summary

Language Validation result
SNAKEMAKE_SNAKEFMT Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@workflow/rules/common.smk`:
- Around line 91-92: The current logic only sets group_annotation["scenario"]
from lookup("calling/scenario", within=config) when the entire "scenario" column
is missing; instead, ensure that for rows where group_annotation["scenario"] is
empty/NA you replace those individual entries with the lookup default. Update
the handling around group_annotation and the "scenario" column so that existing
non-empty overrides are preserved but empty/NA cells are filled from
lookup("calling/scenario", within=config) (e.g., perform a per-row fill/where
operation on group_annotation["scenario"] using the lookup value).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8373db8d-06bf-47a0-897b-1da6b9c010f0

📥 Commits

Reviewing files that changed from the base of the PR and between 87a8665 and 195d3b0.

📒 Files selected for processing (3)
  • config/README.md
  • workflow/rules/calling.smk
  • workflow/rules/common.smk

Comment thread workflow/rules/common.smk
@github-actions
Copy link
Copy Markdown
Contributor

Super-linter summary

Language Validation result
SNAKEMAKE_SNAKEFMT Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8a9c4998-2558-4232-b25f-f277c6aabb6e

📥 Commits

Reviewing files that changed from the base of the PR and between 195d3b0 and 40fa852.

📒 Files selected for processing (1)
  • workflow/rules/calling.smk

Comment thread workflow/rules/calling.smk
@github-actions
Copy link
Copy Markdown
Contributor

Super-linter summary

Language Validation result
SNAKEMAKE_SNAKEFMT Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

@github-actions
Copy link
Copy Markdown
Contributor

Super-linter summary

Language Validation result
SNAKEMAKE_SNAKEFMT Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

♻️ Duplicate comments (1)
workflow/rules/common.smk (1)

91-94: ⚠️ Potential issue | 🔴 Critical

default_scenario is undefined and will crash at runtime.

At Line 94, default_scenario is used but never defined in this file, so workflows with a scenario column in groups.tsv will fail with NameError.

🐛 Suggested fix
+default_scenario = lookup("calling/scenario", within=config)
 if "scenario" not in group_annotation.columns:
-    group_annotation["scenario"] = lookup("calling/scenario", within=config)
+    group_annotation["scenario"] = default_scenario
 else:
-    group_annotation.loc[:, "scenario"].fillna(default_scenario, inplace=True)
+    group_annotation["scenario"] = (
+        group_annotation["scenario"].replace("", pd.NA).fillna(default_scenario)
+    )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@workflow/rules/common.smk` around lines 91 - 94, The code uses
default_scenario in group_annotation.loc[:, "scenario"].fillna(default_scenario,
inplace=True) but default_scenario is never defined; define it by calling the
same lookup used above (e.g. default_scenario = lookup("calling/scenario",
within=config)) before the if/else or replace the fillna argument with
lookup("calling/scenario", within=config) so group_annotation.fillna has a valid
value; reference symbols: group_annotation, default_scenario,
lookup("calling/scenario", within=config).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@workflow/rules/common.smk`:
- Around line 91-94: The code uses default_scenario in group_annotation.loc[:,
"scenario"].fillna(default_scenario, inplace=True) but default_scenario is never
defined; define it by calling the same lookup used above (e.g. default_scenario
= lookup("calling/scenario", within=config)) before the if/else or replace the
fillna argument with lookup("calling/scenario", within=config) so
group_annotation.fillna has a valid value; reference symbols: group_annotation,
default_scenario, lookup("calling/scenario", within=config).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 62670ca0-5e82-4659-94c9-9962b56abcbd

📥 Commits

Reviewing files that changed from the base of the PR and between 40fa852 and d240a52.

📒 Files selected for processing (1)
  • workflow/rules/common.smk

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