spacr.qt.screens.lineage¶
Workflow inputs and outputs¶
Lineage¶
Inspect recorded cell/nucleus/pathogen/organelle containment links; this is object containment, not time-series lineage inference.
Open: Help search → Database Browser → Lineage.
Inputs and outputs below include conditional alternatives. The guidance and handoff notes say which route applies.
Inputs
Measured objects — measurements/measurements.db; object tables depend on the enabled cell, nucleus, pathogen and organelle masks. Relevant tables, depending on the route:
cell,nucleus,pathogen,cytoplasm. Relevant columns, depending on the route:plateID,rowID,columnID,fieldID.
Outputs
Figures and table exports — The output location chosen by the tool; exports describe the selected data and filters.
Lineage screen: the containment tree of cells, nuclei and pathogens.
In measurements.db, nucleus and pathogen rows carry a cell_id
naming the cell they sit inside (spacr.schema.CHILD_OBJECT_TABLES).
This screen shows those links as a tree, so questions such as which cells are
uninfected, which pathogen is implausibly large for the cell around it, and
which nucleus belongs to no cell at all can be answered by inspection.
spacr.lineage builds the tree in plain pandas. This is the tree widget
over it: a node selected here publishes through
spacr.qt.linked_selection, so picking a cell highlights the same cell
on the plate view and in the UMAP, and picking it with its contents highlights
the whole family. Double-clicking opens the crops.
Unattached children are listed separately¶
A child whose cell_id names no cell is dropped by every join in the
codebase. It is not noise: it means the nucleus mask found an object the cell
mask did not, which is a segmentation disagreement worth looking at. It gets
its own list here, with the same double-click-to-open, so these objects can be
reviewed without writing SQL.
Classes¶
The containment tree for one measurements database. |
Functions¶
|
Build the screen. The |
|
Put Lineage in the app registry. Idempotent. |
Module Contents¶
- class spacr.qt.screens.lineage.LineageScreen(parent=None, *, threaded: bool = True)[source]¶
Bases:
spacr.qt.linked_selection.LinkedView,PySide6.QtWidgets.QWidgetThe containment tree for one measurements database.
- Parameters:
threaded –
Falsereads inline, so a test drives the screen without a worker thread and gets the same calls in the same order.parent – parent widget; ownership only.
Build the screen, join the shared selection and arm its drop zone.
- Parameters:
parent – parent widget, or
None.threaded – read the database on a worker thread. Set
Falsein tests soloadfinishes before it returns.
- closeEvent(event) None[source]¶
Stop background work and unlink before going away.
- Parameters:
event – the Qt close event.
- collision_note() str[source]¶
One line naming any objects the shared key cannot tell apart.
Normally empty. The object key carries the object type, so a cell’s nucleus 1 and its pathogen 1 are two keys. The check is kept to report a regression in which keys collide again; without it, “opening four objects showed three crops” would have no explanation on screen.
- family_keys() List[str][source]¶
The selected rows and everything inside them, parents first.
De-duplicated while keeping order: selecting a cell and one of its pathogens must not open that pathogen twice.
The de-duplication is on the shared key, which is what the routing contract takes. That key carries the object type, so a cell’s nucleus 1 and pathogen 1 stay two keys; if keys ever collide, fewer keys than objects are returned and
collision_note()reports it on screen.
- on_linked_selection_changed(selection) None[source]¶
Reveal and highlight what another view selected, if the tree contains it.
- Parameters:
selection – the shared selection published by another view; its
keysare matched against the tree’s object keys, andNonekeys clear the highlight.
- publish_family() List[str][source]¶
Publish the selected objects together with everything inside them.
- set_frames(frames: Dict[str, pandas.DataFrame]) None[source]¶
Build and draw the tree from already-loaded tables.
The seam a test — or another screen holding the same frames — goes through, so nothing here needs a database to be exercised.
- Parameters:
frames –
{table name: rows}, asspacr.lineage.build_forest()takes it;Nonecounts as empty. ALineageErrorfrom building the tree is shown in the summary instead of raised.
- spacr.qt.screens.lineage.make_lineage_screen(**_kwargs) LineageScreen[source]¶
Build the screen. The
factory=forspacr.qt.app.register_app().