spacr.umap_annotations

Transactional database writes for interactive Image UMAP selections.

Functions

write_umap_annotations(→ Tuple[int, int])

Write one integer value per UMAP record into png_list.

Module Contents

spacr.umap_annotations.write_umap_annotations(records: Sequence[Mapping], values: Iterable[int], column: str) → Tuple[int, int][source]

Write one integer value per UMAP record into png_list.

Parameters:
  • records – rows carrying db_path and original db_png_path.

  • values – integer annotations aligned one-to-one with records.

  • column – annotation column to add or update in png_list.

Records are grouped by database so a multi-plate embedding commits once per file. The original png_path value from the database is the update key; corrected/display paths are deliberately not used.

Returns:

(rows_updated, records_skipped).

Raises:

ValueError – when records and values differ in length or column is not a valid SQLite identifier.