Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

2. Merge single cells

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

InputDescription
{file_location}/{batch}/{plate}-{well}-{site}/{compartment}.csvOne file for each of compartments
SBS/{plate}-{well}-{site}/processed_SBS.tsv.gzFrom step 1
summary_data/Inferred_Empty_Sites_*.csv, No_SBS_Foci_Sites_*.csv, No_Assigned_Cells_Sites_*.csvFrom 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

OutputDescription
single_cell/by_site/{plate}-{well}-{site}/{plate}-{well}-{site}_single_cell.csv.gzSingle-cell data for each site (if save_per_site_file)
single_cell/{plate}_single_cell_{data_set_name}.csv.gzSingle-cell data for every site of a plate (if save_single_file)
SBS/{plate}-{well}-{site}/{plate}-{well}-{site}_cell_quality_summary.csvCounts of cells per quality category, before filtering to keep_cell_qualities (including Empty)
summary_data/{data_set_name}_sitelist.jsonList of site folders that were used. Later steps use this so they do not need access to the CellProfiler output.