September 20, 2017, Wednesday

# Martin Sotola

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

## Biofilms and Mass Spring Systems

Prolonged IV placement or the presence of prosthetic limbs can cause bacteria to enter the blood stream. The result of this entry is classified as bacteremia. Bacteremia can be fought off by a healthy immune system but if it hasn’t been fought off it will multiply and create a biofilm. Biofilms are a means for bacteria to survive in some of the harshest environments. When bacteria create a biofilm they connect to each other creating a matrix of bacteria. To model biofilms in the bloodstream (bacteremia) we used the concept of a mass spring system from differential equations. The simplest case we can analyze is the presence of a single bacteria attached to the vein’s wall by a spring. The system is show in figure 1.

Figure 1: Single Bacteria Modeled Using a Mass Spring System

In this case there are two forces including the spring restoring force and the drag force caused by the blood flow. The velocity profile of the blood is given by Poiseuille’s equation and can be used to calculate the drag force in the system. The drag force only applies in the x direction, and the spring force applies in both directions. We created a system of 4 equations representing the force in the x and y directions (see twoeqns.m). These forces were solved and plotted in matlab to portray the distance and speed of the mass over time (see fourplots.m). Our next step was evaluating the effects that changing variables have on the position and velocity of the bacteria. The first change we made was to see how changing the blood vessel diameter changes the position of the bacteria over time. Again by using fourplots.m we found that a smaller diameter causes a great increase in the drag force and therefore increases the probability of breakage. The only fault in this assumption is that the maximum speed of both blood vessels would be the same. A comparison of the x position vs. time can be seen below:

The next variable we altered was the maximum velocity of the blood flow. As expected a quicker blood velocity would cause the spring to stretch more:

The last change we made to this system was adding damping. A spring with a damping constant wants to restore to its initial state quickly by constantly decreasing the amplitude of the oscillations. The addition of a damping constant makes the spring more realistic and also decreases the chance of the spring breaking. A comparison of undamped vs damped x position over time can be seen below:

## Population Dynamics

The next item of research involved learning about structured population dynamics. The most significant piece of study involving structured population dynamics would be the Leslie matrix. The Leslie matrix is a way to predict the trends in a population based upon several variables.

The Leslie Matrix has the birth rates of each age group on the top row, while it has survival probabilities on a lower diagonal:

Figure 4: The Leslie Matrix

The first step to creating a Leslie matrix is to create distinct categories for which an entire population can be classified. For the bacteria, the distance from the wall can be used as the defining factor. In this case of bacteria, the Leslie matrix will have three items: birth rate, the probability of growing further from the wall, and the probability of staying the same distance from the wall. The sum of the probabilities should equal the probability of survival. To model the probability of survival I used two different functions including a square root function and a logarithmic function. The probability of breakage is on the y axis and the distance from the wall is on the x axis:

These functions are used to help construct the Leslie matrix for the bacteria. Leslie2.m is a function that calculates the growth of the bacteria population based on the maximum distance from the wall (eg. 10 micro meters above), the birthing rate of the bacteria, and the probabilities of growing further from the wall or staying the same place. It plots the probability of survival (above) as well as the growth of the bacteria over time.

One can use the Leslie2.m function to determine what birth rate would be needed to allow growth in the bacteria population. This can be done by altering the second input to the function until there is a positive slope in the logarithmic graph.

After constructing a Leslie matrix it is often useful to be able to analyze which elements have the greatest impact on the survival of the population. This can be calculated by the elasticity:

Figure 6: Elasticity

Elasticity.m was written to calculate these values and compile a matrix of elasticity values. The larger the value for elasticity, the greater the effect that entry of the matrix has on the growth of the population.

I used the Elasticity.m file to help me analyze whether the growing, fixed, or decaying bacteria would have the greatest effect on the population. The result demonstrated that the decay (bacteria moving to the wall) of bacteria would help the population grow:

However upon further analysis I concluded that a combination of growth, decay, and stationary movement would yield the ideal environment for bacteria to grow.

