Skip to content

Python package for FlowCytometry simulation and development toolbox.

License

Notifications You must be signed in to change notification settings

MartinPdeS/FlowCyPy

Repository files navigation

FlowCyPy Logo

FlowCyPy: Flow Cytometer Simulation Tool

Meta Python Documentation Status  
Testing Unittest Status Unittest coverage  
PyPi PyPi version PyPI - Downloads  
Anaconda Anaconda version Anaconda downloads Latest release date

Overview

FlowCyPy is a cutting-edge Python library designed to simulate flow cytometer experiments. By generating realistic Forward Scatter (FSC) and Side Scatter (SSC) signals, FlowCyPy enables detailed modeling of flow cytometry setups, making it ideal for researchers and engineers working with extracellular vesicles (EVs) or other scatterers.

Key Features

  • Particle Event Simulation: Create detailed FSC/SSC signals with customizable particle size and refractive index distributions.
  • Noise and Signal Modeling: Incorporate realistic noise sources (thermal, shot, dark current) and baseline shifts.
  • Detector Configurations: Simulate real-world detector behaviors, including saturation and responsivity.
  • Fluorescence Modeling: Simulate fluorescence signals for labeled particles (e.g., EV surface markers).
  • Visualization Tools: Generate advanced plots, including density maps and signal traces.

For full documentation and examples, visit the FlowCyPy Documentation.

Installation

Install FlowCyPy via pip or conda`:

pip install FlowCyPy
conda install FlowCyPy --channels MartinPdeS

Requirements: Python 3.10 or higher with dependencies: numpy, scipy, pint, tabulate, seaborn, MPSPlots, PyMieSim, pydantic>=2.6.3

Quick Start

Simulate a simple flow cytometer experiment:

from FlowCyPy import FlowCytometer, ScattererCollection, FlowCell
from FlowCyPy.units import particle, liter, nanometer, RIU

# Define the flow cell
flow_cell = FlowCell(
    flow_speed=1.0, flow_area=10e-6, run_time=0.01
)

# Define scatterer properties
scatterer = ScattererCollection(medium_refractive_index=1.33 * RIU)
scatterer.add_population(
    name='EVs',
    concentration=1e9 * particle / liter,
    size=distribution.Normal(mean=100 * nanometer, std_dev=20 * nanometer),
    refractive_index=distribution.Normal(mean=1.45 * RIU, std_dev=0.01 * RIU)
)
flow_cell.initialize(scatterer=scatterer)

# Simulate the cytometer signals
cytometer = FlowCytometer(
    flow_cell=flow_cell,
    source=source,
    detectors=[detector_fsc, detector_ssc]
)
cytometer.simulate_pulse()
cytometer.plot()

Explore more examples in the FlowCyPy Examples.

Development and Contribution

Clone the Repository

git clone https://github.com/MartinPdeS/FlowCyPy.git
cd FlowCyPy

Install Locally

Install in editable mode with testing and documentation dependencies:

pip install -e .[testing,documentation]

Run Tests

Use pytest to validate functionality:

pytest

Build Documentation

Build the documentation locally:

cd docs
make html

Find the documentation in docs/_build/html.

Additional Resources

Contributions

Contributions are welcome! If you have suggestions, issues, or would like to collaborate, visit the GitHub repository.

Contact

For inquiries or collaboration, contact Martin Poinsinet de Sivry-Houle.