Skip to content
| Marketplace
Sign in
Visual Studio Code>Visualization>msentity MSMS ViewerNew to Visual Studio Code? Get it now.
msentity MSMS Viewer

msentity MSMS Viewer

Motohiro Ogawa

|
1 install
| (0) | Free
View msentity datasets (MSDS, MSP, MGF, TSV, CSV) and similarity results (.mssim) in VS Code, powered by the msentity C++ library.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

msentity Spectrum Viewer for VS Code

Inspect mass spectra, compare a query and reference spectrum side by side, and explore spectral similarity results inside desktop VS Code. Open .msds, .msp, .mgf, and .mssim files, or import spectra from TSV and CSV. The extension includes the native viewer backend.

Supported platforms: Windows x64 and Linux x64. RDKit is included for molecular structure previews and SMARTS filtering.

Quick start

Download query spectra and precomputed similarity results. These spectra are synthetic examples for trying the viewer.

  1. Open marketplace-query.msp in VS Code. Use a Spectrum button to view a record's peaks.
  2. Open marketplace-similarity.mssim. Choose Weighted entropy under Score to see its distribution for 36 saved matches.
  3. In Comparison results, use Open spectra on a row to see the query and reference peaks in a mirrored plot. Use Export… to save the comparison table as TSV or CSV.

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 (0.01 Da or 10 ppm) and intensity exponent (1), and keep Require matching precursor m/z and Include matched spectra and metadata checked.

Screenshots

MSDataset table with spectrum and structure controls

Mirrored query and reference spectra with the peak table

Cosine score distribution and the comparison results table

Features

  • Paged spectrum metadata table with reorderable columns and one reusable spectrum panel
  • Full-dataset, multi-condition filtering (text/number =, text !=, contains, >, >=, <, <=, peaks within an m/z tolerance, neutral losses) and prioritized multi-column sorting
  • Edit dataset description, attributes, tags, metadata cells, and peak annotations; add columns
  • Assign sequential SpecID values with an optional prefix
  • MSP/MGF loading progress with bytes, percentage, and spectrum count
  • Configurable MSP/MGF loading (duplicate fields, canonicalization, intensity normalization, and error logs) and TSV/CSV type inference
  • Export to MSDS, MSP, MGF, TSV, or CSV using the visible columns and current filters/sort order
  • SMARTS substructure filtering, 2D structure previews, and structure counts (RDKit, included)
  • Multiple datasets in one viewer; drag and drop files to add them
  • Mirrored two-spectrum comparison with cosine, reverse cosine, modified cosine, BONANZA, and weighted and unweighted spectral entropy scores
  • Library search and key matching saved as .mssim, with a dedicated result viewer (histogram, box plot, coverage–similarity density/scatter plot, statistics, filters)
  • Peak table copy/save as TSV or CSV; drag-to-zoom; PNG/SVG export and clipboard copy
  • VS Code light, dark, and high-contrast theme support

Install

In the Extensions view in desktop VS Code, search for motohiroogawa.msentity-msms-viewer and choose Install.

For manual installation, download the VSIX for your platform from GitHub Releases:

code --install-extension msentity-spectrum-viewer-<version>-<platform>.vsix

or use Extensions → Views and More Actions (...) → Install from VSIX.... Each package contains the viewer backend for one platform: Linux x64 (linux-x64) or Windows x64 (win32-x64). macOS is not supported.

GitHub Releases provides two VSIX variants for each platform:

File Contents
msentity-spectrum-viewer-<version>-<platform>.vsix everything, including the chemistry features (RDKit)
msentity-spectrum-viewer-no-rdkit-<version>-<platform>.vsix the same without RDKit (smaller; no SMARTS filters or structure previews)

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 msentitySpectrumViewer.structureSmilesColumn, which defaults to SMILES and matches column names case-insensitively. Known canonical and isomeric SMILES column names are used as fallbacks; without any of them the Structure column is not shown. After changing the setting, use Reload in the Viewer. The Structure column can be hidden, and the rendered SVG width and height can be adjusted in the settings (More ... → Settings).