To find the birth rates needed for bacteria survival I modified leslie2.m to output just the approximate slope of the graph (final value - initial value/time difference). This function was called leslie3.m. Next I created a script that found the value which created the minimum slope (meaning a birthrate of zero). This script is named test.m. This value was recorded for a large set of growth and stationary values (varying from zero to 1). The result was plotted in a 3 dimensional graph:

The graph shows that as the growth probability approaches 1, the population needs a much smaller birth rate to survive. However as the stationary probability increases, the birth rate must also increase. This graph helps contribute to the idea of biofilm growth in the bloodstream. It also could possibly help model bacteria growth over time, and birth rates of bacteria in a system.

I plan on modifying test.m to use the dominant eigenvalue instead of values for slope which would yield a more accurate result. I am excited to see if the results can provide a useful model for biofilms in a blood stream.

## Modelling a Flock of Bacteria

To model a flock of bacteria in the bloodstream we can once again use a mass spring system. To model this system I was given a set of data points which represented x and y positions of bacteria. To model this system as a mass-spring system, connections had to be made between bacteria to represent the springs in the system.

In this system we have two forces: A spring force and a drag force. The spring force occurs between bacteria. To find the spring force between two points I used the sf.m function. This function calculates the spring force between points using positions and the rest length of the spring. The spring constant (k) is included in the function. Because the spring force is calculated using F=k*x, this is all the data needed to find the forces on a bacteria in the x and y direction.

A flock of bacteria can be modeled by a set of points, with each point modeling a individual piece of bacteria. With given sets of data (X and Y positions of bacteria), I was able to model the movement of bacteria using the the sf.m function in correlation with an ode solver. To model the changing position of bacteria over time I once again use the sum of the forces in the x and y directions. When looking at a single bacterium in the flock, one must find a way to connect individual bacteria in an efficient manner. To do this I used delaunay triangulation which creates a series of triangles (at their smallest size) which connect points in the closest possible fashion:

Figure 9: Delaunay Triangulation

Each connection between two points was replaced by a hypothetical spring. Each spring had a spring constant. The force at a single point was calculated using the drag force (only applicable in the x direction), as well as the sum of all the spring forces between connections. To find the connections between points, I created an adjacency matrix between positions. The adjacency matrix is a nxn matrix (n is equal to the number of points), and consists of 1's and 0's. A 1 in the 34th row and the 5th column corresponds to a connection between the 5th and 34th point. This concept was used to find spring forces between bacteria.

The calculations for forces were used and applied in the differential.m file. A ode solve (in this case ode15s) was used to differentiate the system of equations and result in the positions and velocities (x and y) at each specified timestep. This was performed in the AnimatedPlot.m file. This file also utilitzed a function which calculated rest length called restlength.m. Finally I created an animation to demonstrate how each bacteria moved over time. The animation also includes breakage criteria which occurs if the spring becomes stretched out to three times it's rest length.

How to Use AnimatedPlot.m (And it's sub-functions) There are several variables one may want to change when using this file. To alter each variable one should do the following:

Change the data file: Locate the load “X1.mat”, and either replace with another matlab file or with a different matrix.

Change the k value: To change the k value, one should change the kval value in the differential.m file.

Figure 10: Changing the Spring Constant

Change bacteria properties: To change the bacteria properties (mass and radius), as well as the properties of the stream look in the differential.m file:

Figure 11: Changing Bacteria Properties

Change breakage criteria (no break): To create a no breakage criteria (the bacteria will always be connected), comment out the reformatting of the adjacency matrix in the differential.m file:

Figure 12: Changing Breakage Criteria

To reflect this on the graph, comment out the breakage criteria in the AnimatedPlot.m file:

Constant Drag: To create a constant drag force (rather than drag calculated from the poiseuille flow), comment out the dxdt(i,3) piece in the differential.m file and uncomment the line below it. The first number is the force that one would want to change representing the drag: