Computational Exploration: Timing E. coli
In this Computational Exploration, we make a crude estimate of the mean division time by using a time laplse video of dividing bacteria like that shown in figure below.
Here a snapshot of the growing bacterial culture is shown every 30 minutes. The consecutive images show successive bacterial growth and division process.
The idea in this exercise is to write code that examines the images and determines the total area of the cells as a function of time.
Below is shown how to read one example snapshot, and identify area corresponding to the bacterial cells.
First install the package scikit-image
Example
If no errors are shown by the execution of the above statement then proceed ahead.
Reading image
Following images are available.
ls: cannot access 'images/': No such file or directory
We use gc4.jpg for example purposes.
Segmenting E. coli
Segmentation, the act of extracting interesting features from an image, is probably the most common taks in image processing. Your brain is very good at this. You probably recognized E. coli right away? But how can we explicitly define features of E. coli that isolate it from the other regions in this image? We can essentially define a brightness filter that will keep only pixels in a certain color or grayscale range. In doing so, it becomes straightforward to isolate E. coli. This process is called thresholding.
Let us plot the histogram of image brighness.
Identifying E. coli
Which of these regions corresspond to the brightness of E. coli?
Is it the one between 0.5 to 0.6?
Let us check.
This returns True for any pixel that falls into the brightness values of 0.7 and 0.77, and False everywhere else. This process of boolean indexing is also referred to as masking. Let's visualize our mask:
We were wrong. That brightness level did not correspond to that of E. coli, but to that shown in white in the image above.
Make another try.
Measuring area
The total number of pixels (px) in the image is just the x dimension of the image times the y dimension.
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-11-9c7c7e58c6d2> in <module>()
----> 1 print ('Percent of image occupied by E. coli: %.2f%%') % print(100.0 * np.sum(mask) / netarea)
TypeError: unsupported operand type(s) for %: 'NoneType' and 'NoneType'
The example ends here. Your turn now.
Find the doubling time of E. coli
If we assume that the cells are doubling steadily, this implies that the number of cells as a function of time can be written as . On the assumption that all cells have the same area, by multiplying both sides by the area er cell , we can rewrite this euation oas . The time constant for doubling can be determined by noting that , which results in . The rate constant, in turn, can be read off a graph you will obtain.
Try fitting a curve to the data points, and get better estimate of .
Growth curves
Numerically solve the following differential equation: and plot as a function of it. Take , and .
Numerically, solve the following differential equation: and plot as a function of it. Take , , and .
Compare the growth curves in the above two cases.