spacr.localisation¶
Protein-localization metadata for compartment-aware figure colouring.
Interactive volcano plots can highlight genes from one selected LOPIT compartment while leaving the remaining genes grey.
Figures highlight one selected compartment against grey to keep the comparison
legible. Coefficient feature names are resolved to bare gene identifiers with
spacr.hits.gene_of() before joining the bundled TAGM/LOPIT table.
Functions¶
|
A boolean Series: which rows are in |
|
The compartment of each row of |
|
The compartments this screen actually has, commonest first. |
|
|
Module Contents¶
- spacr.localisation.mask(frame, compartment: str | None, *, key_column: str = 'feature')[source]¶
A boolean Series: which rows are in
compartment.- Parameters:
frame – table whose feature names are classified and whose index is preserved on the returned boolean Series.
compartment –
Noneor""selects nothing, so a caller can pass the menu’s state straight through without a branch.
- spacr.localisation.of(frame, *, key_column: str = 'feature')[source]¶
The compartment of each row of
frame, as a Series aligned to it.- Parameters:
frame – result frame whose feature identifiers are to be looked up.
- Returns:
a pandas Series of compartment names, empty string where the gene is not in the table.
Joined through
spacr.hits.gene_of(), which maps design terms to gene ids. Both the per-gene and the per-guide rows resolve; a guide row takes its gene’s compartment.
- spacr.localisation.present(frame, *, key_column: str = 'feature', minimum: int = MIN_GENES) List[str][source]¶
The compartments this screen actually has, commonest first.
- Parameters:
frame – result frame whose represented compartments are to be counted.
Only compartments present in the screen are returned, not all 27 in the reference table, so a menu built from them offers no choice that colours nothing.
- spacr.localisation.table() Dict[str, str][source]¶
{gene number: compartment}from the bundled TAGM/LOPIT table.Cached: the file is 3,832 rows and is read to build a right-click menu, which happens on the GUI thread every time the user opens one.
- Returns:
an empty dict when the table is missing, never raising – a screen of a different organism has no reason to carry this file.