spacr.qt.widgets.gene_tile

The tile that appears when a gene is clicked in the interactive regression.

A thin renderer, deliberately: everything that can be wrong about which gene a dot names lives in spacr.gene_tile, which is a pure function over the feature string and the results frame and is tested without a window. This module lays that record out and opens the links.

There are two entry points:

  • GeneTilePanel — a widget to sit beside the volcano and the results table, wired to the key_selected signal they both emit.

  • GeneTilePanel.to_pixmap() — the same record rendered to a QPixmap, so the tile can go into the figure grid as “the same pressable tile every figure is, holding text instead of a plot” WITHOUT _FigureCell learning about text. The grid takes pixmaps; this gives it one.

The links are opened on click and never followed on render. Building a ToxoDB URL is string formatting; a tile that fetched it would put a network round trip inside a mouse click.

Classes

GeneTilePanel

Everything spaCR knows about the clicked gene, laid out.

Module Contents

class spacr.qt.widgets.gene_tile.GeneTilePanel(frame_provider: Callable[[], object] | None = None, parent=None)[source]

Bases: PySide6.QtWidgets.QWidget

Everything spaCR knows about the clicked gene, laid out.

Parameters:
  • frame_provider – called with no arguments to get the current results frame. A callable rather than a stored frame so the panel cannot go on answering from the previous regression after a new one is loaded — which is the bug shape this whole cluster keeps producing.

  • parent – the usual.

Build the gene record panel.

Parameters:
  • frame_provider – called for the coefficient table the record’s numbers come from.

  • parent – parent widget, or None.

clear() → None[source]

Back to the waiting state, which says it is waiting.

retranslate_dynamic_content(language: str | None = None) → None[source]

Refresh the structured tile after the application language changes.

set_frame_provider(provider: Callable[[], object] | None) → None[source]

Point the panel at where the current results frame lives.

Parameters:

provider – zero-argument callable returning the current regression results frame, called each time a feature is shown; None builds tiles without a results frame.

show_feature(key: str) → None[source]

Build and show the tile for one clicked feature.

THE SLOT TO CONNECT key_selected TO. Takes the feature string and nothing else, so the volcano and the results table reach it identically.

A failure here must not take the plot down with it: a tile is an explanation, and an explanation that raises leaves the user with a traceback instead of the point they clicked.

Parameters:

key – the clicked feature, a regression model term such as fraction:grna[239740_3], passed to spacr.gene_tile.gene_tile().

to_pixmap(width: int = TILE_WIDTH) → PySide6.QtGui.QPixmap[source]

The current tile as a QPixmap, for the figure grid.

The grid’s cells take a pixmap and size themselves from its aspect ratio. Rendering the text to one lets the gene tile be a tile in that grid without the grid growing a second kind of cell.

property feature: str[source]

The feature string the current tile was built from.

property tile: spacr.gene_tile.GeneTile | None[source]

The record currently shown, or None before the first click.