scripts/1.process-SBS.py
Reads SBS foci from CellProfiler outputs, matches called barcodes to the library (if match_to_library is true), assigns barcodes and genes to cells, scores the quality of each cell’s assignment, and writes per-site SBS metrics.
Respects overwrite_files and can be resumed: sites whose output folder already exists are skipped when overwrite_files is false.
Inputs¶
| Input | Description |
|---|---|
{file_location}/{batch}/{plate}-{well}-{site}/Foci.csv | Foci (SBS spots) with barcode calls and Parent_{compartments[0]} |
{file_location}/{batch}/{plate}-{well}-{site}/BarcodeFoci.csv | Only when match_to_library is false; barcode matches made during image analysis |
{external_foci_location}/.../*Foci.csv, *BarcodeFoci.csv | Used instead of the above when external_foci_location is set. The Foci.csv in file_location must have the same number of rows and provides the cell parent relationship. |
library_location | Barcode library .csv; only when match_to_library is true |
summary_data/Inferred_Empty_Sites_{data_set_name}.csv | From step 0, if present; these sites are skipped |
Config used: file_location, external_foci_location, drop_barcodes, control_genes, data_sets, overwrite_files, compartments, cell_quality_method, match_to_library, library_structure, library_location (experiment); process_SBS.*, core.cell_quality_*, core.cell_id_cols (defaults). See Configuration.
Outputs¶
Per site, in SBS/{plate}-{well}-{site}/:
| Output | Description |
|---|---|
processed_SBS.tsv.gz | One row per barcode/spot assigned to a cell, with gene, barcode, match score, location, and cell quality category |
cell_perturbation_category_summary_counts.tsv | Cell counts per cell quality category per gene and guide |
site_stats.json | Per-site metrics: spots in/outside cells, unique genes and guides, assigned cells, cells with one spot, percent perfect spots, and counts per cell and spot quality category |
Per data set, in summary_data/:
| Output | Description |
|---|---|
No_SBS_Foci_Sites_{data_set_name}.csv | Sites with no foci, or no foci within parent cells |
No_Assigned_Cells_Sites_{data_set_name}.csv | Sites where no cells were assigned a barcode |
Sites listed in either file are not an error and are skipped by later steps.