scripts/2.merge-single-cells.py
Reads per-compartment morphology measurements from CellProfiler, merges the compartments into one row per cell, joins the SBS barcode and gene assignment from step 1, and keeps only cells whose quality category is in keep_cell_qualities.
This is the last step that reads from the CellProfiler output folders.
Respects overwrite_files and can be resumed.
Inputs¶
| Input | Description |
|---|---|
{file_location}/{batch}/{plate}-{well}-{site}/{compartment}.csv | One file for each of compartments |
SBS/{plate}-{well}-{site}/processed_SBS.tsv.gz | From step 1 |
summary_data/Inferred_Empty_Sites_*.csv, No_SBS_Foci_Sites_*.csv, No_Assigned_Cells_Sites_*.csv | From steps 0 and 1, if present; these sites are skipped |
Config used: data_sets, file_location, compartments, cell_quality_method, overwrite_files, keep_cell_qualities (experiment); single_cell.*, core.*, process_SBS.SBS_score_col (defaults). See Configuration.
Columns containing any flag_cols string are dropped.
Compartment columns are prefixed with the compartment name.
Cells without SBS information are given the quality Empty.
Outputs¶
| Output | Description |
|---|---|
single_cell/by_site/{plate}-{well}-{site}/{plate}-{well}-{site}_single_cell.csv.gz | Single-cell data for each site (if save_per_site_file) |
single_cell/{plate}_single_cell_{data_set_name}.csv.gz | Single-cell data for every site of a plate (if save_single_file) |
SBS/{plate}-{well}-{site}/{plate}-{well}-{site}_cell_quality_summary.csv | Counts of cells per quality category, before filtering to keep_cell_qualities (including Empty) |
summary_data/{data_set_name}_sitelist.json | List of site folders that were used. Later steps use this so they do not need access to the CellProfiler output. |