torchcell.sga

A colony-fitness pipeline adapted from SGAtools for single CRISPR knockouts dispensed onto plates by an ECHO acoustic liquid handler. It reads the gitter colony-size file and the ECHO picklist (io), corrects positional plate artifacts (normalize), and scores each knockout as fitness relative to the on-plate BY4741 wild type (score). image and cellpose_seg measure colony sizes from plate photographs, and viz draws plate heatmaps and histograms. The typical call sequence is read_gitter_dat(), read_echo_picklist(), merge_layout(), normalize_plate(), then score_plate().

Classes

NormalizationConfig

Knobs for the normalization stage.

ScoreReport

Top-level result of scoring one plate against its wild-type reference.

StrainScore

Per-strain aggregate: the analog of an SGAtools combined-file row.

CellposeSegConfig

Parameters for Cellpose-SAM plate segmentation.

PlateSegResult

Return bundle for a segmented plate: the gitter-style per-well table plus plate-level counts the classical path cannot report (raw instance count and off-grid contaminant colonies).

Functions

read_gitter_dat

Read a gitter .dat into a tidy frame: row, col, size, circularity, flags.

read_echo_picklist

Read an ECHO picklist into a layout frame: row, col, strain, volume_nl, well.

merge_layout

Attach strain + volume to each quantified colony by (row, col).

well_to_rowcol

Decode a plate well label ('B2', 'AA13') to 1-indexed (row, col).

normalize_plate

Run the full normalization on one plate's merged colony table.

score_plate

Score a normalized plate table (output of normalize_plate).

score_table

Flatten a ScoreReport into a per-strain DataFrame for CSV output.

quantify_plate_image

Quantify colonies on a standardized plate image into a gitter-style table.

quantify_plate_image_cellpose

Segment a backlit plate with Cellpose-SAM and quantify colonies onto the fitted array grid.

load_cellpose_model

Load the Cellpose-SAM generalist model (cpsam).

resolve_orientation

Return (merged, best_op, agreement).

volume_assay_metrics

One row per condition (volume) with the assay-quality metrics.

volume_position_confound

Detect whether the condition variable (volume) is confounded with plate position (row/col).

recommend_volume

Pick the best volume for a fitness screen.

zfactor

Z'-factor between two colony populations (assay separation window).