Skip to content

Latest commit

 

History

History
132 lines (63 loc) · 7.41 KB

File metadata and controls

132 lines (63 loc) · 7.41 KB

Analysis of calcium imaging

In this problem, we will practice a number of common methodologies for the analysis of calcium traces. Differently to the other projects proposed in this Hackathon, this project is more educational and aims at giving hands-on practice with Python and Jupyter Notebooks. Using videos of fluorescent calcium-indicator Oregon Green (OGB-1) in endothelial cells, we will practice:

  1. a simple method to segment cells;
  2. extract fluorescence time series of a set of cells;
  3. and estimate their calcium concentration and other population statistics.

As extra activities, participants may also use this dataset to learn how to automate pipelines for image processing and create videos such as this one using a few lines of code in Python.

The dataset used in this problem was kindly provided by Dr. Julia Mack from the Arispe Lab, and was used in their recent publication on Nature Communications.

Primary goal

From the discussions in the Hackathon, we will publish a notebook which will provide an example of how to extract and analyse calcium dynamics form a video. This notebook will be available publicly to everyone, and other people from the QCBio community will be able to use it as an additional resource for this kind of analysis.

Technical challenges

  • Handling images and videos with python

  • Dealing with photobleaching and estimating calcium concentration

  • Applying regression on a set of time series

  • Extracting statistics based on a set of cells

  • [extra] Automating a pipeline using parallel processing

  • [extra] Creating animations based on data

Dataset

The data is provided here. It consists of two h5files that contain: one with the calcium traces from four samples, and the other with measurements of Fmax-Fmin (see paper for more details).


Track 1 - Segmenting and separating cells

Guideline

  1. Let's start by downloading the file Notch1KD_JMackNatComm2017_samples.hdf5. Import the h5 file into your Python environment (hint: h5py). You should have access to 4 samples, called sample1, sample2, sample3 and sample4. Each sample is a 1024x1024 video of 600 seconds. Choose one of them and use this sample to figure out how to identify and index the cells, then apply your solution to the other files.

  2. Plot a few frames of your video. Using shape

    • Optional: Often the file you have access to is not in a video format. Create a video of it using this script.
    • Optional: Add comment lines to the script, explaining what each line does.
  3. Find the average fluorescence of the whole video as a function of time. Plot it and interpret what is happening.

  4. Use operations from libraries scikit-image and OpenCV to separate each cell. There are many ways to do it, the easiest way is to identify the region around each nucleus and use it to segment the image. We share below the steps to achieve that.

    • Select specific frames an try some filters on it. For instance, try using a median blur and thresholding it. Use this first step to get some feeling of how these tools affect the images.

    • Use filters and thresholds to turn the regions close to each of the nuclei into "blobs" (see example below).

    • Use blob detection techniques. Hint: Take a look at scikit-image's measure.label() function.

    • Post-process your results.

  5. You should now have set of subregions of your image where you can find each cell. This is called a mask. Write a small code that, given the ID of a cell, it plots the average fluorescence in the corresponding region as a function of time.

  6. Export your results using NumPy's savetxt() function. We recommend that you use an array of shape (Ncells,600), where Ncells represents the number of cells found by your code.

  7. Optional: On top of a plot with one of your frames, use matplotlib's text() function to show what is the id of each of your cells (see below an example).

Resources

Track 2 - Removing photobleaching and estimating calcium concentration

Guideline

  1. In point 3 of Track 1 we visualized the average fluorescence as a function of time. The drop in the basal line is called photo bleaching. Find a way to fix it and plot the new average fluorescence.

  2. Use the mask obtained in point 5 from Track 1 to examine the fluorescence of each cell. If you decided to go directly to Track 2, you can download a sample of mask here. Is there still residual photobleaching? If yes, correct it per cell.

  3. Let's start by downloading the file Notch1KD_JMackNatComm2017_fmaxfmin.hdf5. Import the h5 file into your Python environment. This gives you the measures of Fmax and Fmin for each sample.

  4. Estimate the Fmax and Fmin per sample (or per cell). Note that Fmax and Fmin are taken after the whole experiment, and should be corrected for photobleaching too.

  5. To convert from fluorescence to calcium concentration, use the formula below (Kd=170nM is the dissociation constant of OGB-1):

  1. Plot the distribution of average calcium distribution for each slide.

Resources



Extra 1 - Automate the pipeline

Challenge

Create a single Python module that applied the pipeline on a set of these images. Given enough memory, many of these computations can be performed in parallel.

Extra 2 - create a video!

Challenge

Matplotlib has an animation module. Creates a video as this one based on your work.