spacr.qt.widgets.sweep_panel¶
One button: every gene against every measurement.
The engine is spacr.gene_measurement_sweep; this is
the thin panel over it, and it is thin on purpose – the three corrections
that make the answer trustworthy (identifiers excluded, Benjamini-Hochberg
across the grid, circularity reported per row) live in the engine so a
settings CSV, a macro and this button cannot disagree about them.
IT RUNS OFF THE GUI THREAD, and the reason is today’s crash rather than politeness: a regression built Qt widgets on its own worker and the process segfaulted somewhere else entirely. So the worker here touches NO widget and returns plain data, and the figure is rendered by matplotlib’s Agg canvas which has no Qt object to own.
Classes¶
The button, the table, and the picture. |
Functions¶
|
|
Module Contents¶
- class spacr.qt.widgets.sweep_panel.SweepPanel(cells_provider: Callable | None = None, counts_provider: Callable | None = None, parent: PySide6.QtWidgets.QWidget | None = None, *, threaded: bool = True, scores_provider: Callable | None = None)[source]¶
Bases:
PySide6.QtWidgets.QWidgetThe button, the table, and the picture.
The providers are CALLED when a sweep runs rather than read at construction, so the panel always sweeps what is on screen now.
- Parameters:
cells_provider – called for the cell table to sweep.
counts_provider – called for the per-well counts.
parent – parent widget.
threaded – whether the sweep runs off the GUI thread. False runs it inline, which is what a test wants.
scores_provider – called for the scores, when the sweep needs them.
Build the gene-sweep panel.
- Parameters:
cells_provider – called for the per-object measurements.
counts_provider – called for the well or guide counts.
parent – parent widget, or
None.threaded – run the sweep on a worker thread. Set
Falsein tests sorunfinishes before it returns.scores_provider – called for the per-object scores. Separate from
cells_providerbecause the merged measurements frame has no prediction column – it is the measurement tables – so without this circularity comes out NaN and the panel says so rather than showing zeros.
- closeEvent(event)[source]¶
Stop background work and unlink before going away.
- Parameters:
event – the Qt close event.
- exclusions() dict[source]¶
Return active exclusion controls as
sweep()arguments.Blank controls are omitted so they mean “no filter” rather than a filter whose value matches nothing.
- figure(path: str | None = None, kind: str | None = None)[source]¶
One picture of the sweep, or
Nonewhen there is nothing to draw.- Parameters:
kind – one of
PICTURES; the chooser’s current pick by default.
- rows() pandas.DataFrame[source]¶
What the table is showing, as a frame.
- selected_gene()[source]¶
Return the selected gene or the strongest surviving gene.
Noneis returned when the table contains no suitable gene. The profile title distinguishes the automatic fallback from a row selected by the user.
- show_picture(*_args)[source]¶
Draw the chosen view in its own window. Returns the dialog, or None.
A WINDOW RATHER THAN A PANE, because the Measurements tab is already four sections in a side panel – “there are to many elements in the measurements tab” – and a heatmap of forty measurements needs more width than that column has.
- spacr.qt.widgets.sweep_panel.sweep_inputs(cells, counts, *, score_column: str = 'pred', scores=None)[source]¶
(wells, fractions, plates, scores)from a merged frame and counts.THE PLATE NAMES ARE CANONICALISED ON BOTH SIDES. A score CSV of the real screen says
pplate1where its measurements database saysplate1, so an un-canonicalised join matches no well at all – and the resulting all-NaN circularity column reads as “nothing here is circular”, which is the most confident possible way to say nothing.- Parameters:
cells – the merged per-object frame with
plateID,rowIDandcolumnID(orprc); its numeric columns are averaged per well. It is copied, not modified.counts – the per-well gRNA table with
prc,grnaandfractioncolumns, pivoted to one column per gRNA.score_column – the score column averaged per well, read from
cellsor else fromscores.scores – an optional score table used when
cellslacksscore_column.