spacr.qt.widgets.gene_tile¶
The tile that appears when a gene is clicked in the interactive regression.
A thin renderer: 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 thekey_selectedsignal they both emit.GeneTilePanel.to_pixmap()— the same record rendered to aQPixmap, so the tile can go into the figure grid as “the same pressable tile every figure is, holding text instead of a plot” without_FigureCellhandling 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¶
The record for 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.QWidgetThe record for 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.
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.
- 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;
Nonebuilds tiles without a results frame.
- show_feature(key: str) None[source]¶
Build and show the tile for one clicked feature.
key_selectedconnects to this slot. Takes the feature string and nothing else, so the volcano and the results table reach it identically.A failure here is reported in the tile and not raised, so the plot is unaffected.
- Parameters:
key – the clicked feature, a regression model term such as
fraction:grna[239740_3], passed tospacr.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 tile: spacr.gene_tile.GeneTile | None[source]¶
The record currently shown, or
Nonebefore the first click.