Skip to content

Console: write method-file templates, and read relative paths from the method file in every mode - #819

Open
YukiMatsuzawa wants to merge 3 commits into
masterfrom
claude/console-parameter-template-gen-0da387
Open

YukiMatsuzawa wants to merge 3 commits into
masterfrom
claude/console-parameter-template-gen-0da387

Conversation

@YukiMatsuzawa

Copy link
Copy Markdown
Contributor

Summary

Adds a template command to the MS-DIAL 5 Console that writes a method file for one processing mode, holding the built-in defaults. It also makes relative file paths in method files resolve the same way in every mode.

MSDIALCUI template lcms -o lcms_method.txt
MSDIALCUI template gcms --ionmode Negative

template <gcms|lcms|dims|imms|lcimms>

Options

  • -o/--output: write to a file. Without it the template goes to standard output.
  • -f/--force: replace an existing file. Without it an existing file is not replaced.
  • --ionmode Positive|Negative: choose the ion mode.
  • The mode name is not case-sensitive.

Where the values come from. Every value is taken from a freshly constructed parameter object for the mode, not typed by hand. Two exceptions state what a run actually uses:

How keys are chosen

  • Only keys the mode's processing uses are written.
  • Each library path sits in the section of the annotation that uses it.
  • Left out: isotope tracking, CorrDec, the isotope text DB, the target-detection compound list, and keys no process reads.
  • Target CE and Sample average / blank average are kept deliberately, because they are about to be made to work. A code comment marks each.
  • Choices are listed only as the reader accepts them.

Tests (MethodFileTemplateTests) cover all five modes and both ion modes:

  • The template reads back with no unrecognised or unusable key.
  • The parameter it reads back into equals the defaults in a whole-object JSON comparison.
  • The comparison fails on any property it cannot serialize.
  • A control test shows the comparison does see a changed value.

Relative paths: one rule for every mode

Before: only GC-MS resolved method-file paths against the method file's folder. That behaviour came with #779 (ResolveGcmsFilePaths). LC-MS, DIMS, IMMS and LC-IM-MS opened a relative path from the working directory, while the annotator settings tables in the same file were already read relative to the method file.

Now: every reader resolves these keys against the method file's folder, and environment variables are expanded:

  • MSP, LBM, Text DB and isotope text DB paths
  • target-detection and RT-correction compound lists
  • RT correction peak selection
  • the RI dictionary (GC-MS)

Transition behaviour

  • Found only in the working directory: the file is used, and the run prints that it should be rewritten.
  • Found in both folders and the two files differ: the file beside the method file is used, and the run names both.
  • The same file reached by two spellings (8.3 name, junction, mapped drive): recognised from length and timestamps without reading it, and no message is printed.

Also

  • Added accumulated rt range as the correct spelling of the LC-IM-MS key accumulated rt ragne. The old spelling still reads.
  • Added "Method file" and "Method file template" to tests/MSDIAL5/MsdialCoreTestApp/CONTEXT.md.

Behaviour changes for existing method files

  • Changes which library is read: in LC-MS, DIMS, IMMS and LC-IM-MS, a relative path now resolves against the method file's folder. A job run from another directory with the same file name there now reads the method file's copy, and says so.
  • Changes an export field: a relative MSP or Text DB path now becomes absolute. This also changes the default annotator ID written to the Annotation method export field. This was judged acceptable.

Test plan

  • dotnet test tests/MSDIAL5/MsdialCoreTestAppTests: 115 passed.
  • MsdialCoreTestApp builds for net472, net48 and net8.
  • CLI: each of the five templates, passed to its own command with -m, gives 0 unrecognised and 0 unusable keys in .keys.json.
  • CLI: --ionmode Both is refused, and template LCMS --ionmode negative works.
  • CLI: both transition messages appear, and a path found beside the method file prints nothing.
  • Not run: a full analysis on real raw data. The repository has none; the CLI runs above stop at "No input file existed."

🤖 Generated with Claude Code

YukiMatsuzawa and others added 3 commits September 30, 2026 10:36
Add `template <mode>` to write a method file holding the built-in defaults,
resolve relative method-file paths against the method file in every mode,
and fix method-file keys the key report misreported.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…meter-template-gen-0da387

# Conflicts:
#	tests/MSDIAL5/MsdialCoreTestApp/Parser/ConfigParser.cs
- Accept only Positive or Negative for --ionmode, and any case for the mode.
- Name both files when a relative path finds different files beside the
  method file and in the working directory, without reading a file that is
  the same one reached by two spellings.
- Leave out keys no process reads, and put the alignment-only annotation
  switch in the GC-MS template, the only mode that reads it.
- Describe the annotator settings tables as the reader treats them.
- Write numbers in round-trip form, and fail the template round-trip test
  on a property the snapshot cannot read instead of skipping it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@YukiMatsuzawa
YukiMatsuzawa marked this pull request as ready for review September 30, 2026 06:23
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