Skip to content

refactor: centralize blocked flags + fix missing guards from PR #36 review#48

Merged
ypriverol merged 4 commits intodevfrom
fix/blocked-flags-refactor
Apr 11, 2026
Merged

refactor: centralize blocked flags + fix missing guards from PR #36 review#48
ypriverol merged 4 commits intodevfrom
fix/blocked-flags-refactor

Conversation

@ypriverol
Copy link
Copy Markdown
Member

Summary

Review fixes included

# Issue Fix
1 --no-prot-inf missing from ASSEMBLE, INDIVIDUAL, FINAL Added to all three + COMMON awareness
3 --channel-run-norm, --channel-spec-norm missing from FINAL Added to FINAL_QUANTIFICATION
4 No version guard for channel norm flags Added to 2.0+ version guard in dia.nf
5 --no-norm + channel_run_norm contradiction Added warning in dia.nf
6 INSILICO missing --var-mod, --fixed-mod, --channels Now in COMMON (shared across all modules)

Architecture

// Before (in each module, 10+ lines):
def blocked = ['--flag1', '--flag2', ...]
blocked.sort { ... }.each { flag -> ... }

// After (one line per module):
args = BlockedFlags.strip('FINAL_QUANTIFICATION', args, log)

BlockedFlags.groovy defines:

  • COMMON list: flags shared by all DIA-NN steps
  • MODULE_FLAGS map: per-module additions
  • strip(): the shared stripping logic with warnings

Test plan

  • Run test_dia — verify args stripping still works
  • Pass --extra_args "--no-prot-inf" — verify warning appears for all modules
  • Pass --channel_run_norm true with DIA-NN 1.8.1 — verify version guard error

🤖 Generated with Claude Code

Replace duplicated blocked-flags logic (10+ lines x 5 modules) with
a single centralized registry in lib/BlockedFlags.groovy. Each module
now uses one line: `args = BlockedFlags.strip('MODULE_NAME', args, log)`

Fixes from PR #36 review:
- Add --no-prot-inf to ASSEMBLE, INDIVIDUAL, FINAL blocked lists
- Add --channel-run-norm, --channel-spec-norm to FINAL blocked list
- Add --var-mod, --fixed-mod, --channels to INSILICO (via COMMON)
- Add --relaxed-prot-inf, --pg-level to ASSEMBLE blocked list
- Add version guard for channel normalization flags (require >= 2.0)
- Add warning when --normalize false conflicts with channel norm flags

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 11, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 56954d5b-a64d-4ecc-b2b8-199b1edd72b2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/blocked-flags-refactor

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

github-actions bot commented Apr 11, 2026

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

Posted for pipeline commit fa68710

+| ✅ 106 tests passed       |+
#| ❔  19 tests were ignored |#
#| ❔   1 tests had warnings |#
!| ❗   4 tests had warnings |!
Details

❗ Test warnings:

  • files_exist - File not found: conf/igenomes.config
  • files_exist - File not found: conf/igenomes_ignored.config
  • files_exist - File not found: .github/workflows/awstest.yml
  • files_exist - File not found: .github/workflows/awsfulltest.yml

❔ Tests ignored:

❔ Tests fixed:

✅ Tests passed:

Run details

  • nf-core/tools version 3.5.2
  • Run at 2026-04-11 06:03:34

Add comments explaining:
- Why blocked flags exist (prevent silent DIA-NN flag conflicts)
- Why they live in a Groovy class, not config files (safety — can't
  be overridden by user configs)
- How to add new blocked flags (edit one file, no module changes)
- In each module: point developers to lib/BlockedFlags.groovy

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors DIA-NN --extra_args sanitization by centralizing all pipeline-managed/blocked DIA-NN flags into a shared lib/BlockedFlags.groovy helper, and incorporates additional DIA-NN v2.0+ guarding plus a warning for potentially contradictory normalization settings in the DIA workflow.

Changes:

  • Introduces lib/BlockedFlags.groovy as a single source of truth for blocked DIA-NN flags and shared stripping logic.
  • Updates DIA-NN local modules to call BlockedFlags.strip(<MODULE>, args, log) instead of duplicating per-module regex stripping logic.
  • Extends DIA workflow version guarding to include channel normalization flags and adds a warning for --no-norm vs channel normalization contradiction.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
workflows/dia.nf Adds DIA-NN v2.0+ guard for channel norm flags and warns on contradictory normalization settings.
modules/local/diann/preliminary_analysis/main.nf Replaces in-module blocked-flag stripping with centralized BlockedFlags.strip.
modules/local/diann/insilico_library_generation/main.nf Replaces in-module blocked-flag stripping with centralized BlockedFlags.strip.
modules/local/diann/individual_analysis/main.nf Replaces in-module blocked-flag stripping with centralized BlockedFlags.strip.
modules/local/diann/final_quantification/main.nf Replaces in-module blocked-flag stripping with centralized BlockedFlags.strip.
modules/local/diann/assemble_empirical_library/main.nf Replaces in-module blocked-flag stripping with centralized BlockedFlags.strip.
lib/BlockedFlags.groovy New centralized registry and implementation for blocked DIA-NN flags stripping.

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

Comment thread lib/BlockedFlags.groovy
ypriverol and others added 2 commits April 11, 2026 06:57
ASSEMBLE_EMPIRICAL_LIBRARY doesn't set --no-prot-inf,
--relaxed-prot-inf, or --pg-level in its command, so blocking
them would strip user values without providing a replacement.
Users should be able to pass these to the assembly step if needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Each blocked flag now has a comment explaining WHY it's blocked:
- "Pipeline-managed": the pipeline sets it from params/SDRF/metadata
- "No-effect guard": the flag has no effect in this step but is
  blocked to prevent users from wrongly believing it does

This prevents future contributors (human or AI) from removing flags
without understanding the intent behind the block.

Reverts the accidental removal of protein inference flags from
ASSEMBLE_EMPIRICAL_LIBRARY — they are intentionally blocked as a
no-effect guard since --gen-spec-lib produces a spectral library,
not a quantified report.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ypriverol ypriverol merged commit 7f43540 into dev Apr 11, 2026
20 checks passed
@ypriverol ypriverol deleted the fix/blocked-flags-refactor branch April 12, 2026 08:06
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.

2 participants