Repository navigation
Add molecule structure preview to the Compound search window - #839
Merged
YukiMatsuzawa merged 1 commit intoOct 21, 2026
Merged
YukiMatsuzawa merged 1 commit into
YukiMatsuzawa merged 1 commit into
Conversation
The Compound search window (opened on a double-click of a peak in
analysis or alignment) shows the detailed match info (Selected Library
ID, similarity scores) for the row selected in the library table but
has no structure preview. Each platform reuses the same
MoleculeStructureView the main window's Structure tab uses, so the
preview just needs an SMILES-bearing source and a place to sit.
* ViewModel/Search/CompoundSearchVM.cs: a single
MoleculeStructureModel is held by the base VM, subscribed to
SelectedCompound, and exposed as StructureViewModel for the views.
Placed on the non-generic CompoundSearchVM so the six per-platform
VMs (Gcms Analysis/Alignment, Lcms, Dims, Imms, Lcimms) pick it up
together. MoleculeStructureModel is held by the VM here rather than
the ICompoundSearchModel model because the model has no natural
owner for an 'annotated molecule' the way GcmsAnalysisModel does;
the per-search-window lifetime is short and the 20-entry LRU cache
is recreated on demand.
* View/{Gcms,GcmsAlignment,Lcms,Dims,Imms,Lcimms}*CompoundSearchView.xaml:
rewrite the outer grid as two rows. Row 1 is the existing controls,
info panels, properties, plus the new MoleculeStructureView (no
border) in a middle column. Row 2 moves the library table and the
spectrum mirror plot side by side, with the table widened to 5*
and the spectrum narrowed to 2*. The three info panels (File, Peak,
Annotation) become an explicit three-column grid instead of a
WrapPanel. GcmsAnalysis keeps the original two panels (File +
Spectrum) to match the existing template set.
Verified: 'dotnet build src/MSDIAL5/MsdialGuiApp/MsdialGuiApp.csproj
/p:Configuration="Debug vendor unsupported" --framework net48' builds
with 0 errors. The behavior was checked manually in
'Debug vendor unsupported' net48 on Windows by opening a GC/MS
project, double-clicking an annotated peak, and confirming that the
structure preview renders, follows the row selection, and falls
back to 'No available structure.' when the row has no SMILES.
Out of scope: no automated tests. MoleculeStructureViewModel is a
thin wrapper over MoleculeStructureModel around NCDK DepictionGenerator
which is hard to drive headlessly on a non-Windows runner, and
MsdialGuiAppTests does not currently cover the CompoundSearchVM
family. The new StructureViewModel property is read-only and has the
same Disposables-bound lifetime as the surrounding VM, so manual
verification on Windows is the appropriate gate here, the same as
the rest of the GUI in this project.
Contributor
|
Thank you for your contribution! I’ll merge this after testing it. |
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.
Why
The Compound search window shows the detailed match info of the library row the user picks — scores, spectrum — but no structure preview. The main window's Structure tab only covers the representative match, so the candidates in the table cannot be compared by structure.
The existing two-column layout has no room for a preview without squeezing the Properties panel, so the window is reshaped as two rows: the top row keeps the controls, info panels, structure preview, and Properties; the bottom row puts the library table and the spectrum mirror plot side by side (table widened, spectrum narrowed).
What changes
ViewModel/Search/CompoundSearchVM.cs— the non-generic base VM holds aMoleculeStructureModel, subscribed toSelectedCompound, exposed asStructureViewModel. All six per-platform VMs (Gcms Analysis/Alignment, Lcms, Dims, Imms, Lcimms) inherit it together.ICompoundSearchModelhas no natural owner for an annotated molecule, so the model lives on the VM here.View/*/*CompoundSearchView.xaml— two-row outer grid as described above, withMoleculeStructureViewbound toStructureViewModelin the top middle, and the three info panels switched fromWrapPanelto an explicit grid so they always sit side by side.GcmsAnalysisCompoundSearchViewkeeps its original two info panels (File + Spectrum); the other five keep three (File + Peak + Annotation).Tests
dotnet build src/MSDIAL5/MsdialGuiApp/MsdialGuiApp.csproj /p:Configuration="Debug vendor unsupported"builds with 0 errors onnet48andnet472.Out of scope
MsdialGuiAppTestsdoes not cover theCompoundSearchVMfamily, andMoleculeStructureViewModelwraps NCDKDepictionGenerator, which is not practical to drive headlessly.MoleculeStructureModelfrom the VM intoICompoundSearchModel(the wayGcmsAnalysisModelholds one) would let future search windows share a cache, but is a separate change.AI assistance was used to develop this contribution. I provided the requirements and manually tested the GC/MS compound-search behavior on Windows. Build results and the limits of manual test coverage are documented above. I take responsibility for the submitted changes.