Usage

Open an .msds, .msp, or .mgf file normally. For TSV or CSV, use MS Entity: Open as... and select tsv or csv so ordinary tabular files remain associated with VS Code's normal text editor. Click a spectrum button in the table; the reusable Mass Spectrum panel opens and updates when another record is selected. Use Add dataset… to load more files into the same dataset viewer, then switch between them with the dataset dropdown. Spectra opened from those datasets share the same Mass Spectrum panel, while datasets opened in separate VS Code tabs continue to use separate spectrum panels. Each dataset remembers its current page when you switch away and return.

Loading options

Use 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 none, so no log is created unless it is explicitly enabled.

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 SourceDataset column. It can be filtered, sorted, edited, used for similarity, exported, or merged again. Merge always uses complete registered datasets, not their displayed filter/sort views. Reload rebuilds it from snapshots captured at merge time, so removing a source entry does not invalidate it.

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 msentitySpectrumViewer.spectrumComparison settings). Intensities are raised to the editable Exponent before scoring (0.5 = square root; initially msentitySpectrumViewer.similarity.intensityExponent). Modified dot product and BONANZA also consider precursor-mass-shifted neutral-loss matches, so they need a precursor m/z on both spectra: it is read from the msentitySpectrumViewer.spectrumComparison.precursorColumn metadata column (empty by default, which detects it automatically: the first of PrecursorMZ, precursor_mz, PEPMASS, and ParentMZ with a positive number; names are case-insensitive). When either spectrum has none, both methods are disabled and the dot product is shown. The score and matched-peak count update when the method, tolerance, or unit changes. The score line is always shown; click it to open or fold the settings: the method on the first line, the tolerance on the next, then the exponent (the choice stays open across spectra).

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 m/z and Intensity columns. A comparison has separate Upper and Lower columns; peaks within the current tolerance share a row, while an unmatched peak leaves the other side empty. Ascending or descending m/z order is preserved independently on both sides. Export always includes the complete spectra, independent of the current plot zoom.

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 msentitySpectrumViewer.spectrumFloatingWindow to false if the spectrum should remain in an editor pane beside the dataset table.

Calculate similarity and run a library search

