This repository contains a Python script for processing flow cytometry single-cell data from human hematopoietic stem and progenitor cells (HSPCs). The script loads .csv files, classifies cells based on marker expression thresholds, filters out biologically implausible lineage trees, and saves the cleaned, pooled dataset.
- Imports and formats experimental single-cell CSV data.
- Uses user-defined gating thresholds to classify cells into types (e.g., HSC, MPP, CMP).
- Detects and removes "impossible" family lineages based on generation sizes.
- Aggregates and exports a cleaned pooled dataset.
MultiGen_analysis/
├── csv/
│ └── Single_cell/
│ ├── [input CSV files]
│ └── Pooled_data.csv # Output file
├── figures/ # (optional) Output plots
├── pickled_data/ # (optional) Intermediate files
├── Gating_matrix.xlsx # Gating thresholds
-
Python 3.6+
-
Dependencies:
- pandas
- numpy
- matplotlib
- seaborn
- scipy
- openpyxl (for reading
.xlsx)
Install with:
pip install -r requirements.txtRun the script to process all .csv files in the csv/Single_cell/ directory:
python 0_process_data.pyThe cleaned and annotated dataset will be saved as:
MultiGen_analysis/csv/Single_cell/Pooled_data.csv
- Gating logic is defined in the
cell_class_exp_time()function and driven by thresholds inGating_matrix.xlsx. - Alternate classification schemes using fewer markers (e.g., CD34/CD38 only) are commented out and can be toggled as needed.
- Modify the
cond_rule()function if experimental condition names differ.