spacr.figures.sheet

Lay out the regression results as one multi-panel figure.

The sheet is laid out like a journal figure: 6-12 panels, bold upper-case letters top-left, reading order matching the argument, related panels adjacent and sharing scales, and more white space between groups than within them.

The panel order is fixed and follows the reading order:

A volcano what the screen found B strongest effects which genes, and how sure C effect distribution what the effects look like as a whole D control separation whether the assay worked at all E guide agreement whether the calls are corroborated F p-value distribution whether the correction means anything G q-q whether the model was entitled to say it

Panels A and B give the result; panels C to G show whether it can be trusted.

Classes

Sheet

A rendered sheet and everything needed to write its legend.

Functions

attach(→ None)

Attach a panel's name, data and groups to its figure.

build_panel(key, frame, *[, target, figsize])

One panel on its own figure, for the grid view and for saving.

build_sheet(→ Sheet)

Draw every panel this table supports, as one figure.

Module Contents

class spacr.figures.sheet.Sheet[source]

A rendered sheet and everything needed to write its legend.

Parameters:
  • figure – Matplotlib figure containing the rendered multi-panel grid.

  • panels – successfully rendered panel records in figure-reading order; their sequence supplies legend letters and captions.

  • skipped – panel records omitted from the grid, retaining their titles and failure reasons for the legend.

legend() → str[source]

The figure legend, panel by panel.

Generated from the panels themselves, so it matches the drawn figure.

spacr.figures.sheet.attach(figure, panel) → None[source]

Attach a panel’s name, data and groups to its figure.

The figure carries them because the export sees only the figure. A user right-clicks a picture in the queue and asks to save it; nothing at that point knows which frame it came from or what was compared, unless the figure itself does.

Private attributes on a matplotlib Figure rather than a wrapper object, because the figure is handed through the Qt bridge, the queue, a spill file and back, and a wrapper would be lost at the first of those.

Parameters:
  • figure – Matplotlib figure that will carry the export metadata.

  • panel – panel metadata to attach; None leaves the figure unchanged.

spacr.figures.sheet.build_panel(key: str, frame, *, target: str | None = None, figsize=(3.4, 2.6), **kwargs)[source]

One panel on its own figure, for the grid view and for saving.

Parameters:
  • key – panel name from spacr.figures.panels.REGISTRY.

  • frame – coefficient table consumed by the selected panel.

Returns:

(figure, Panel).

spacr.figures.sheet.build_sheet(frame, *, width: str = 'double', target: str | None = None, order: Sequence[str] = SHEET_ORDER, alpha: float = 0.05, effect_threshold: float | None = None, highlight: str | None = None) → Sheet[source]

Draw every panel this table supports, as one figure.

Parameters:
  • frame – the coefficient table.

  • width – 'single', 'double' or 'full'.

  • target – 'screen' or 'print'; defaults to the user’s own figure preference.

  • highlight – a gene to ring on the volcano, so the sheet can follow the selection in the GUI.

Returns:

a Sheet.

Panels whose data is absent are skipped and listed with the reason, never drawn as an empty frame.