Skip to content

Add Bruker/timsTOF auto-calibration warning - #30

Merged
ypriverol merged 3 commits into
devfrom
feat/bruker-autocalibration-warning
Apr 3, 2026
Merged

ypriverol merged 3 commits into
devfrom
feat/bruker-autocalibration-warning

Conversation

@ypriverol

Copy link
Copy Markdown
Contributor

Summary

  • Add a log.warn in PRELIMINARY_ANALYSIS when .d files are processed with mass_acc_automatic=true, advising users to manually set mass accuracy to 10-15 ppm for timsTOF data
  • Add a "Bruker/timsTOF Data" section to docs/usage.md with recommended parameters and example command

Test plan

  • Run nextflow run . -profile test_dia_dotd,docker --outdir results and verify warning appears in log output
  • Run nextflow run . -profile test_dia,docker --outdir results (non-.d files) and verify no warning appears
  • Review docs rendering on GitHub

Closes #26

🤖 Generated with Claude Code

Add a log.warn in PRELIMINARY_ANALYSIS when a .d file is processed with
mass_acc_automatic=true, advising users to manually fix mass accuracy to
10-15 ppm for timsTOF data. Also add a "Bruker/timsTOF Data" section to
docs/usage.md with recommended parameters.

Closes #26

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Apr 3, 2026 •

Copy link
Copy Markdown

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: 76a8d702-e756-4673-bb70-e9560b440771

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 feat/bruker-autocalibration-warning

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

Review Summary by Qodo

Add Bruker/timsTOF auto-calibration warning and documentation

✨ Enhancement 📝 Documentation

Grey Divider

Walkthroughs

Description
• Add warning when processing Bruker/timsTOF .d files with automatic mass accuracy
• Recommend manual mass accuracy settings (10-15 ppm) for timsTOF datasets
• Document Bruker/timsTOF best practices with example command
• Include note about Synchro-PASEF data handling with --diann_tims_sum
Diagram
flowchart LR
  A["Bruker .d file detected"] -- "mass_acc_automatic=true" --> B["Log warning message"]
  B -- "recommends" --> C["Manual settings: 10-15 ppm"]
  D["docs/usage.md"] -- "documents" --> E["Bruker/timsTOF best practices"]
  E -- "includes" --> F["Example command with parameters"]
Loading

Grey Divider

File Changes

1. modules/local/diann/preliminary_analysis/main.nf ✨ Enhancement +7/-0

Add Bruker/timsTOF auto-calibration warning logic

• Add conditional check to detect .d files with automatic mass accuracy enabled
• Log warning message recommending manual mass accuracy settings (10-15 ppm)
• Provide suggested parameters for users to fix the issue

modules/local/diann/preliminary_analysis/main.nf


2. docs/usage.md 📝 Documentation +20/-0

Document Bruker/timsTOF configuration and best practices

• Add new "Bruker/timsTOF Data" section with best practices
• Include example command with recommended parameters for timsTOF datasets
• Document Synchro-PASEF data handling with --diann_tims_sum flag
• Add note about pipeline warning during PRELIMINARY_ANALYSIS

docs/usage.md


Grey Divider

Qodo Logo

@qodo-code-review

qodo-code-review Bot commented Apr 3, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. mass_acc_automatic still user-exposed 📎 Requirement gap ≡ Correctness
Description
The PR adds new user-facing documentation and runtime warnings around mass_acc_automatic, which
continues to expose DIA-NN autocalibration behavior instead of disabling/guarding it. This conflicts
with the requirement to not provide or run autocalibration/automatic mass-accuracy optimisation.
Code

docs/usage.md[R32-50]

+### Bruker/timsTOF Data
+
+For Bruker timsTOF datasets, DIA-NN recommends manually fixing MS1 and MS2 mass accuracy to 10-15 ppm rather than using automatic calibration:
+
+```bash
+nextflow run bigbio/quantmsdiann \
+  --input sdrf.tsv \
+  --database proteins.fasta \
+  --mass_acc_automatic false \
+  --mass_acc_ms1 10 \
+  --mass_acc_ms2 10 \
+  --diann_tims_sum \
+  -profile docker
+```
+
+For Synchro-PASEF data, enable `--diann_tims_sum` (which adds `--quant-tims-sum` to DIA-NN).
+
+> [!NOTE]
+> The pipeline will emit a warning during PRELIMINARY_ANALYSIS if it detects `.d` files with automatic mass accuracy calibration enabled.
Evidence
PR Compliance ID 1 requires the workflow to not expose or enable autocalibration/automatic
mass-accuracy optimisation. The new docs section and the new PRELIMINARY_ANALYSIS warning
explicitly surface mass_acc_automatic usage (including suggested flags), indicating the option
remains exposed rather than being removed/guarded.

Disable DIA-NN autocalibration option in quantmsdiann workflow
docs/usage.md[32-50]
modules/local/diann/preliminary_analysis/main.nf[57-62]

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 PR introduces new user-facing mentions/handling of `mass_acc_automatic` (autocalibration) instead of removing or guarding it, which violates the requirement to disable/exclude DIA-NN autocalibration from the workflow.
## Issue Context
Compliance requires that the pipeline does not expose an autocalibration/auto mass-accuracy optimisation option and does not enable it in executed DIA-NN commands (especially for Bruker/timsTOF where fixed 10–15 ppm is recommended).
## Fix Focus Areas
- docs/usage.md[32-50]
- modules/local/diann/preliminary_analysis/main.nf[57-62]

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


2. Wrong flags recommended ☑ 🐞 Bug ≡ Correctness
Description
The new PRELIMINARY_ANALYSIS warning (and the new docs snippet) recommends
--mass_acc_ms1/--mass_acc_ms2, but PRELIMINARY_ANALYSIS mass accuracy is derived from SDRF/params
precursor_mass_tolerance + fragment_mass_tolerance (and their units), so following the
recommendation may not change PRELIMINARY_ANALYSIS behavior and can leave automatic calibration
effectively enabled.
Code

modules/local/diann/preliminary_analysis/main.nf[R59-61]

+        log.warn "Bruker/timsTOF .d file detected (${ms_file.name}) with automatic mass accuracy calibration enabled. " +
+            "DIA-NN recommends manually fixing MS1 and MS2 mass accuracy to 10-15 ppm for timsTOF datasets. " +
+            "Consider using: --mass_acc_automatic false --mass_acc_ms1 10 --mass_acc_ms2 10"
Evidence
PRELIMINARY_ANALYSIS only builds mass_acc from
meta['precursormasstolerance']/meta['fragmentmasstolerance'] when mass_acc_automatic is false
and both tolerance units are ppm; it never reads params.mass_acc_ms1/params.mass_acc_ms2. Those
mass_acc_ms1/2 params are instead used in INDIVIDUAL_ANALYSIS. The docs addition repeats the same
--mass_acc_ms1/--mass_acc_ms2 recommendation, so users are likely to apply ineffective flags for
the PRELIMINARY_ANALYSIS calibration step.

modules/local/diann/preliminary_analysis/main.nf[48-55]
subworkflows/local/create_input_channel/main.nf[120-169]
modules/local/diann/individual_analysis/main.nf[47-62]
docs/usage.md[32-45]

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 Bruker/timsTOF warning and docs recommend `--mass_acc_ms1/--mass_acc_ms2`, but those params do not control PRELIMINARY_ANALYSIS mass accuracy; PRELIMINARY_ANALYSIS uses SDRF-derived `precursormasstolerance/fragmentmasstolerance` (or their param fallbacks) and requires ppm units.
### Issue Context
Users following the warning/docs may believe they disabled automatic calibration for PRELIMINARY_ANALYSIS when they did not.
### Fix Focus Areas
- modules/local/diann/preliminary_analysis/main.nf[57-62]
- docs/usage.md[32-45]
### Suggested change
Update the warning text and docs example to recommend the parameters that actually feed `meta.precursormasstolerance`/`meta.fragmentmasstolerance` and their units (or instruct users to set the SDRF columns), e.g. `--mass_acc_automatic false --precursor_mass_tolerance 10 --precursor_mass_tolerance_unit ppm --fragment_mass_tolerance 10 --fragment_mass_tolerance_unit ppm` (values in 10–15 ppm range). If you still want to mention `--mass_acc_ms1/--mass_acc_ms2`, clarify that those apply to INDIVIDUAL_ANALYSIS/final runs, not PRELIMINARY_ANALYSIS.

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



