Skip to content

Read on/off method-file keys in both directions - #813

Merged
YukiMatsuzawa merged 4 commits into
masterfrom
fix/console-two-way-boolean-keys
Sep 29, 2026
Merged

YukiMatsuzawa merged 4 commits into
masterfrom
fix/console-two-way-boolean-keys

Conversation

@YukiMatsuzawa

@YukiMatsuzawa YukiMatsuzawa commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Several case arms in the MS-DIAL 5 console's ConfigParser assigned only one of the two boolean values, but returned true either way:

case "keep original precursor isotopes": if (valueLower == "false") param.KeepOriginalPrecursorIsotopes = false; return true;

KeepOriginalPrecursorIsotopes defaults to false, so Keep original precursor isotopes: True changed nothing, yet the method-file key report (MethodFileKeys) listed it as applied. The other one-way arms were safe only because their default happened to match the one value they accepted.

Change

  • Added a TrueOrFalse(string text, Action<bool> assign) helper next to Number and Count. It accepts true and false in any letter case. Any other value returns MethodKeyOutcome.UnusableValue, so the key report says the value could not be read.
  • All the one-way arms now use it.
  • The existing two-way arms (if (valueLower == "true" || valueLower == "false") ... = bool.Parse(...); return true;) now use it too, because they also reported an unreadable value as applied. Each was a one-line change.
  • master (Console: record the keys LcmsProcess reads for itself as applied in <method>.keys.json #811) had already added a private TrueOrFalse helper that does the same job for its line readers. This PR uses that name for the shared helper, so there is one helper, not two. The three line-reader callers (ReadAlignmentLightMode, ReadDetailedAlignmentProvenance, ReadAnnotationCandidateExport) behave as before.
  • Not changed: ReadAlignmentLightMode, ReadDetailedAlignmentProvenance and ReadAnnotationCandidateExport. An unreadable value still falls back to false there, as before.

Keys whose behaviour changes

Now read in both directions. A value that used to be silently ignored now takes effect, and any value other than true/false is reported as unusable:

Key Reader Previously worked only for
Keep original precursor isotopes common false (True was ignored, and it is the non-default value)
Exclude after precursor common false
CorrDec execute common false
Is private version common true
Is private version of TADA common true
Accumulate MS2 spectra LC-IM-MS true
Replace quant mass by user defined value GC-MS true
Is quant mass based on base peak mz GC-MS true

Already two-way, but an unreadable value (e.g. yes) is now reported as unusable instead of applied:

  • Use retention information / use CCS for {MSP, LBM, text}-based annotation {scoring, filtering} (12 keys)
  • Only report top hit for {MSP, text}-based annotation
  • Execute annotation process only for alignment file (plus its MSP-based and LBM-based aliases)
  • Force insert peaks in gap filling
  • Together with alignment
  • Remove feature based on peak height fold-change
  • Keep reference matched metabolites
  • Keep suggested metabolites
  • Keep removable features and assigned tag for checking
  • Replace true zero values with 1/2 of minimum peak height over all samples
  • Execute RT correction
  • RT correction with smoothing for RT diff
  • Tracking isotope label
  • Set fully labeled reference file
  • CorrDec remove peaks larger than precursor
  • MnIsExportIonCorrelation (molecular networking)
  • Execute automatic RT correction for alignment, and Automatic RT correction interpolate blanks by analytical order (added on master in Add automatic alignment-only RT correction for LC-MS Console #810; moved onto TrueOrFalse when merging master)

A method file that spelled one of these as anything other than true/false was already being ignored. The run itself is unchanged; the key report now says so.

LBM CCS filtering key

use ccs for lbm-based annotation filtering used to set the MSP parameter instead of the LBM one. #816 fixed that on master, and this PR keeps #816's fix after merging it.

Tests

  • For each of the 8 fixed keys: True applies, False applies, TRUE applies, and yes is reported as unusable and leaves the previous value alone.
  • One already-two-way key (Together with alignment) is covered with the same checks.
  • dotnet test tests/MSDIAL5/MsdialCoreTestAppTests/MsdialCoreTestAppTests.csproj: 63 passed, 0 failed (after merging master).
  • dotnet build tests/MSDIAL5/MsdialCoreTestApp/MsdialCoreTestApp.csproj succeeds for net472, net48 and net8.

🤖 Generated with Claude Code

YukiMatsuzawa and others added 4 commits September 28, 2026 18:33
Several ConfigParser arms assigned only one of "true"/"false" and returned
true for either, so the other value was recorded as applied and ignored.
"Keep original precursor isotopes: True" never took effect, because the
property defaults to false. Route every boolean arm through a Flag helper
that accepts both values case-insensitively and reports anything else as
an unusable value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-boolean-keys

# Conflicts:
#	tests/MSDIAL5/MsdialCoreTestApp/Parser/ConfigParser.cs
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-boolean-keys

# Conflicts:
#	tests/MSDIAL5/MsdialCoreTestApp/Parser/ConfigParser.cs
@YukiMatsuzawa
YukiMatsuzawa merged commit 2d2400b into master Sep 29, 2026
1 check passed
@YukiMatsuzawa
YukiMatsuzawa deleted the fix/console-two-way-boolean-keys branch September 29, 2026 02:32
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