Click 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 .mssim.

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 0.8), the m/z tolerance unit — Da or ppm (default; a peak matches within either), Da, or ppm (of the mean m/z of two peaks) — with its values (default ±0.01 Da and ±10 ppm), and the intensity exponent. Each peak matches at most one peak, the closest one. The initial choices come from the msentitySpectrumViewer.similarity settings; the m/z tolerance shares toleranceUnit, toleranceDa, and tolerancePpm of msentitySpectrumViewer.spectrumComparison with the comparison view. Scores are calculated by msentity-similarity with the chosen number of threads (default 1; at most the logical cores minus one, so one core is always left free).

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 .mssim file opens in a dedicated Similarity Viewer:

  • Embedded results show Open spectra on each row to open the saved query and reference records as a mirrored spectrum comparison.
  • Filter combines score bounds with numeric and text comparisons. Choose a result column or, when spectra are embedded, a column from Query or Reference. All conditions must match.
  • Click a column heading to cycle through text ascending, text descending, and unsorted. Right-click a heading for text or numeric sorting in either direction. Adding another column sorts ties using the indicated priority. Open More → Columns to show, hide, or move columns in Comparison results. Reset columns restores the configured score order and puts the source indices at the end. Use Previous and Next to change pages.
  • Set msentitySpectrumViewer.similarity.scoreColumnOrder to choose the default order of score columns when opening a result.
  • The histogram and count/mean/Q1/median/Q3/min/max summarize all filtered rows, not just the current page. Choose 1–200 bins; click a bar or use the accessible frequency table to filter a similarity range. The final bin includes 1.0.
  • Reference index limits the view to saved matches for a single reference spectrum by its zero-based position in the input dataset (index2). Clear the field to restore the distribution of all saved matches.
  • Switch between a histogram, a line, and a box plot. Histogram counts support linear and log10 scales. With several methods, All methods draws the frequency of every score column as colored lines over the same bins, with a table of each method's statistics.
  • Score chooses the score column (one per calculated method) used by the filter, statistics, distribution, and coverage plot, and the initial method of Open spectra.
  • View → Coverage vs similarity plots each row's peak intensity coverage (the share of Σ intensity^(2α) carried by directly matched peaks, α = the intensity exponent; with α = 0.5 the share of the summed intensity) against the chosen score. For cosine, for reverse cosine against the reference's coverage, and for modified cosine against the coverage of its own pairing (direct and precursor-shifted peaks; results calculated with modified cosine have it), the bound max = √coverage is drawn as a dotted line, which √coverage line hides. BONANZA is plotted against the same coverage of its pairing, but has no such bound. Choose whose coverage is on the x axis (first/query or second/reference). Density counts rows per cell (20 columns by default; leave Y bins blank for square cells; linear or log10 color) and scales to any number of rows; Scatter draws one point per row (a random sample of 20,000 for larger results). Marginal densities adds the coverage density above the plot and the similarity density to its right. Results calculated before coverage was added have no coverage columns; recalculate them to use this view.
  • Save PNG… opens an image preview where width, height, grid visibility, histogram color, box color, and count scale can be changed before saving.
  • Export… opens export options for the filtered and sorted rows. For TSV or CSV, choose result columns, embedded query/reference metadata, and either set of peaks. Query.Peak and Reference.Peak use the same peak-cell format as MSDataset TSV and CSV, including available peak annotations. MSSIM preserves calculation metadata and the matched spectra; Parquet exports the result table.
  • Reload rereads the saved result with the current view settings. Use More → Loading options and reload to change rows per page before reloading.
  • More → Metadata lets you edit the result's description, tags, and attributes. Source details, calculation parameters, and row counts are available in the read-only Calculation metadata section. Apply changes to the open result, then export as MSSIM to save the annotations. More → Settings opens the VS Code settings for similarity.

The result opens independently of the source files. The file format is specified in msentity-similarity's docs/format/mssim.md; the same calculations are available on the command line with mssim-tool.

Edit metadata and remove added datasets

Click 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 columns

Open 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 SpecID

Click 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 SP receive SP01 through SP12. This assigns IDs to every spectrum in the active dataset in its original order, regardless of filters, sorting, or the current page. Existing SpecID values are replaced only after confirmation.

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

  • msentitySpectrumViewer.pageSize: spectra per metadata page (default: 20).
  • msentitySpectrumViewer.spectrumFloatingWindow: use a separate floating window for the spectrum (default: true).
  • msentitySpectrumViewer.structureSmilesColumn, showStructureColumn, structurePreviewWidth, structurePreviewHeight: structure previews.
  • msentitySpectrumViewer.similarity.*: defaults of Calculate similarity… — methods (["cosine"]; any of cosine, reverse_cosine, modified_cosine, bonanza, entropy, unweighted_entropy), threshold (0.8), intensityExponent (1), includeMatchedData (true), threads (1; at most the logical cores minus one, and also editable in the form). The m/z tolerance comes from the spectrumComparison.tolerance* settings below; intensityExponent is also the initial exponent when two spectra are compared.
  • msentitySpectrumViewer.spectrumComparison.method (dot, reverse, modified, bonanza, entropy, unweighted_entropy), toleranceUnit (Da or ppm, Da, or ppm), toleranceDa (0.01), tolerancePpm (10), and precursorColumn (empty to detect automatically, or the metadata column of the precursor m/z): initial score settings when two spectra are compared. toleranceUnit, toleranceDa, and tolerancePpm are also the initial m/z tolerance of Calculate similarity, and precursorColumn its precursor m/z column for modified cosine and BONANZA.

More

Image 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 sample (1).msp and sample (2).msp, including files from different directories. These names also appear in spectrum views and similarity selection.

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 THIRD-PARTY-NOTICES.txt.

Support

Report problems and request changes on GitHub Issues. Include the extension version, operating system, and file format.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft