Skip to content

Latest commit

 

History

History
97 lines (56 loc) · 3.86 KB

README_swimminganalysisinagar.md

File metadata and controls

97 lines (56 loc) · 3.86 KB

Swimming analysis in agar

This collection of Python and Matlab code for single-cell detection, cell-tracking and the extraction of movement statistics (diffusion and drift). This code was used to analyze the movement characteristics of cells in expanding poputlations (within soft-agar), as published in our manuscript:

  • J.Cremer, T.Honda, Y.Tang, J.Wong-Ng, M.Vergassola, T.Hwa. Chemotaxis as a navigation strategy to thrive in nutrient-replete environments

Ying Tang and Jonas Cremer together with the other coauthors.

Required packages

The code combines Python and MATLAB scripts.

For cell tracking the u-track package from the Danuser Lab was used:

To setup code, have u-track package in a subfolder. Copy all script files provided in the folder "matlabfolder" into main folder with scripts.

In addition, the Python code requires the modules NumPy an SciPy.

The code was developed and tested in Python2.7 and MATLAB R2016b and MATLAB R2018b.

Running swimming analysis

Analysis works in 3 steps:

  1. single-cell detection,
  2. cell tracking (u-track or trackpy)
  3. estimation of diffusion and drift.

The trajectory generation via u-track reads in .mat files and thus a Python script first digests the raw imaging files from the microscopes and detects cells. Positions of detected cells are saved in a .mat file and analyzed using u-track.

For the analysis of swimming behavior in liquid culture we used the python module trackpy. This can also be used as an alternative to track cells in soft-agar.

To run this code, execute python file readindata_PIP.py. Before running, settings in the readindata_PIP.py and DriftDiffusion.m have to be adjusted.

Adjust readindata_PIP.py:

  1. filename: folder names that contain images.

  2. SquenceName: label of experimental runs.

  3. thresholdv: the lower cutoff of signal value in each pixel to detect cell.

  4. generate_cluster: if True, it will detect single cells from GFP images of confocal microscope. The output is a matrix file of cells' 2 dimensional positions for each image.

  5. do_tracking: if True, it will run Matlab package utrack 2.0 to connect the cells between images, track the cells and generate the trajectoreis.

  6. CalculateDiffusion: if True, run Matlab file DriftDiffusion.m to calculate diffusion, drift, etc of cell population dynamics. It estimate mean square displacment versus time, in X and Y direction, and do a linear fitting to the it for calculating the diffusion and drift coefficients.

Adjust DriftDiffusion.m:

  • PlotDetail: if 1, it will plot the distribution of single-cell statistics of mean displacement in both x and y direction.

  • PlotDriftDiffusionFit: if 1, it will plot the linear fit between mean square displacement and mean displacement versus time.

  • ThrowNonMotile: if 1, it will delete non-motile cells.

  • PhysicalLength: length size of images in the unit of mum.

  • pixel: pixel number of images.

  • tLength: time step between images in the unit of seconds.

Output

The main output includes:

  1. Figures:
  • The distribution of mean displacement and mean square displacement of single-cells, in both x and y directions (alignment of sample on sample mount such that swimming along x).

  • The average of mean displacement and mean square displacement versus time, for both x and y directions. A linear fit of the mean square displacement gives the corresponding diffusion coefficient.

  • The auto-correlation function of position variables, in both x and y directions.

  • The distribution of angular change.

  1. Mat file with the statistics:
  • The mean displacement and mean square displacement versus time.

  • The diffusion coefficient as the slope of linear fitting on mean square displacement versus time.