goatpy.analysis_gui

Attributes

PALETTE

CONTINUOUS_CMAPS

CATEGORICAL_CMAPS

BASE_STYLE

GLYCAN_LAYER_NAME

GOATPY_VIZ_KEY

Classes

MplCanvas

The canvas the figure renders into.

SpectrumWidget

Interactive spectrum panel — full imzML background + clickable peaks.

GlycanSelectionDialog

Popup to choose glycans for heatmap plotting via select, type, or upload.

AnalysisSidebar

Right-dock panel.

Functions

launch_goatpy_gui(→ napari.Viewer)

Module Contents

goatpy.analysis_gui.PALETTE[source]
goatpy.analysis_gui.CONTINUOUS_CMAPS = ['inferno', 'magma', 'plasma', 'viridis', 'hot', 'RdBu_r', 'coolwarm', 'turbo', 'gray'][source]
goatpy.analysis_gui.CATEGORICAL_CMAPS = ['tab10', 'tab20', 'Set1', 'Set2', 'Set3', 'Paired', 'hsv', 'Pastel1'][source]
goatpy.analysis_gui.BASE_STYLE = Multiline-String[source]
Show Value
"""
    QWidget {
        background-color: #1e1e2e;
        color: #cdd6f4;
        font-family: 'Segoe UI', 'SF Pro Display', sans-serif;
        font-size: 11px;
    }
    QGroupBox {
        background-color: #2a2a3e;
        border: 1px solid #3d3d5c;
        border-radius: 6px;
        margin-top: 8px;
        padding-top: 8px;
        font-weight: bold;
    }
    QGroupBox::title {
        subcontrol-origin: margin;
        left: 8px;
        padding: 0 4px;
        color: #7c6af7;
    }
    QComboBox {
        background-color: #2a2a3e;
        border: 1px solid #3d3d5c;
        border-radius: 4px;
        padding: 4px 8px;
        color: #cdd6f4;
    }
    QComboBox::drop-down { border: none; }
    QComboBox QAbstractItemView {
        background-color: #2a2a3e;
        color: #cdd6f4;
        selection-background-color: #7c6af7;
    }
    QPushButton {
        background-color: #7c6af7;
        color: white;
        border: none;
        border-radius: 4px;
        padding: 6px 12px;
        font-weight: bold;
    }
    QPushButton:hover { background-color: #9b8df8; }
    QPushButton:pressed { background-color: #5d4ed6; }
    QPushButton:disabled {
        background-color: #3d3d5c;
        color: #6c7086;
    }
    QLabel { color: #cdd6f4; }
    QTabWidget::pane {
        border: 1px solid #3d3d5c;
        background-color: #2a2a3e;
        border-radius: 4px;
    }
    QTabBar::tab {
        background-color: #1e1e2e;
        color: #6c7086;
        padding: 6px 14px;
        border: 1px solid #3d3d5c;
        border-bottom: none;
        border-top-left-radius: 4px;
        border-top-right-radius: 4px;
    }
    QTabBar::tab:selected {
        background-color: #2a2a3e;
        color: #cdd6f4;
    }
    QCheckBox { color: #cdd6f4; spacing: 6px; }
    QScrollArea { border: none; background-color: transparent; }
    QSpinBox, QDoubleSpinBox {
        background-color: #2a2a3e;
        border: 1px solid #3d3d5c;
        border-radius: 4px;
        padding: 3px 6px;
        color: #cdd6f4;
    }
    QProgressBar {
        background-color: #2a2a3e;
        border: 1px solid #3d3d5c;
        border-radius: 3px;
        text-align: center;
        color: #cdd6f4;
    }
    QProgressBar::chunk {
        background-color: #7c6af7;
        border-radius: 3px;
    }
"""
goatpy.analysis_gui.GLYCAN_LAYER_NAME = 'glycan_ion_map'[source]
goatpy.analysis_gui.GOATPY_VIZ_KEY = '_goatpy_viz'[source]
class goatpy.analysis_gui.MplCanvas(parent=None, width=8, height=3, dpi=90)[source]

