Skip to content

MannLabs/SPARCSpy

Repository files navigation

Python package Python package website

graphical_abstract

SPARCSpy is a scalable toolkit to analyse SPARCS datasets. The python implementation efficiently segments individual cells, generates single-cell datasets and provides tools for the efficient deep learning classification of their phenotypes for downstream applications.

Installation from Github

SPARCSpy has been tested with Python 3.8 and 3.9. We recommended installing the library within a conda environment.

To install the SPARCSpy library clone the Github repository and use pip to install the library in your current environment. Please make sure that the package is installed editable (with the -e flag). Otherwise pretrained models might not be available.

We recommend installing the non-python dependencies with conda before installing SPARCSpy (especially if running on an M1 Silicon Mac):

git clone https://github.com/MannLabs/SPARCSpy
cd SPARCSpy

conda create -n "SPARCSpy"
conda activate SPARCSpy
conda install python=3.9 scipy 'scikit-image>=0.19' scikit-fmm cellpose opencv numba -c conda-forge

In case you wish to utilize the ML capabilities of SPARCSpy (either for segmentation or classification) please follow the instructions here to install pytorch correctly for your operating system. Once this has been installed you can verify that pytorch is installed correctly by executing the following python code:

import torch
x = torch.rand(5, 3)
print(x)

You can access the python console by typing python and exit it when you are finished by entering exit(). The output should look something like this:

tensor([[0.3380, 0.3845, 0.3217],
 [0.8337, 0.9050, 0.2650],
 [0.2979, 0.7141, 0.9069],
 [0.1449, 0.1132, 0.1375],
 [0.4675, 0.3947, 0.1426]])

Once you have installed pytorch according to the instructions we still need to install pytorch lightning. To do this run:

conda install -c conda-forge pytorch-lightning

Currently SPARCSpy depends on a developer version of alphabase so please install the package from source by doing the following:

pip install git+https://github.com/MannLabs/alphabase

SPARCSpy also depends on the py-lmd library. So please install the py-lmd library into the same conda environment following the installation instructions here.

Once these steps are completed you can proceed to install the SPARCSpy package via pip:

pip install -e .

Documentation

The current documentation can be found under https://mannlabs.github.io/SPARCSpy/html/index.html.

Citing our Work

SPARCSpy was created by Georg Wallmann, Sophia Mädler and Niklas Schmacke in the labs of Matthias Mann and Veit Hornung in 2023. SPARCSpy is actively developed with support from the labs of Matthias Mann, Veit Hornung and Fabian Theis.

If you use our code please cite this manuscript:

SPARCS, a platform for genome-scale CRISPR screening for spatial cellular phenotypes Niklas Arndt Schmacke, Sophia Clara Maedler, Georg Wallmann, Andreas Metousis, Marleen Berouti, Hartmann Harz, Heinrich Leonhardt, Matthias Mann, Veit Hornung bioRxiv 2023.06.01.542416; doi: https://doi.org/10.1101/2023.06.01.542416