Skip to content

Table Explorer Schema-Driven Behavior

The table inspector in emzed_gui is not a generic grid only. Parts of the UI and several actions are enabled based on column groups present in the table.

The relevant implementation is in src/emzed_gui/table_explorer.

Core Rule

Feature detection is based on complete column groups, not on single columns in isolation.

The helper supported_postfixes() accepts both:

  • base names like peakmap, mzmin, mzmax, rtmin, rtmax
  • repeated groups with a shared postfix like peakmap__0, mzmin__0, mzmax__0, rtmin__0, rtmax__0

This means one row can expose multiple logical peak or chromatogram datasets.

Column Groups And Enabled Behavior

Peak / EIC plotting

Required column group:

  • peakmap
  • mzmin
  • mzmax
  • rtmin
  • rtmax

Code:

Effect:

  • shows the EIC plot
  • shows the m/z plot
  • enables peak visualization for selected rows
  • exposes peakmap... entries in the postfix chooser

Spectra

Detected by columns whose name starts with spectra, especially spectra_ms2 with optional postfixes.

Code:

Effect:

  • shows the spectra chooser
  • adds row-dependent MS2 spectra entries
  • lets the m/z plot display selected spectra directly

Chromatograms

Raw chromatogram data is represented by:

  • chromatogram

with optional postfixes.

Code:

Intended effect:

  • chromatogram traces can be plotted
  • chromatogram... entries appear in the chooser
  • chromatogram-only tables should activate chromatogram-only mode

Integration result columns

Peak integration result columns:

  • area
  • rmse
  • peak_shape_model
  • model
  • valid_model

Chromatogram integration result columns:

  • area_chromatogram
  • rmse_chromatogram
  • peak_shape_model_chromatogram
  • model_chromatogram
  • valid_model_chromatogram

Code:

Effect:

  • enables the integration widget when the table model is mutable and the required integration schema is present
  • exposes integration targets like peakmap__x or chromatogram__x
  • writes integration results back into the corresponding column group

Color

Optional column:

  • color

Code:

Effect:

  • enables row or per-cell background coloring

Nested inspectors

If a cell contains nested Table or PeakMap values, the explorer treats those cells specially.

Code:

Effect:

  • those cells are marked non-editable
  • double-click opens a nested inspector
  • for PeakMap cells, the initial inspection window is derived from matching rtmin, rtmax, mzmin, mzmax columns sharing the same postfix

Other Schema-Dependent UI

Some controls are not tied to semantic names like peakmap, but still depend on the visible column schema:

Current Known Issue

Chromatogram detection is currently inconsistent.

has_chromatograms() does not check for raw chromatogram columns. It checks only for chromatogram integration result columns such as area_chromatogram, rmse_chromatogram, model_chromatogram, and related fields.

This means a table that contains chromatogram data but not the corresponding integration result columns may fail to activate the expected chromatogram UI in setup_model_dependent_look().

There is a related issue in has_peakshape_model(): the chromatogram branch checks chromatogram integration columns twice instead of checking both raw chromatogram data and integration-result columns.

Suggested Documentation Contract

If this behavior is documented for users or plugin authors, the most accurate contract is:

  • table explorer capabilities are enabled by recognized column groups
  • those groups may appear once or multiple times with shared __postfix suffixes
  • peak, spectra, chromatogram, and integration functionality are independent schema layers
  • current chromatogram feature detection has a known mismatch between raw data columns and integration-result columns