spacr.qt.ops_stitch_demo

Test data for OPS and for Align & Stitch, one button away in each.

OPS uses a small sample of an optical pooled screen, and Align & Stitch uses a small segment of the same OPS data.

TWO SAMPLES OF ONE PUBLISHED SCREEN. Both are cut from plate 20200202_6W-LaC024A, well A1, of Funk et al. 2022 (BioImage Archive S-BIAD394), unmodified:

  • STITCH_EXAMPLE_REPO – nine cycle-1 tiles, a 3 x 3 block from the middle of the well, acquired in snake-column order with 213 px of overlap. Align & Stitch plans and writes it as it comes.

  • OPS_EXAMPLE_REPO – sites 331 and 332, every one of the eleven sequencing cycles, and the guide library’s 11-base prefixes. The OPS engine stitches, segments and decodes them.

WHY THE OPS SAMPLE IS THE WELL’S LAST TWO SITES. The engine takes a well’s field count as its highest site number plus one and fits the round well to that count, so a sample has to include the last site to keep the measured 333-field layout; see spacr.ops_engine.run_ops(). And it carries no phenotype images, because the phenotype phase aligns anchors spread over the whole well, which a two-field sample cannot supply.

THE SAME PATTERN AS EVERY OTHER EXAMPLE SET. One uncompressed .tar per repository, streamed behind the shared progress dialog and unpacked through the tar data filter by spacr.qt.hf_download._TarExampleWorker, into a folder of its own beside the shared example plate (example_folder()). A cached copy is used without a request.

WHAT “FILLS THE SETTINGS” MEANS HERE. The OPS panel gets its source, output folder, library and plate name; Align & Stitch gets its tile folder, the block’s 3 x 3 grid, its order, its overlap and a place to write. Run – or Plan – is then the next action.

Functions

example_folder(→ pathlib.Path)

Where the "ops" or "stitch" sample is unpacked and cached.

install_align_button(→ PySide6.QtWidgets.QPushButton)

Build Align & Stitch's "Load test data…" button, wired to screen.

is_present(→ bool)

Whether a complete copy of a sample is unpacked in folder.

listed_files(→ List[str])

Every file the sample's manifest says a complete copy holds.

load_align_test_data(→ bool)

Fill Align & Stitch with the stitch sample, fetching it when needed.

load_the_test_data(→ bool)

Put a sample in place, downloading it first when it is not cached.

ops_settings_for(→ Dict[str, object])

The OPS settings that run the unpacked sample.

stitch_settings_for(→ Dict[str, object])

The Align & Stitch settings that plan and write the unpacked block.

Module Contents

spacr.qt.ops_stitch_demo.example_folder(which: str) → pathlib.Path[source]

Where the "ops" or "stitch" sample is unpacked and cached.

Parameters:

which – "ops" or "stitch".

Returns:

the folder, beside the shared example plate. Not created here.

spacr.qt.ops_stitch_demo.install_align_button(screen) → PySide6.QtWidgets.QPushButton[source]

Build Align & Stitch’s “Load test data…” button, wired to screen.

Parameters:

screen – the spacr.qt.screens.align.AlignScreen. The button is kept on it as _btn_test_data.

Returns:

the button, for the caller to place.

spacr.qt.ops_stitch_demo.is_present(folder) → bool[source]

Whether a complete copy of a sample is unpacked in folder.

Parameters:

folder – where the sample is expected.

Returns:

True only when the manifest exists and every file it lists is there. A half-unpacked sample reads as absent, which is the answer that gets it downloaded again.

spacr.qt.ops_stitch_demo.listed_files(folder) → List[str][source]

Every file the sample’s manifest says a complete copy holds.

Parameters:

folder – where the sample was unpacked.

Returns:

paths relative to folder; empty when there is no readable manifest or a row names no file, so that an unrecognised folder is never mistaken for the sample.

spacr.qt.ops_stitch_demo.load_align_test_data(screen, *, ask=None, folder=None) → bool[source]

Fill Align & Stitch with the stitch sample, fetching it when needed.

Parameters:
  • screen – the Align & Stitch screen.

  • ask – replaces the downloader, for tests.

  • folder – replaces example_folder(), for tests.

Returns:

see load_the_test_data().

spacr.qt.ops_stitch_demo.load_the_test_data(which: str, *, use: Callable[[pathlib.Path], object], report: Callable[[str, bool], None], button: PySide6.QtWidgets.QPushButton | None = None, parent=None, ask=None, folder=None) → bool[source]

Put a sample in place, downloading it first when it is not cached.

Parameters:
  • which – "ops" or "stitch".

  • use – called with the folder once a complete copy is there; it fills the screen’s settings.

  • report – called as report(text, is_error) with what happened.

  • button – disabled while a download runs, and relabelled.

  • parent – the widget the progress dialog belongs to.

  • ask – replaces the downloader, for tests; called as ask(parent, folder, on_done).

  • folder – replaces example_folder(), for tests.

Returns:

whether the sample was put in place by this call. False while a download is still running, and after a failure.

spacr.qt.ops_stitch_demo.ops_settings_for(folder) → Dict[str, object][source]

The OPS settings that run the unpacked sample.

Parameters:

folder – where the OPS sample was unpacked.

Returns:

the source, the output folder, the library and the plate. The output goes to ops_output inside the sample rather than into the source, which would mix the tables with the tiles.

spacr.qt.ops_stitch_demo.stitch_settings_for(folder) → Dict[str, object][source]

The Align & Stitch settings that plan and write the unpacked block.

Parameters:

folder – where the stitch sample was unpacked.

Returns:

a spacr.align.default_settings()-shaped partial dict.

Nested helpers

_download.run(parent, dest, on_done) → None

Start the download behind the shared progress dialog.

spacr/qt/ops_stitch_demo.py:195

load_align_test_data.report(text: str, error: bool) → None

Show progress and failures on the screen’s status line.

spacr/qt/ops_stitch_demo.py:295

load_align_test_data.use(where: Path) → None

Apply the sample’s settings and say what to press next.

spacr/qt/ops_stitch_demo.py:288

load_the_test_data._done(result, error) → None

Put the button back, then use the data or say why not.

spacr/qt/ops_stitch_demo.py:232