In view of the high popularity of smartphones in modern society, we hope that the biology experiments can serve for more people by combining with a smartphone APP. In this process, the smartphone APP acts as the detector and analyzer. Based on the previous laboratory work, various types of heavy metal ions can be used to express different colors of chromoproteins, and the color depth is related to the concentration of ions. The smartphone APP analyses the color expressed by the chromoproteins to get the reactive ion concentration, and show the result to the user immediately. We use the biological reaction to detect the ion concentration accurately in the shortest time and in the most convenient way.
The function of APP determines its operation flow. Obviously, the APP we want to develop has the function of a detector and analyzer, so its operations are only two steps.
1. To take photos or select photos;
2. To return the corresponding ion concentration.
Stage Ⅰ:Exploring gray scale
In order to quantify the color expression of chromoproteins, we need to convert color types and shades into corresponding mathematical values. No doubt, color space is the most appropriate way to quantify color.
Since RGB is a general hardware oriented color space, we choose it among HSV, HIS, CMY, RGB and many other color spaces. However, after the initial attempt, we found that when RGB quantifies color, the color is divided into three variables, which cannot be used to analyze the two-dimensional relationship between concentration and color. Therefore, we use the gray value obtained by RGB value transformation as a new quantization variable.
On this basis, we complete the first version of APP, which provides users with an average gray value of a picture. We find a new problem when it is applied to the sample analysis in the laboratory. Because the reaction area exists only in a part of the photograph, the average gray value of the reaction region is actually doped with the influence of the superfluous region. In order to eliminate the influence of the superfluous region to the results, we add a new threshold control function.
The principle of threshold control is as follows: the color background of the superfluous region is white, and the gray value is higher than that of the reaction region. After many experiments, in the similar experimental environment, the gray value of the superfluous region can be roughly determined, and the lower limit is set as the threshold value. When we analye the photos, it will be abandoned if the gray value of a point is greater than the threshold. Thus, we can filter out the reaction area, get a more accurate value of average gray. So far, we complete the first edition of APP development.
Stage Ⅱ:Single protein reaction system
After we are able to convert the color expressed by the chromoprotein to grayscale, we try to analyze and calculate the ion concentration in the single protein reaction system.
In order to determine the two-dimensional function relationship between ion concentration and gray value, we carry out the collection of laboratory related data. Because of the time crunch, we didn't get more data samples. According to the existing data, we infer that their function relationship is approximately linear (if we can collect more data, we can correct the result).
Concentration ratio | 1 | 1/2 | 1/4 | 1/8 | 1/16 | 1/32 |
Statistics from app analysis | 76 | 82 | 102 | 123 | 125 | Unable to distinguish |
So, we come up with the following design idea.
1. In the same experimental environment, the standard control group with known ionic concentration and the sample group with unknown ionic concentration are simultaneously reacted.
2. APP is used to take pictures, and the gray values of all reaction areas are calculated.
3. The function relation between gray value and ion concentration in standard control group is obtained by a fitting method.
4. The gray value of the sample group is substituted into the above formula, and the ionic concentration of the sample group is obtained.
5. The obtained ionic concentration is displayed to the user.
Based on this idea, we complete the second versions of APP, which can provide the ionic concentration of a single protein reaction system for users in the stable experimental environment. At the same time, due to the requirements for the stability of the experimental environment in the calculation process, and light environment sensitivity of RGB color space, we generate an idea about the reaction box (see more in here). Further thinking about the box, there is no effect on the calculation of the average gray value of the reaction region, because the total gray scale of the environment is approximate and the area is the same. Thus, we gave up the threshold control which is used to screen the reaction region. The second edition of APP has been perfected.
Stage Ⅲ:Double protein reaction system
On the basis of the design idea of single protein reaction system, we explore the double protein reaction system.
As the ionic species increase, the variable increase from one to two, so the corresponding concentration-color function relationship also increase to three dimensions. Similar to the determination of the functional relationships in single protein reaction systems, we need a lot of data to build three-dimensional functional models. However, because we don't get enough laboratory data, we have to give up the idea. This does not mean that the idea of using APP to calculate ionic concentration is wrong, which is explained in detail in the improvement of the double protein reaction system. Because of the limitations of analyzing data in APP, we use MATLAB at the PC end to process and analyze the data of the double protein reaction system. See here for more details.
This part is the specific code to achieve the above ideas, please refer to the source code on here(GitHub). The following five points are important components of code:
1. Taking photos and selecting photos freely
2. Calculation of RGB value and gray value
3. Threshold control to filter reaction region
4. Image segmentation based on reaction region5>Calculation of standard function in single protein
This color analysis process is not only applicable to the work of our team, and it can be widely used as reference by future teams. Compared with laboratory biological experiments, APP and the portable reaction containers allow non-professionals to feel the charm of biological experiments in the fastest and most accurate way, which is of great significance to biological workers. And similar design ideas will speed up the advent of personalized medical era.