Skip to content

Repository to automatically process ​Fluorescence In Situ Hybridization (FISH) images using Cellpose and BIG-FISH (FISH-quant v2).

License

Notifications You must be signed in to change notification settings

MunskyGroup/FISH_Processing

Repository files navigation

​Fluorescence In Situ Hybridization (FISH) - automated image processing

Authors: Luis U. Aguilera, Linda Forero-Quintero, Eric Ron, Joshua Cook, Brian Munsky

License Open In Colab Documentation Status

Description

Repository to automatically process ​Fluorescence In Situ Hybridization (FISH) images. This repository uses PySMB to allow the user to transfer data between Network-attached storage (NAS) and a remote or local server. Then it uses Cellpose to detect and segment cells on microscope images. Big-FISH is used to quantify the number of spots per cell. Data is processed using Pandas data frames for single-cell and cell population statistics.

Code architecture

drawing

Code overview

Cell segmentation

* The code can achieve accurate cell segmentation for the nucleus and cytosol in the images. 
The segmentation is performed using Cellpose and complex optimization routines that ensure 
the maximum number of cells detected in the image.

drawing

Spot detection

* Spot detection is achieved using Big-FISH. Customization is added in this code to detect 
spots in multiple color channels. Additionally, this repository contains algorithms to 
measure spots that are co-detected in different color channels.  

drawing

Spot counting

* The code quantifies the number of spots per cell and allows the visualization of these
numbers as a function of cell size.

drawing

Spot intensity quantification

* The code allows quantifying the intensity of each spot, using the disk and a ring mask 
method developed by Morisaki and Stasevich, Methods Mol Biol. 2022.

drawing

Data management

* A complete data-frame for all processed images and cells is generated. This data-frame
contains information about the location and intensity of each detected spot.

drawing

Data reproducibility report

* To increase reproducibility a metadata report is generated. This report contains information
 about the list of images processed, the specific parameters used to process the data, 
 the user that processed the data, and the version of the modules and packages used.

drawing

Data visualization and publication quality images.

* Plotting a complete field of view

drawing

* Plotting the detected spots and transcription sites in a selected cell.

drawing

* Plotting all color channels for a selected cell.

drawing

* Plotting all z-slices for a selected cell.

drawing

Installation

Installation on a local computer

To install this repository and all its dependencies. We recommend installing Anaconda.

  • Clone the repository.
git clone --depth 1 https://github.com/MunskyGroup/FISH_Processing.git
  • To create a virtual environment, navigate to the location of the requirements file, and use:
 conda create -n FISH_processing python=3.10 -y
 source activate FISH_processing
  • To install pytorch for GPU usage in Cellpose (Optional step). Only for Linux and Windows users check the specific version for your computer on this link :
 conda install pytorch cudatoolkit=10.2 -c pytorch -y
  • To install pytorch for CPU usage in Cellpose (Optional step). Only for Mac users check the specific version for your computer on this link :
 conda install pytorch -c pytorch
  • To include the rest of the requirements use:
 pip install -r requirements.txt

Installation on the Keck-Cluster (Rocky Linux 8)

The following instructions are intended to use the codes on the Keck Cluster.

  • Clone the repository to the cluster.
git clone --depth 1 https://github.com/MunskyGroup/FISH_Processing.git
  • Move to the directory
cd FISH_Processing 
  • Create an environment from this YAML file.
conda env create -f FISH_env.yml

Using this repository

Most codes are accessible as notebook scripts or executables.

To use the codes locally with an interactive environment, use the notebooks folder

  • To process images use the notebook FISH pipeline

  • After processing the images use the notebook FISH pipeline to analyze multiple datasets

Executable codes are located in cluster folder

  • A Bash script is used to execute a python script containing the image processing pipeline. Please adapt these scripts to your specific configuration and target folders.

Miscellaneous instructions:

To login to the NAS, it is needed to provide a configuration YAML file with the format:

    user:
        username: user_name
        password: user_password
        remote_address : remote_ip_address
        domain: remote_domain

Creating an environment file (YAML) use:

conda env export > FISH_env.yml

Additional steps to deactivate or remove the environment from the computer:

  • To deactivate the environment, use
 conda deactivate
  • To remove the environment use:
 conda env remove -n FISH_processing

To create the documentation use the following modules.

pip install sphinx
pip install sphinx_rtd_theme
pip install Pygments

Licenses for dependencies

Please check this file with the licenses for BIG-FISH, Cellpose, and PySMB.

Citation

If you use this repository, make sure to cite BIG-FISH and Cellpose:

  • Big-FISH: Imbert, Arthur, et al. "FISH-quant v2: a scalable and modular tool for smFISH image analysis." RNA (2022): rna-079073.

  • Cellpose: Stringer, Carsen, et al. "Cellpose: a generalist algorithm for cellular segmentation." Nature Methods 18.1 (2021): 100-106.