Remediation recommended

3. log.warn uses double quotes 📘 Rule violation ⚙ Maintainability
Description
The newly added warning concatenates multiple double-quoted strings even where no interpolation is
used, conflicting with the documented Groovy/Nextflow string-style guidance. This reduces
consistency with repository formatting expectations.
Code

modules/local/diann/preliminary_analysis/main.nf[R59-61]

+        log.warn "Bruker/timsTOF .d file detected (${ms_file.name}) with automatic mass accuracy calibration enabled. " +
+            "DIA-NN recommends manually fixing MS1 and MS2 mass accuracy to 10-15 ppm for timsTOF datasets. " +
+            "Consider using: --mass_acc_automatic false --mass_acc_ms1 10 --mass_acc_ms2 10"
Evidence
PR Compliance ID 10 requires single quotes unless interpolation is required. In the added
log.warn, only the first segment needs interpolation (${ms_file.name}), while the other
concatenated segments could use single quotes to follow the style rule.

AGENTS.md
modules/local/diann/preliminary_analysis/main.nf[59-61]

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 `log.warn` message uses double-quoted string literals for segments that do not require interpolation.
## Issue Context
Repository style guidance prefers single quotes unless interpolation is needed.
## Fix Focus Areas
- modules/local/diann/preliminary_analysis/main.nf[59-61]

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


4. Warning misses auto fallback 🐞 Bug ≡ Correctness
Description
The new warning only triggers when params.mass_acc_automatic is true, but PRELIMINARY_ANALYSIS can
still run with automatic mass accuracy when mass_acc_automatic is false if tolerance units are not
both ppm (it falls back to mass_acc = ""). In that fallback-to-auto case, timsTOF .d inputs
would not produce the intended warning.
Code

modules/local/diann/preliminary_analysis/main.nf[58]

+    if (params.mass_acc_automatic && ms_file.name.toString().toLowerCase().endsWith('.d')) {
Evidence
PRELIMINARY_ANALYSIS sets mass_acc = "" (automatic) not only when params.mass_acc_automatic is
true, but also in the else branch when the SDRF/param tolerance units are not both ppm. The
warning condition checks only params.mass_acc_automatic, so it will not fire when mass_acc is
empty due to this unit-mismatch fallback. This fallback is plausible by default because
fragment_mass_tolerance_unit defaults to Da, and create_input_channel uses that param when the
SDRF column is missing.

modules/local/diann/preliminary_analysis/main.nf[48-62]
nextflow.config[33-39]
subworkflows/local/create_input_channel/main.nf[147-169]

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 Bruker/timsTOF warning is keyed off `params.mass_acc_automatic`, but PRELIMINARY_ANALYSIS can still end up using automatic mass accuracy (`mass_acc == ""`) when `mass_acc_automatic=false` and the tolerance units are not both ppm.
### Issue Context
This can happen when SDRF does not provide ppm units for both tolerances (and defaults include `fragment_mass_tolerance_unit = 'Da'`). In that case, users won’t see the timsTOF warning even though automatic behavior is still in effect.
### Fix Focus Areas
- modules/local/diann/preliminary_analysis/main.nf[48-62]
### Suggested change
Trigger the warning based on the *effective* behavior rather than only the param, e.g. after computing `mass_acc`:
- `def using_auto = (mass_acc == "")`
- `if (using_auto && ms_file.name.toString().toLowerCase().endsWith('.d')) { log.warn ... }`
Alternatively compute `using_auto` as `params.mass_acc_automatic || !(meta prec/frag units are both ppm)`.

ⓘ 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

Comment thread docs/usage.md Resolved
ypriverol and others added 2 commits April 3, 2026 08:38
Instead of prescribing specific mass accuracy values, guide users to
set tolerances via SDRF columns (per-file) or pipeline parameters
(global override). Updated both the runtime warning and docs.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@ypriverol
ypriverol merged commit be690ee into dev Apr 3, 2026
8 checks passed
@ypriverol
ypriverol deleted the feat/bruker-autocalibration-warning branch April 9, 2026 09:13
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