Skip to content

feat: expose FDR conservative parameter#690

Merged
ypriverol merged 2 commits intobigbio:devfrom
ypriverol:feat/expose-fdr-conservative-param
Apr 4, 2026
Merged

feat: expose FDR conservative parameter#690
ypriverol merged 2 commits intobigbio:devfrom
ypriverol:feat/expose-fdr-conservative-param

Conversation

@ypriverol
Copy link
Copy Markdown
Member

@ypriverol ypriverol commented Apr 3, 2026

Summary

  • Add fdr_conservative parameter (default true) to control the FDR estimation formula in FalseDiscoveryRate
  • When true (default): uses (D+1)/T — conservative upper bound, backward compatible
  • When false: uses (D+1)/(T+D) — tighter estimate per Keich & Noble (2025, Nature Methods)

Motivation

In a benchmarking study comparing quantms against ProteomeDiscoverer on TMTpro 16-plex data, we traced a significant source of peptide loss to the conservative FDR formula. The (D+1)/T formula inflates q-values by ~20-40% compared to (D+1)/(T+D), which causes borderline peptides with good Percolator PEP scores (< 0.01) to be filtered out when the inflated q-value exceeds the PSM-level FDR cutoff.

Specifically, X PD-confirmed peptides had original Percolator PEP < 0.01 but were removed (we suspected) because the conservative FDR formula pushed their q-values above the 1% threshold.

The parameter was already available in the OpenMS FalseDiscoveryRate tool as -algorithm:conservative but was not exposed in the quantms workflow.

Changes

File Change
nextflow.config Added fdr_conservative = true default parameter
modules/local/openms/false_discovery_rate/main.nf Pass -algorithm:conservative ${params.fdr_conservative}
nextflow_schema.json Added schema entry with documentation

References

  • Keich U, Noble WS. On the use of entrapment to evaluate the false discovery rate in mass spectrometry-based proteomics. Nature Methods 22, 1454–1463 (2025)

Test plan

  • Default behavior (fdr_conservative=true) produces identical results to current version
  • Setting fdr_conservative=false reduces q-values and recovers additional peptides/proteins
  • FDR control remains valid with fdr_conservative=false (verify with entrapment or target-decoy analysis)

🤖 Generated with Claude Code

Add `fdr_conservative` parameter (default true for backward
compatibility) that controls whether the FDR estimation uses the
conservative formula (D+1)/T or the tighter (D+1)/(T+D).

The conservative formula provides an upper bound on the true FDR
but can be overly conservative, especially at low FDR thresholds.
Keich & Noble (2025, Nature Methods) showed that (D+1)/T is useful
for guaranteeing FDR control but inflates q-values by ~20-40% in
the borderline range compared to (D+1)/(T+D).

In benchmarking against ProteomeDiscoverer, we found that 429
PD-confirmed peptides with Percolator PEP < 0.01 were filtered out
because the conservative FDR formula inflated their q-values above
the 1% threshold. Setting fdr_conservative=false may recover a
portion of these peptides while maintaining valid FDR control.

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

coderabbitai bot commented Apr 3, 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: 734a5aa8-8b4e-44eb-8e18-b157be5aa78c

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

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.

@qodo-code-review
Copy link
Copy Markdown
Contributor

Review Summary by Qodo

Expose FDR conservative parameter for flexible FDR estimation

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Expose fdr_conservative parameter to control FDR estimation formula
• Default true maintains backward compatibility with conservative (D+1)/T formula
• Setting false uses tighter (D+1)/(T+D) estimate per Keich & Noble (2025)
• Recovers peptides filtered by overly conservative q-value inflation
Diagram
flowchart LR
  A["fdr_conservative parameter"] -->|true| B["Conservative formula (D+1)/T"]
  A -->|false| C["Tighter formula (D+1)/(T+D)"]
  B --> D["Upper bound on FDR"]
  C --> E["Tighter q-value estimates"]
  D --> F["Backward compatible default"]
  E --> G["Recover borderline peptides"]
Loading

Grey Divider

File Changes

1. modules/local/openms/false_discovery_rate/main.nf ✨ Enhancement +1/-0

Pass conservative parameter to FalseDiscoveryRate tool

• Added -algorithm:conservative ${params.fdr_conservative} flag to FalseDiscoveryRate command
• Passes the parameter value to OpenMS tool for FDR formula selection

modules/local/openms/false_discovery_rate/main.nf


2. nextflow.config ⚙️ Configuration changes +1/-0

Add fdr_conservative parameter with default value

• Added fdr_conservative = true parameter with default value
• Includes inline comment explaining the two FDR formula options

nextflow.config


3. nextflow_schema.json 📝 Documentation +7/-0

Document fdr_conservative parameter in schema

• Added schema entry for fdr_conservative boolean parameter
• Includes description, default value, icon, and detailed help text
• References Keich & Noble (2025) for FDR estimation methodology

nextflow_schema.json


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown
Contributor

qodo-code-review bot commented Apr 3, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (2) 📎 Requirement gaps (0) 🎨 UX Issues (0)

