spacr.qt.widgets.measurement_compare_dialog¶
Interactive measurement comparisons for selected cell groups.
The panel delegates grouping and data preparation to
spacr.gene_measurement_compare and statistical-test selection to
spacr.sp_stats. It can be embedded in the Cells tab or opened in a
standalone window without changing the comparison semantics.
Classes¶
The panel above, in a window. Kept so the button still opens one. |
|
Compare measurements between selected cell groups and a reference. |
Module Contents¶
- class spacr.qt.widgets.measurement_compare_dialog.MeasurementCompareDialog(objects, groups: Dict[str, Any], parent: PySide6.QtWidgets.QWidget | None = None, settings: Dict[str, Any] | None = None, databases: Any | None = None, counts: Any | None = None)[source]¶
Bases:
PySide6.QtWidgets.QDialogThe panel above, in a window. Kept so the button still opens one.
Every parameter is handed straight to
MeasurementComparePanel, which documents what each one means.- Parameters:
objects – object rows for the montage and reference contrasts.
groups – selected group names mapped to object-index values.
parent – parent widget.
settings – run settings saved alongside exported results.
databases – measurement databases available for widening the object table.
counts – per-well counts, used to resolve control wells.
Build the window around one
MeasurementComparePanel.Every argument is handed straight through; the panel documents what each one means.
- Parameters:
objects – object rows for the montage and reference contrasts.
groups – selected group names mapped to object-index values.
parent – parent widget, or
None.settings – run settings saved alongside exported results.
databases – measurement databases available for widening the object table.
counts – per-well counts, used to resolve control wells.
- cancel_the_join(*args)[source]¶
Forwarded to the panel this dialog wraps.
- Parameters:
args – passed straight through.
- Returns:
whatever
MeasurementComparePanelreturns.
- choose_wells(*args)[source]¶
Forwarded to the panel this dialog wraps.
- Parameters:
args – passed straight through.
- Returns:
whatever
MeasurementComparePanelreturns.
- comparison()[source]¶
Forwarded to the panel this dialog wraps.
- Returns:
whatever
MeasurementComparePanelanswers.
- join_the_tables(*args)[source]¶
Forwarded to the panel this dialog wraps.
- Parameters:
args – passed straight through.
- Returns:
whatever
MeasurementComparePanelreturns.
- refresh(*args)[source]¶
Forwarded to the panel this dialog wraps.
- Parameters:
args – passed straight through.
- Returns:
whatever
MeasurementComparePanelreturns.
- save_everything(folder: str = '') dict[source]¶
Forwarded to the panel this dialog wraps.
- Parameters:
folder – where to write everything.
- Returns:
whatever the panel returns.
- property contrast[source]¶
Forwarded to the panel this dialog wraps.
- Returns:
whatever
MeasurementComparePanelanswers.
- property controls[source]¶
Forwarded to the panel this dialog wraps.
- Returns:
whatever
MeasurementComparePanelanswers.
- property kind[source]¶
Forwarded to the panel this dialog wraps.
- Returns:
whatever
MeasurementComparePanelanswers.
- property level[source]¶
Forwarded to the panel this dialog wraps.
- Returns:
whatever
MeasurementComparePanelanswers.
- property measurement[source]¶
Forwarded to the panel this dialog wraps.
- Returns:
whatever the panel answers.
- property report[source]¶
Forwarded to the panel this dialog wraps.
- Returns:
whatever
MeasurementComparePanelanswers.
- class spacr.qt.widgets.measurement_compare_dialog.MeasurementComparePanel(objects, groups: Dict[str, Any], parent: PySide6.QtWidgets.QWidget | None = None, settings: Dict[str, Any] | None = None, databases: Any | None = None, counts: Any | None = None, results: Any | None = None)[source]¶
Bases:
PySide6.QtWidgets.QWidgetCompare measurements between selected cell groups and a reference.
Build the comparison panel: the pickers, the plot and the statistics.
IT OPENS ON THE TOP HITS. Decision 2026-09-25: “the regression Compare panel opens with the TOP HITS pre-selected (top significant guides/genes and the wells that carry them; user can change it)”. The regression’s results table gives the hits (
spacr.well_scope._top_hits()); without one, the guides of the montage’s own groups are the selection. The population box then starts on “gRNAs + other datapoints in selected wells”, the derived wells are shown under the controls, and “gRNAs…” / “selected wells…” change either. Nothing to select starts on “All datapoints”, so a panel with no guides still draws what it drew before.The join runs off the GUI thread. It reads every object table out of every attached database and joins them onto the crop rows – measured at 3.2 s for one plate’s 553 objects, so a four-plate screen of 60,000 is minutes with the window frozen solid, which is what “pressing join the measurements table makes spaCR unresponsive” was.
The well selection is held as
Nonefor “all of them” rather than as the full list: a well that appears after a re-run should be included, and a stored full list would silently exclude it.- Parameters:
objects – the object rows for the montage and the contrasts.
groups – selected group names mapped to object-index values.
parent – parent widget, or
None.settings – run settings, saved alongside exported results.
databases – measurement databases available for widening the object table.
counts – per-well counts, used to resolve control wells.
results – the regression’s coefficient table, as a frame or a CSV path, for the opening selection.
- cancel_the_join() bool[source]¶
Request cancellation of the active join without blocking the GUI.
- Returns:
Trueif a join was active.
- choose_wells(*_args) bool[source]¶
Open the well checklist and apply a changed selection.
- Returns:
bool –
Truewhen the accepted selection differs from the previous one;Falsewhen unavailable, cancelled, or unchanged.
- chosen_wells() list | None[source]¶
Return the included wells that remain available.
- Returns:
list of str or None – Selected wells intersected with the current inventory, or
Nonewhen all current and future wells are included.
- closeEvent(event)[source]¶
Request cancellation of active work before closing the panel.
- Parameters:
event – the close event, passed on to the base class after the join worker is asked to shut down.
- comparison()[source]¶
The last comparison computed, if any.
- Returns:
the comparison, or None before one has been run.
- join_the_tables(*_args) str[source]¶
Join attached measurement tables into the panel’s object rows.
- Returns:
str – Empty after a clean join, or a user-facing explanation when a database or object row could not be joined.
- nothing_to_compare_against() str[source]¶
Return why the selected cells have no comparison group.
An empty string means at least two classes are available. When only picked cells were loaded, the message identifies
show all in wellas the setting that adds the unpicked comparison cells.
- save_everything(folder: str = '') dict[source]¶
Write everything into one folder. Returns what was written.
- set_data(objects, groups: Dict[str, Any], settings: Dict[str, Any] | None = None)[source]¶
Point the panel at a new montage. The Graph tab calls this rather than being rebuilt, so a user’s chosen measurement and level survive a re-run.
- Parameters:
objects – the object rows for the montage and the contrasts; its numeric measurement columns fill the measurement menu, and the previous choice is kept when still offered.
groups – selected group names mapped to object-index values; copied.
- set_dependent_frame(frame) None[source]¶
Set the dependent-variable table available to the join action.
- Parameters:
frame (pandas.DataFrame) – Table containing dependent variables and object identifiers or parseable image paths.
- set_selected_guides(guides) None[source]¶
Set selected guides and derive their wells for the current scope.
- Parameters:
guides – the selected guides, stored as strings (
Nonefor none); any explicit well subset is cleared so wells are derived from them.
Nested helpers¶
- MeasurementComparePanel.join_the_tables.work()¶
Off the GUI thread. Returns, never raises: a failed join is a message in the panel, not a traceback in the console.
spacr/qt/widgets/measurement_compare_dialog.py:552