msentity Spectrum Viewer for VS CodeInspect mass spectra, compare a query and reference spectrum side by side, and
explore spectral similarity results inside desktop VS Code. Open
Supported platforms: Windows x64 and Linux x64. RDKit is included for molecular structure previews and SMARTS filtering. Quick startDownload query spectra and precomputed similarity results. These spectra are synthetic examples for trying the viewer.
In the query dataset, use a button in the Structure column to see a molecule rendered from its SMILES field. To repeat the search, also download the
reference spectra.
From the query dataset, choose More → Calculate similarity → Library search,
then select the reference file. Choose Cosine, Weighted entropy, and
Unweighted entropy. Set the threshold to 0, use the default fragment
tolerances ( Screenshots
Features
InstallIn the Extensions view in desktop VS Code, search for
For manual installation, download the VSIX for your platform from GitHub Releases:
or use Extensions → Views and More Actions (...) → Install from VSIX....
Each package contains the viewer backend for one platform: Linux x64
( GitHub Releases provides two VSIX variants for each platform:
Chemistry features (RDKit)SMARTS substructure filters, 2D structure previews, and SMILES/structure counts use RDKit, whose WebAssembly build is included in the extension: nothing has to be installed. RDKit runs in a background thread, so long SMARTS searches do not block VS Code. Structure previews use the metadata column configured by
UsageOpen an Loading optionsUse More ... → Loading options and reload to change how the current file is read. It reloads that entry with explicit per-file options. Normal Reload uses the latest workspace Loading and Structure settings unless the entry has an explicit per-file choice. Unsaved edits are discarded. The default options for newly opened files are available under Settings →
Extensions → msentity Spectrum Viewer → Loading. They control duplicate
MSP/MGF fields, column and adduct canonicalization, intensity normalization,
SpecID assignment, TSV/CSV type inference, and optional error logging. Error
logging defaults to Use Merge in the dataset menu to select two or more registered datasets.
The originals remain unchanged. The new in-memory dataset preserves source and
spectrum order, uses the union of columns, and adds a collision-safe
Pin the upper spectrum and select another spectrum to compare them on a shared
m/z axis. The second spectrum is drawn downward in red. Each side can be pinned
independently: new selections replace the unpinned side, and neither side
changes while both are pinned. The lower spectrum can also be removed. While
comparing, similarity is calculated automatically with a selectable dot
product, reverse dot product, modified dot product, or BONANZA score. Fragment
matching tolerance is editable in Da, in ppm (of the mean m/z of two peaks),
or as Da or ppm (± ~ Da or ± ~ ppm; a peak matches within either). The
defaults are Da or ppm with ±0.01 Da and ±10 ppm; switching the unit keeps both values (the
initial method, unit, and tolerances are the
The spectrum, the peak table, and the folded Metadata fill the panel. Drag the bar between the spectrum and the peak table (or focus it and use the arrow keys; double-click resets) to give either more room; the split is remembered for single spectra and comparisons separately. In a narrow panel the table moves below the spectrum and the bar resizes their heights. When Metadata is open, the bar above it resizes its height the same way (the size is remembered). The metadata area below the plot shows separate Upper Metadata and Lower Metadata panels during comparison, using the columns from each spectrum's source dataset. Drag horizontally to zoom m/z only, vertically to zoom intensity only, or diagonally to zoom both axes. Choose Export image..., select the elements to include, set any output width and height in pixels, and save the visible plot as a transparent PNG or SVG. The requested dimensions are filled even when their aspect ratio differs from the plot. Copy PNG and Copy SVG copy the current preview to the clipboard. Tick grid lines are excluded by default. Plot geometry follows the requested aspect ratio, while axis, tick, and peak-label text keeps its original size and character proportions. The exported image uses the current zoom range and leaves 10% intensity headroom so labels above maximum-intensity peaks remain readable. When both kinds of tick numbers are disabled, export compacts the axis-title spacing and unused margins. Click empty plot space to clear peak selection; double-click the plot to reset both zoom axes. Use Copy TSV or Copy CSV above the peak table to copy its complete,
unrounded values. Save… first asks for TSV or CSV and then opens the file
save dialog. A single spectrum has Opening normally detects MSDS, MSP, or MGF from the extension. TSV and CSV are intentionally not registered as custom-editor file extensions. To open one as a spectrum table, right-click a file in Explorer and choose MS Entity: Open as..., then select msds, msp, mgf, tsv, or csv. The same command is available in the Command Palette. Dataset Export... first asks for MSDS, MSP, MGF, TSV, or CSV and then for the save location; the chosen format takes precedence and its extension is applied automatically. The exported dataset contains the currently selected columns in their displayed order and the rows in their current filtered and sorted order. Set Calculate similarity and run a library searchClick Calculate similarity in More ... to open one form with every
choice: Library search or Match by metadata key, the datasets, one or
more methods, and the parameters. A preview below the form summarizes the
calculation — the datasets and their spectrum counts, the number of pairs, the
score rule, and what is saved — and updates as you edit; a problem with the
choices is shown there and disables Calculate and save…, which then asks
where to save the result as Library search defaults to Require matching precursor m/z. Both spectra
need the same positive precursor m/z to become a candidate pair. Use
Precursor m/z to select a column or use automatic detection. The Da/ppm
tolerances apply to fragment peaks. Clear the checkbox to compare all pairs.
The reference can be an entry already loaded
with Add dataset…, or an MSDS, MSP, MGF, TSV, or CSV file chosen with
File… / Browse… for that calculation. Choose one or more methods —
cosine, reverse cosine, modified cosine, BONANZA; the result has one score
column per method, and a library search keeps a pair when any method reaches
the threshold. Modified cosine and BONANZA also match peaks shifted by the
precursor m/z difference and need the precursor m/z of both spectra (a
Precursor m/z column, or detected from PrecursorMZ, precursor_mz, PEPMASS,
ParentMZ); pairs without one get an empty cell for those two methods. Choose
the score threshold (default Metadata-key matching selects two loaded datasets and a key column for each side. Non-missing keys must be unique within each dataset. Duplicate values produce an error because they create one-to-many or many-to-many pairings. Missing keys and keys present on only one side are skipped. Both modes use the entire loaded datasets, including unsaved SpecID edits; table filters do not restrict calculation. Tick Include matched spectra and metadata to make the result self-contained, or clear it to save only indices, scores, and calculation metadata. Embedded results store each unique matched record once and refer to it by number from every result row, so one spectrum matching many candidates does not duplicate its metadata or peaks. The
The result opens independently of the source files. The file format is
specified in msentity-similarity's
Edit metadata and remove added datasetsClick Metadata… to view and edit the active dataset's description, attributes (name/value pairs), and tags (one per line). Apply updates the loaded dataset; Cancel discards the form draft. Attribute names must be nonempty and unique. Double-click a spectrum metadata cell, or focus it and press Enter, to edit its value. Numeric cells require finite numbers; boolean cells accept true or false. Editing targets the original spectrum even after filtering, sorting, or paging. Use Export… to save applied changes. Choose MSDS to preserve dataset description, attributes, and tags. Export still respects filters and visible columns; clear filters and select all columns to save the entire dataset. The Modified indicator records changes since loading and stays visible after export because an export may contain only a subset. Reload or closing the viewer discards changes that have not been exported. Select a dataset added with Add dataset…, then click Remove dataset. After confirmation it is removed from this viewer and from similarity choices; its file stays on disk. The viewer returns to the original dataset and clears the spectrum panel. The original dataset is removed by closing its editor tab. Add metadata and peak annotation columnsOpen Columns in the dataset table and click +. Enter a column name and an optional initial value in the same form, then click Add. The initial value defaults to an empty string. The new column is visible immediately and applies to all spectra in the selected dataset, including rows outside the current filter or page. Existing columns cannot be overwritten by adding a column. The spectrum panel's Peaks table displays stored peak annotation columns beside m/z and intensity. The Columns button sits in the spectrum header next to Export image…. Toggle annotation columns and use the arrow buttons to change their order. All columns selects or clears annotation columns. m/z and Intensity remain visible as the first two columns and are not listed in this menu. Display settings are remembered per dataset while the panel is open, and column changes preserve zoom, peak selection, and sorting. Click + inside this menu to reveal the column-name and initial-value form. In a comparison, choose Upper or Lower to select the dataset to modify. A new peak annotation column applies to all peaks in that dataset; its default value is blank. Double-click an annotation cell, or focus it and press Enter, to edit that peak. Annotation values follow their original peaks when the table is sorted or two spectra are aligned. Copy/Save TSV and CSV follow the visible column selection and order. Embedded similarity results display saved annotations as read-only. Use dataset Export… → MSDS to persist peak annotations with the dataset. The dataset's MGF/TSV/CSV export formats do not preserve these added peak annotation columns. MSDS also preserves columns whose values are all blank. Assign SpecIDClick Assign SpecID… and enter a prefix (or leave it empty). IDs start at 1
and are zero-padded to the largest number: 12 spectra with prefix The table refreshes after assignment. Use Export… with the SpecID column selected to save the changes. Export respects current filters and visible columns; clear filters to export all spectra. Reload or closing the viewer discards assignments that have not been exported. Settings
MoreImage export Advanced settings include upper/lower peak colors, m/z range, separate upper/lower intensity ranges, peak line width, and peak label size, color, decimal places, and top K by intensity per spectrum. Blank ranges follow the current view; 0 for top K labels all visible peaks. Enable m/z above peaks to show labels. Settings persist across spectrum selections and webview restoration, and apply to preview, PNG/SVG saves, and clipboard copies. Use Reset export defaults in Advanced to reset all image export options, including dimensions and visibility toggles. Axis ranges are displayed as minimum ~ maximum. The dataset dropdown contains compact Add dataset and Remove dataset icon buttons above the dataset list. You can also drop one or more MSDS, MSP, MGF, TSV, or CSV files anywhere in the Dataset Viewer to add them. Files dropped from the OS are imported as temporary copies when no workspace path is available; these copies are removed when the viewer closes. Any dataset, including the first one opened, can be removed from the viewer. Removing the active dataset selects a remaining dataset. Removing the last dataset shows an empty view where Add dataset and file drops remain available. Removal does not delete the source file. Adding the same file again creates an independent dataset loaded from its current on-disk contents. In-memory edits to an existing dataset are preserved. Datasets with matching filenames receive unique display names such as The toolbar provides Reload, Filter, and Export directly. More ... contains Metadata, Columns, Assign SpecID, and Calculate similarity. Press Ctrl+S while the Dataset Viewer is focused to open the same Export flow. Logs of the backend: MS Entity: Show Spectrum Viewer Logs. RDKit is distributed under the BSD-3-Clause license; see SupportReport problems and request changes on GitHub Issues. Include the extension version, operating system, and file format. |