Grey Divider


Action required

1. Invalid schema JSON 🐞 Bug ≡ Correctness
Description
nextflow_schema.json is syntactically invalid because the newly added fdr_conservative property
block is not followed by a comma even though additional properties follow. Any consumer parsing the
schema will fail (e.g., nf-core launch / parameter schema validation tooling).
Code

nextflow_schema.json[R975-976]

+                },
                "protein_inference_debug": {
Evidence
In JSON, object properties must be comma-separated. Here, the fdr_conservative property closes and
the next property (protein_inference_debug) starts immediately on the next line with no comma,
making the file invalid JSON.

nextflow_schema.json[969-976]
nextflow_schema.json[976-980]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`nextflow_schema.json` is invalid JSON because the `fdr_conservative` property definition is not followed by a comma, but another property (`protein_inference_debug`) follows immediately after.

## Issue Context
This breaks JSON parsing for any tooling that reads `nextflow_schema.json`.

## Fix
Add a trailing comma after the closing brace of the `fdr_conservative` property block.

## Fix Focus Areas
- nextflow_schema.json[969-976]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. fdr_conservative line too long 📘 Rule violation ⚙ Maintainability
Description
The new fdr_conservative parameter line is far over the ~120 character guideline, reducing
readability and violating the project’s Nextflow/Groovy style conventions. This can cause formatting
drift and makes reviews harder.
Code

nextflow.config[34]

+    fdr_conservative         = true   // Use (D+1)/T formula (true) or (D+1)/(T+D) (false) for FDR estimation
Evidence
PR Compliance ID 7 requires adhering to project code style conventions, including keeping lines
generally under ~120 characters. The newly added fdr_conservative line includes a long inline
comment that exceeds this guideline.

AGENTS.md
nextflow.config[34-34]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The `fdr_conservative` parameter line includes an inline comment that makes the line exceed the project’s preferred ~120 character limit.

## Issue Context
This is a style/readability requirement for Groovy/Nextflow code.

## Fix Focus Areas
- nextflow.config[34-34]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. fdr_conservative untested parameter 📘 Rule violation ☼ Reliability
Description
The PR changes module behavior by wiring params.fdr_conservative into the FalseDiscoveryRate
call, but no targeted test was added to exercise the new non-default behavior (false). This risks
regressions going undetected for the new feature.
Code

modules/local/openms/false_discovery_rate/main.nf[31]

+        -algorithm:conservative ${params.fdr_conservative} \\
Evidence
PR Compliance ID 8 requires workflow/module changes to be exercised by targeted tests and/or nf-test
cases. The diff adds a new runtime-affecting CLI flag controlled by params.fdr_conservative, but
the PR contains no corresponding test additions/updates to validate the new behavior.

AGENTS.md
modules/local/openms/false_discovery_rate/main.nf[31-31]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new `fdr_conservative` parameter path (`false`) is not covered by any targeted test changes in this PR.

## Issue Context
The module invocation now conditionally changes the FDR algorithm via `-algorithm:conservative ${params.fdr_conservative}`; the non-default behavior should be exercised in CI.

## Fix Focus Areas
- modules/local/openms/false_discovery_rate/main.nf[31-31]
- tests/default.nf.test[7-32]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 3, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@ypriverol ypriverol requested review from Copilot and jpfeuffer April 3, 2026 07:00
Comment on lines +975 to 976
},
"protein_inference_debug": {
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.

Action required

1. Invalid schema json 🐞 Bug ≡ Correctness

nextflow_schema.json is syntactically invalid because the newly added fdr_conservative property
block is not followed by a comma even though additional properties follow. Any consumer parsing the
schema will fail (e.g., nf-core launch / parameter schema validation tooling).
Agent Prompt
## Issue description
`nextflow_schema.json` is invalid JSON because the `fdr_conservative` property definition is not followed by a comma, but another property (`protein_inference_debug`) follows immediately after.

## Issue Context
This breaks JSON parsing for any tooling that reads `nextflow_schema.json`.

## Fix
Add a trailing comma after the closing brace of the `fdr_conservative` property block.

## Fix Focus Areas
- nextflow_schema.json[969-976]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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

Exposes an OpenMS FalseDiscoveryRate “conservative” toggle as a workflow parameter to control which FDR estimation formula is used, keeping the current behavior as the default.

Changes:

  • Add params.fdr_conservative (default true) to the pipeline configuration
  • Wire params.fdr_conservative into the OpenMS FalseDiscoveryRate invocation via -algorithm:conservative
  • Document the new parameter in nextflow_schema.json

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
nextflow_schema.json Adds schema/documentation for the new fdr_conservative boolean parameter
nextflow.config Introduces the default fdr_conservative = true pipeline parameter
modules/local/openms/false_discovery_rate/main.nf Passes params.fdr_conservative through to OpenMS FalseDiscoveryRate

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

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ypriverol ypriverol merged commit 8427ac3 into bigbio:dev Apr 4, 2026
118 of 128 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants