Measurement

Here we describe our method of measuring algae flocculation and our new way of improving the older and unreliable measuring method used today

Overview


One big challenge with the project was figuring out how to measure flocculation and its efficiency. Through research we knew that C. reinhardtii could be induced to flocculate without synthetically introduced proteins using high pH and divalent cations (J. Fan et al., 2017). We therefore wanted to investigate if our genetically engineered algae would have a higher flocculation efficiency. There were different approaches that could be used to measure flocculation. The different methods involved sampling the flocculating algae at determined time points and a consistent height in the vial . Since we decided on performing the experiment in a measuring cylinder of 10mL, we sampled at the 9mL point each time for better reproducibility. We therefore aimed to study the decrease in cells as the algae flocculates and falls to the bottom of the vial. Measuring can be performed using different types of methods. However, the method we picked was measuring the cell number using a cell counter. The cell counter is used by the algae lab we collaborated with. The measurements can be performed as soon as the sample is taken with minimum preparation needed (just occasional dilution and immobilizing of the cells). This was one of the reasons we did not choose methods such as measuring dry weight, since the preparation workload was bigger. Additionally, the cell counter chamber requires only 10μL of algae solution per measurement, meaning that the percentage of taken sample is very small compared to the volume in the vial. There is however a downside to this. Smaller sample sizes could cause more variation and be influenced by the human factor when sampling. We therefore took slightly larger samples, and measured each time point several times (replicate). Moreover, the cell counter chambers are made of glass and are reusable. There was therefore minimal waste for each measurement, as opposed to using plastic cuvettes for spectrophotometry (if optical density (OD) measurement approach was selected). Additionally, due to ongoing flocculation and sedimentation, measurements using OD in the cuvette would also give us unreliable measurement.

However, there are also disadvantages of using a cell counter. The cell counter can register and show the sizes of the cells it calculates. We therefore hoped that it would count flocculated algae as one big cell, and tell the bigger size. However, we discovered that this was not the case. Even flocculated cells were counted as individual, and if overlapping (3D flocculation) the cells underneath would be missed. Another disadvantage is that tiny, invisible to the eye, particles such as dust could collect on the glass chamber when cleaning. These particles were also counted in the cell counter as "cells". This was a big problem, since this would create unreliable results, of there seemingly being more cells. We therefore had to redo many measurements that were "contaminated".

As mentioned previously, to measure flocculation, we decided to measure the absence of cells in the top layer of the flasks. However, since algae in stagnant liquid suspension is affected by gravity, another phenomenon had to be considered: sedimentation. We therefore decided to perform the flocculation experiments but without inducing flocculation, in a culture of the same strain and cell density. This would serve as a negative control to flocculation. Sedimentation (and flocculation) are affected by many different factors, such as cell density, intracellular composition of the algae, flagellar function, media viscosity, vial size and many more H. R Molitor, 2021. It was therefore important to standardize a protocol that we could use to evaluate our future protein-caused flocculation to alternative flocculation inducers.

Another method we used to study flocculation was to inspect the cells under a microscope. However, this method does not quantify the flocculation efficiency.

Lastly, a time-lapse video was recorded, comparing sedimentation to flocculation. Yet again, this method is not quantifying flocculation, and the changes were only observed by eye. This gave us an idea of exploring an alternative method. In parallel with our project we started focusing on a side project; developing and improving a so called maturation assay. This was a continuation of the iGEM Uppsala 2024 teams project In their project in 2024 the aim of the maturation assay was to measure and analyze expression of chromoproteins in bacteria. However, we realized that by improving this maturation assay, we could implement this on measuring flocculation in algae, since the previously described methods are flawed.


Maturation assay


All code for the maturation assay is uploaded to the software repository.

The main goal for this new maturation assay is to move on from using a cell counter as a measuring device and instead use something that can take continuous measurements. We do this by taking a time-lapse of the flocculation as it occurs to be able to collect continuous data.


Time-lapse imaging


The samples are grown and prepared as described above. The test tube should be mounted so we have a clear view of the vial together with a bright background. This could be a white sheet of paper or a bright wall.


Camera configuration


A high-resolution camera is to be mounted facing the sample vial. It should be mounted in a way that captures test tube with clear lightning.

  • Background: A white sheet of paper should be placed behind the test tubes to ensure a consistent background for our image analysis. This could also be a white wall or other bright background.
  • Lighting Conditions: The lighting should be as consistent as possible. The light should be set up in such a way that you can't disrupt the lighting of the test tubes. There should also be precautions taken for potential glares that reflect back from the vial.
  • Time intervals: The camera should be set up to take a picture once every 30 seconds or five minutes, depending on the amount of space and graph resolution you want. You would also want to take the flocculation/maturation time into consideration where shorter experiments can have photos taken in shorter intervals.
  • Camera settings: Many cameras' standard setting will automatically adjust the brightness, focus and contrast fo the images it captures depending on how the motif it captures changes. This will interfere with the analysis as the motive will change as the algae starts to flocculate. This will in turn change the setting of the camera so it get consistent values. You should therefore turn all auto adjustments off.


Key functions in the script


  • Point Identification: Radius of interest, pick analytic points on the sample images
  • Process points: Extract the grayscale value of the points of interest
  • Scatter plot: Visualize the change in grayscale value with a scatter plot and a curve that uses a smoothing function
  • Halftime calculations: Calculate the halftime of the flocculation
  • Boxplot: Create a boxplot for all the halftimes calculated for the sample and its different measurement points
  • Confidence interval: Calculates a 95% confidence interval of the produced halftimes

Point identification


The best way to determine where a sample is located is to point it out yourself. This is due to the variability of how images are captured, together with how other variables like lighting and contrast of the pictures can interfere with different segmentation algorithms. That is why the maturation software is split into two different parts.

The first part uses the script called get_coords.py. You will be prompted with a window asking for an image, sample name and color. You should input one of the images captured during the time-lapse.

When you have defined your sample, you will be able to click on the prompted image to produce points that will be used for measurements. For the measurements of chromoprotein maturation, we selected a minimum of 30 different points on each sample. This would also be done on the image of the flocculated algae, where you would choose multiple points in the middle of the tube. The more points you choose, the better your analysis will be.


Image Analysis


The second part of the software is the chromamature.py script. This is the main analysis of the images. This script will take all of the different points chosen and extract the grayscale values for each of these coordinates. One of the parameters used here is the ROI size that you can define. This is the radius of pixels each point should look at. The standard and recommended radius for analysis is 5 pixels. We have chosen this as it will produce more precise values for the point given, and focuses more on using multiple points for a more accurate reading. This will also prevent overlaps between points. The value of this point will be the mean of all of the pixel values that are connected to that point.

Grayscale is defined as a value between 0 and 255, where 0 represents black and 255 represents white. As we begin the experiment, measurements should be taken from the middle of the test tube. This is because we have a homogeneous mixture of algae within our test tube. As the experiment progresses, we will have more algae settling to the bottom of the test tube and thus making the middle section clearer. If we have a white background, we will obtain higher and higher point measurements as we increase the brightness in our measurements. This grayscale value is extracted from each image using the CV2 Python library. This is a library that is used for computer vision and image processing.

All grayscale values for the different points will be documented in a .csv file for each of the images in the time-lapse. All datapoints recorded will include the grayscale values as a list, the timestamp calculated from the image index and user input, the sample name and the mean value for all the different points.


Scatter plots


To be able to see the change in the grayscale values visually over time, a scatter plot is made. This will plot the grayscale values against the time point from the data. This will give us a clue on the average flocculation rate we have according to the measuring points we have chosen. We can expect a lower grayscale at the start of this curve. As more and more algae flocculate and falls to the bottom of the tube, the clearer the water will be. This will therefor lead to a logarithmic curve as the flocculation rate will slow down after a certain amount of algae have reached the bottom. This would be the opposite maturation from chromoprotein maturation as the grayscale values here would be decreasing as the color matures. The plot will eventually hit a plateau. This is an indication of that the flocculation is done by practical means.


Boxplot


The last step would be to calculate the halftime for flocculation and plot these in a boxplot. For the calculations of the halftime values, we will first focus on the different points in our measurements. This is due to the fact that we would want to see how large of a measuring error we have, and if the measurements are to be trusted. We do this by measuring the halftime for each of the different points separately and then put these values into a boxplot. We will here be able to see the spread in the measured halftime between the different measuring points we chose. If we get a very large spread, we know that we might have to rerun the analysis on different points or more likely, adjust the camera so it doesn't change any settings while taking the pictures.

During the calculation of the halftime, the script will try and find a plateau in the datapoints. We do this by using a change point detection to try and find where the signals behavior changes. This is as we expect an ongoing curve until it levels off, and we want to know the point it starts leveling off. This is also called binary segmentation. This method had been chosen after analyzing the result from the scatter plots produced by chromoprotein maturation where we can see a clear point of change when it starts to level out.


Bootstrap confidence interval analysis of halftimes


One thing that was added to the analysis was our bootstrap analysis of each of the samples analyzed. bootstrapping is a statistical analysis where you under many iterations sample from your datapoints with replacement to be able to estimate the distribution of your datapoint. Our implementation creates 10 000 datasets per default by repeatedly sampling with replacement from the original halftimes calculated for the boxplot. We then calculate the mean for each of the datasets produced and save them in a list. We then sort the list and return the upper and lower bounds for a 95 percentile confidence interval. You would here hope to see as small a difference as possible as this would show similar results for all of your different points chosen at the start of the analysis.


Results after testing on chromoprotein


For testing of the maturation assay on chromoprotein, we decided using the multiple chromoproteins for our analysis as most have a very strong color and that is relatively fast in its maturation. The experiment would take a total of two days when testing for a full analysis, but shorter times could be done resulting in similar results.


Day 1

We would re-streak E.coli that already produced different chromoproteins. The E.coli has to be grown anaerobically for the chromoproteins to be produced but not oxidate and develop color. During the first runs of these experiments, the re-streaked plates would be placed in a bag sealed with a large amount of tape. We would thereafter use nitrogen gas to fill this back before sealing it. We would then add 2 more layers of plastic bags that we filled with nitrogen to push out all of the oxygen. These would then be incubated overnight.

This however would only work around 20% of the time as we had a large problem of leakage with this method. We did however find containers designed for creating anaerobic conditions for plates. You would place the plates in a plastic cylinder with a small stand. You would thereafter open a sealed bag and put it into the cylinder. You would then seal the cylinder with an airtight lid and incubate it in the 37 degree room. The bag is thought to include salts that binds the oxygen, thus producing an anaerobic environment.


Day 2

During day 2, we would start by checking the plate. We would check for both growth on the plate and lack of color. If both of these were true, we could move on into the image acquisition phase.

A camera stand was set up with a white background in the 37 degree room. The cameras automatic adjustment settings were turned off as described above. The camera was then connected to a computer with software designed for automating the acquisition of images. It was set to take a picture every minute for 48h. The ceiling lights was used and was secured to always be turned on. The plates were taken from the anaerobic cylinders and placed without a lid facing the camera. We didn't worry to much about contamination due to most maturation would be done within a short period of time, and as we choose the points of interest, potential contamination spots would just be ignored.


Analysis and results from chromoproteins


The images were analyzed using the software in a way as described above. We got multiple expected scatter plots of chromoprotein.


scatter plot
Figure 1 Scatterplot from maturation assay on chromoproteins. The graph shows an exponentially decreasing slope of the means for each point selected on sample mRFP1 on a function of time.

The scatter plots clearly showed the expected trend. A rapid initial decrease in grayscale values as the proteins matured, followed by a plateau once most of the chromoproteins had fully developed. This curve is exactly what we expected, maturation is fast in the beginning, then gradually slows down as it approaches completion.


boxplot
Figure 2 The boxplot shows the maturation halftimes calculated. Each of the boxes contains the measurements for each of the chosen points in the first step of the analysis. All small circles outside of the boxes are standalone anomalies.

We can see the calculated the halftimes of maturation for each of the samples. For example, mRFP1 consistently reached half of its maturation in about 1 hour, showing both the speed and reproducibility of the method. The boxplots visualizing these halftimes confirmed that most samples had tight distributions, meaning our method produces consistent results across multiple measuring points. Some chromoproteins, like TS_purple_3, had broader spreads, which we believe comes from technical differences such as uneven lighting.

Finally, by applying bootstrapping statistics, we could add another layer of reliability to our data. For mRFP1, the calculated mean halftime was 1.0 hours, with a narrow 95% confidence interval of [0.766–1.290]. This shows that even with modest sample sizes, the assay can produce results that are both precise and statistically robust.


Results from flocculation



Setup


The flocculation test was set up with two test tubes. One was used as a negative control where only regular sedimentation happens, and the second one was flocculation induced by a change in pH. The image acquisition was a video that originally wasn't thought of as being used for the flocculation assay. From the 11 minute long video, we extracted a frame in ten second intervals using ffmpeg. This resulted in a total of around 50 images. Unfortunately, as this video was acquired using a phone camera with auto correction settings on, we didn't get any useful data for analysis. Another problem with this was also that the lamp used flickered, adding to the already large amount to noise in the data.
Figure 3 Flocculation video used for flocculation assay measurements.