CellFlow

repository·main·Indexed 40 days ago

https://github.com/theislab/cellflow

A framework for predicting single-cell phenotypes induced by complex perturbations using Flow Matching techniques. It enables modeling of single and combinatorial drug treatments, genetic perturbations, cell fate engineering, and organoid growth protocols. The tool provides a `CellFlow` class with solvers like "otfm" (Optimal Transport Flow Matching) and "genot" for deterministic or stochastic mapping, and is distributed as the `cellflow-tools` package.

Tokens
18.3K
Snippets
60
Records
85
Agent score
50%

What's inside CellFlow

  1. Overview of cellflow.preprocessing functions

    main
    The cellflow.preprocessing module provides a suite of tools for preparing data for flow matching models. Key capabilities include dimensionality reduction (PCA), molecular feature engineering (fingerprints, one-hot encoding), and data augmentation/labeling (transferring labels, annotating compounds, computing weighted k-nearest neighbors).
  2. Overview of CellFlow

    main

    CellFlow is a framework designed for modeling complex perturbations in single-cell data using Flow Matching. It allows researchers to predict single-cell phenotypes resulting from various interventions, such as:

    • Single and combinatorial drug treatments
    • Genetic perturbations
    • Development of perturbed organisms
    • Cell fate engineering
    • Optimization of organoid growth protocols
  3. Use OTFlowMatching and GENOT solvers in CellFlow

    main

    CellFlow provides specialized solvers for modeling complex perturbations using flow matching. The primary available solvers are:

    • OTFlowMatching: An Optimal Transport-based flow matching solver.
    • GENOT: A solver likely focused on generative modeling or specific perturbation types (refer to the full API documentation for specific parameter requirements).

    These solvers are accessible via the cellflow.solvers module.

  4. Use PCA for dimensionality reduction in cellflow

    main

    The module provides three related functions for Principal Component Analysis (PCA) workflows:

    • centered_pca: Performs PCA on centered data.
    • project_pca: Projects data onto a pre-computed PCA space.
    • reconstruct_pca: Reconstructs the original data from its PCA projection.
  5. Encode molecular and chemical features

    main

    To represent chemical structures or categorical data for modeling, use:

    • get_molecular_fingerprints: Generates molecular fingerprints.
    • encode_onehot: Performs one-hot encoding on categorical features.
    • annotate_compounds: Annotates chemical compounds with relevant metadata.
  6. Install development dependencies for CellFlow

    main

    To contribute to CellFlow or run tests and build documentation, you must install the package in editable mode along with the dev and test extras. This ensures all necessary Python packages for testing and documentation generation are available.

    cd CellFlow
    pip install -e ".[dev,test]"
  7. Access sample datasets in CellFlow

    main

    CellFlow provides built-in sample datasets for testing and demonstration purposes via the cellflow.datasets module. Two available datasets are:

    • ineurons: A dataset related to neuron modeling.
    • pbmc_cytokines: A dataset related to PBMC (Peripheral Blood Mononuclear Cell) cytokine responses.

    You can access these by importing them from the cellflow.datasets module.

    from cellflow.datasets import ineurons, pbmc_cytokines
    
    # Use the datasets in your CellFlow workflows
  8. Run automated tests with pytest

    main
    CellFlow uses pytest for automated testing. After installing the development dependencies, you can run all tests from the command line by executing pytest in the root of the repository. Most IDEs also provide a GUI for running these tests.
    pytest