Make "Searched adduct ions" in a console method file take effect - #815
Merged
Merged
Conversation
The console reader stored AdductIon.GetAdductIon's shared cached instances, whose IsIncluded is false. PeakCharacterEstimator keeps only included adducts and otherwise falls back to [M+H]+ / [M-H]-, so every console run searched the proton adduct alone whatever the method file listed, while the method-file key report said the key had been applied. The reader now stores included copies (never mutating the shared cache), trims each entry, still drops entries that fail FormatCheck, and reports the value as unusable when none of the listed adducts can be read. This changes results for method files that list adducts other than the proton adduct. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ched-adducts-included # Conflicts: # tests/MSDIAL5/MsdialCoreTestAppTests/Parser/ConfigParserTests.cs
…ched-adducts-included
…ched-adducts-included # Conflicts: # tests/MSDIAL5/MsdialCoreTestAppTests/Parser/ConfigParserTests.cs
The console reader no longer builds AdductIon instances of its own. It stores GetAdductIon's shared instances and sets IsIncluded on them, as the GUI's AdductIonSettingModel already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Method files that listed adducts beyond the proton adduct were silently searched with
[M+H]+(Positive) or[M-H]-(Negative) only. After this change, the listed adducts are searched. Console reanalyses of such method files will get different adduct assignments and peak-character links than before.Bug
ConfigParser.ReadCommonParameter'ssearched adduct ionsarm filledparam.SearchedAdductIonswithAdductIon.GetAdductIon(...). That returns a shared instance from the static cache, and itsIsIncludedisfalse.PeakCharacterEstimator.SearchedAdductInitialize(both the MsdialCore and the DIMS copy) keeps onlyIsIncludedadducts and falls back to the proton adduct when none are left. Only the GUI'sAdductIonSettingModelever set the flag. SoSearched adduct ions: [M+H]+,[M+Na]+,[M+NH4]+ran with[M+H]+alone, and the method-file key report still recorded the key as applied.Fix
SearchedAdductIonshelper. It setsIsIncluded = truedirectly on the adductsGetAdductIonreturns. These are the shared cached instances, so the flag stays set for later callers in the same process. The GUI'sAdductIonSettingModelalready sets the flag this way, and a console run reads one method file per process.FormatCheckare still dropped. Entries are now trimmed, so[M+H]+, [M+Na]+keeps both.MethodKeyOutcome.UnusableValueand the built-in list is kept, following the file's documented convention.Other readers
ReadForGcms,ReadForDimsParameter,ReadForImmsParameterandReadForLcImMsParameterall send this key throughReadCommonParameter, so this one change fixes them all. No other place in the console buildsSearchedAdductIons.Tests (
ConfigParserTests)IsIncluded, and the key report stays silent.GetAdductIoninstances, now markedIsIncluded.UnusableValue.PeakCharacterEstimator.Processsearches exactly the listed adducts.Verification
dotnet test tests/MSDIAL5/MsdialCoreTestAppTests/MsdialCoreTestAppTests.csproj: 68/68 passed (after merging the latest master)dotnet build tests/MSDIAL5/MsdialCoreTestApp/MsdialCoreTestApp.csproj: net472, net48 and net8 build with 0 errors🤖 Generated with Claude Code