Bases: matplotlib.backends.backend_qt5agg.FigureCanvasQTAgg

The canvas the figure renders into.

figure[source]

A high-level figure instance.

Type:

~matplotlib.figure.Figure

fig[source]
class goatpy.analysis_gui.SpectrumWidget(sdata: spatialdata.SpatialData, peaks: list[float], glycan_df: pandas.DataFrame | None = None, table_name: str = 'maldi_adata', applied_tolerance: float = 0.1, parent=None)[source]

Bases: qtpy.QtWidgets.QWidget

Interactive spectrum panel — full imzML background + clickable peaks.

peak_clicked[source]
unregistered_peak_display[source]
sdata[source]
peaks[source]
glycan_df = None[source]
table_name = 'maldi_adata'[source]
applied_tolerance: float = 0.1[source]
highlighted_mz: float | None = None[source]
highlighted_label: str = ''[source]
peak_list: list[float][source]
highlight_glycan(mz: float, label: str, tol: float = 0.15)[source]

Highlight a glycan in the spectrum and scroll it into view.

clear_highlight()[source]
class goatpy.analysis_gui.GlycanSelectionDialog(glycan_names: list[str], peaks: list[float], label_to_mz: dict[str, float], parent=None)[source]

Bases: qtpy.QtWidgets.QDialog

Popup to choose glycans for heatmap plotting via select, type, or upload.

glycan_names[source]
peaks[source]
label_to_mz[source]
selected_indices: list[int] = [][source]
tabs[source]
glycan_list[source]
type_edit[source]
upload_lbl[source]
summary_lbl[source]
keyPressEvent(event)[source]
class goatpy.analysis_gui.AnalysisSidebar(sdata: spatialdata.SpatialData, peaks: list[float], viewer: napari.Viewer, glycan_df: pandas.DataFrame | None = None, table_name: str = 'maldi_adata', parent=None)[source]

Bases: qtpy.QtWidgets.QWidget

Right-dock panel. Glycan tab: selector + Violin/Box/Histogram (no spatial scatter — that is now rendered on the napari viewer directly).

glycan_selected[source]
sdata[source]
peaks[source]
viewer[source]
glycan_df = None[source]
table_name = 'maldi_adata'[source]
hmap_custom_indices: list[int] | None = None[source]
display_unregistered_ion_image(mz: float, tol: float)[source]

Compute per-pixel intensities for an arbitrary m/z (+/- tol) from the raw imzML and render them on the ‘pixels’ Shapes layer, exactly like the curated glycan ion maps (guarantees H&E alignment).

select_peak_from_spectrum(mz: float, label: str)[source]

Called when the user clicks a peak in the spectrum widget.

save_to_sdata(layers: list[Layer] | None = None, spatial_element_name: str | None = None, table_name: str | None = None, table_columns: list[str] | None = None, overwrite: bool = False) None[source]

Add the current selected napari layer(s) to the SpatialData object.

If the layer is newly added and not yet linked with a spatialdata object it will be automatically linked if only 1 spatialdata object is being visualized in the viewer.

Notes

Usage:

  • you can invoke this function by pressing Shift+E;

  • the selected layer (needs to be exactly one) will be saved;

  • if more than one SpatialData object is being shown with napari, before saving the layer you need to link it to a layer with a SpatialData object. This can be done by selecting both layers and pressing Shift+L.

  • Currently images and labels are not supported.

  • Currently updating existing elements is not supported.

goatpy.analysis_gui.launch_goatpy_gui(sdata: spatialdata.SpatialData, peaks: list[float] | None = None, glycan_csv: str | None = None, table_name: str = 'maldi_adata', viewer: napari.Viewer | None = None, applied_tolerance: float = 0.1) napari.Viewer[source]