# Sperm Group
## The Sperm Optimisation Toolbox: How Does Fish Sperm Find The Egg in Open Water?
### Main Objectives:
- Develop a mathematical model that can describe the collective/individual motion of fish sperm to find a fish egg.
- Test our model against video data for three different species of fish: rainbow trout, carp, and sterlet.
  
### The model:
- Analytically/numerically solve a 1D chemotaxis model for the concentration of sperm $u(x,t)$ at position $x$ and time $t$.
$$ \frac{\partial u}{\partial t} = D_u \nabla^2 u - \nabla \cdot \big( u \chi (a) \nabla a \big) $$
$$ \frac{\partial a}{\partial t} = D_a \nabla^2 u + g(n,a) $$
- $D_u$: diffusion coefficient for sperm.
- $a(x,t)$: chemoattractant concentration (ovariant fluid emitted from egg) at position $x$ and time $t$.
- $\chi(a)$: potential function for the chemoattractant (i.e. how fast the sperm move when exposed to the attractant).
- $D_a$: diffusion coefficient for attractant.
- $g(n,a)$: source term of the chemoattractant (i.e. generated by the egg).
Start with simplest cases (i.e. diffusion only), then include chemoattractant terms.
### The data:
- Numerically analyse the experimental videos to obtain the sperm density in different regions of interest.
- For this we use combination of 'Imagej' software and post-processing tools: MATLAB and Python.
### Where we are headed:
- Compare the model results against the data for different distributions of the attractant concentration.
- Parameter fit with the data to find the diffusion constants.
- Extend the model to 2D.
- Draw conclusions and discuss strengths and limitations of our model.
- Explore individual trajectories of sperm (time permitting)
### Finite Difference Equations
- Implicit Euler Scheme
$$ -\nabla \cdot \big( u \chi (a) \nabla a \big) = - \chi(\nabla u \cdot \nabla a + u \nabla^2 a) = - \chi(\frac{u_{i+1} - u_{i-1}}{2\Delta x}\nabla a (x_i) + u_i \nabla^2 a(x_i) )$$
$$ \frac{u^{n} - u^{n-1}}{\Delta t} = D_u \frac{u_{i+1} - 2u_{i} + u_{i-1}}{\Delta x^2}- \ \chi(\frac{u_{i+1} - u_{i-1}}{2\Delta x}\nabla a (x_i) + u_i \nabla^2 a(x_i) )$$
# Presentation
## Title slide
- The Sperm Optimisation Toolbox: How Does Fish Sperm Find The Egg in Open Water?
- Our names + mentor.
## Motivation/context slide:
- what are we trying to do? (to better understand how fish sperm locate the egg, supposing they are contained within a common fluid - think water).
- maybe show one or two of the videos of this process (describe the sperm motion, i.e. it appears random but some move in circular motion whilst also being attracted to the egg - because of the attractant it emits).
- discuss how the sperm picks up signals from the ovarian fluid and moves toward it.
## Aims slide:
- Detail the main objectives:
- Develop a mathematical model that can describe the collective/individual motion of fish sperm to find a fish egg.
- Test/inform our model using the video data for three different species of fish: rainbow trout, carp, and sterlet.
  
## Modelling approaches slide
- Briefly summarise the two models we wanted to develop.
- Briefly summarise the data capture idea.
## Model 1 formulation: 1D Chemotaxis PDE
We model the chemical attractant using chemotaxis which directs motion up a concentration gradient.
- $u(x,t)$: concentration of sperms at position $x$ and time $t$
- $a(x,t)$: attractant concentration (ovariant fluid emitted from egg) at position $x$ and time $t$.
- Chemotactic flux: $J_c = u \chi(a) \frac{\partial a}{\partial x}$, where $\chi(a)$ is a potential function for the chemoattractant (i.e. how fast the sperm move when exposed to the attractant).
- Fickian diffusive flux: $J_d = D_u \frac{\partial u}{\partial x}$, where $D_u$ is constant diffusion coefficient for sperm.
- Zero flux at the boundaries.
- Sperm concentration follows the general conservation equation: $\frac{\partial u}{\partial t} + \frac{\partial}{\partial x} (-J_d + J_c) = 0$:
$$ \frac{\partial u}{\partial t} = D_u \frac{\partial^2 u}{\partial x^2} - \frac{\partial}{\partial x} \big( u \chi (a) \frac{\partial a}{\partial x} \big) $$
- Attractant concentration follows:
$$ \frac{\partial a}{\partial t} = D_a \frac{\partial^2 u}{\partial x^2}. $$
where $D_a$ is diffusion coefficient for attractant.
- We do not solve the second equation, instead choosing $a(x,t)$ specifically.
We don't model $a(x,t)$ using the coupled equation - for simplicity - instead we pre-specify it as (what forms of $a$ do we use?).
#### Analytical insights
- solving the diffusion equation in 1D was fine (using seperation of variables) - not much insight gained from this.
- solving with a linear $a(x,t)$ term yielded an advection-diffusion equation. Solving analytically would have taken up more time - we opted to be prioritise the numerical route.
#### Numerics (finite differences):
- explain numerics/finite differences: equations were discretised in time and space using an implicit Euler method.
- Specifically the chemotaxis term:
$$ -\nabla \cdot \big( u \chi (a) \nabla a \big) = - \chi(\nabla u \cdot \nabla a + u \nabla^2 a) = - \chi(\frac{u_{i+1} - u_{i-1}}{2\Delta x}\frac{a_{i+1} - a_{i-1}}{2\Delta x} + u_i \frac{a_{i+1} - 2a_{i} + a_{i-1}}{\Delta x^2} )$$
- which particular problems did we actually solve?
- show the results we've calculated.
#### Advantages/disadvantages of the model:
- Ask some simple questions and draw some simple conclusions from this model - e.g. where does sperm have to start to have a good chance of reaching the egg?
## Data analysis of communal behaviour
- Understand trend of sperm density in different regions over time for three fish species (control vs experiment)
- Using Image post-processing tools in MATLAB
#### Process
1. Grey scaled all videos to eliminate the pipette from the videos
2. Created image frames from each video (n = 751 per video)
3. For each frame:
- Created a binary matrix to identify sperm pixels (black) using a threshold to classify white vs black pixels
- Retrieved the coordinates of sperm centroids to reduce the likelihood of double counting at a later stage
- Split into quadrants
- Recorded number of sperm centroid by quadrant over time
- Normalized data with respect to total number of sperm centroids at time _t_
#### Analysis
- Species 1
- After _t_ = 250 : no. of sperm centroids in yellow quadrant is stabilizing, mainly stemming from blue quadrant
- Control: all quadrants are fairly stable over time
- Species 2
- ~ 70% of the sperm centroids are already in the pipette qudrant
- Other sperms may not be able to reach Q3 due to lack of time, possibly slower movement than Species 1
- Species 3
- observed the importance of the initial distributions
- Because they dont move fast enough, the number in each quadrant remains stable
#### Limitations
- Threshold to create binary matrix was set arbitrarily --> sperm centroids may have been missed
***- Discretization into more compartments could have lead to more accurate results ***
- Further chemotactic specific measures could have been explored
- Analysis of whether movements of sperm in the control vs experiment are statistically significant
## Model 2: Individual motion simulations
- Instead of a macroscopic model/approximation of the sperm concentration, how about treating them individually (as we see finitely many in the videos).
- Idea: sperm follow circular trajectories (from video observations) whilst being pulled slowly toward attractant.
- Closer sperm is to the egg (emitting attractant), stronger the pull is.
Sperm are assumed to follow (discrete) equations in a circular motion in the 2D plane:
\begin{align}
x_{i+1} &= x_i + r \cos(\theta{_{i+1}}) + a(x_i,y_i) p_x, \\
y_{i+1} &= y_i + r \cos(\theta{_{i+1}}) + a(x_i,y_i) p_y, \\
\theta_{i+1} &= \theta_i + \omega dt,
\end{align}
for $i = 0,1,2,\dots$, where $r$ is the radius of the sperm "orbit", $\omega = 2 \pi / T$ the angular velocity, $T$ the period of oscillation (in steps), and $dt$ the discrete time step. We prescribe initial conditions $x_0$, $y_0$, and $\theta_0$.
We assume the sperm follows this motion, however, at certain random discrete times (i.e. roughly every 10-20 time steps), its centre of orbit is corrected by the 'pull of the background attractant'.
Background attractant: some function $a(x,y)$ with strongest values in centre (where egg is) and decaying outward (can show the heatmap from the matlab file here).
Small random correction $a(x_i,y_i) \cdot (p_x,p_y)^T$, with $p_x, p_y \sim \text{unif}(0,1)$, applied to $x_i$ and $y_i$ in the direction of the egg at $(0,0)$.
#### Pros:
- can extrapolate and run many individual trajectories.
- uniformly distribute them initially and track collective motion.
- flexibility in the background attractant choice.
#### Cons:
- computationally intensive.
- more cons??
#### What we would have liked to do:
- Assign an exponentially distributed 'time until death' for each sperm - upon which it stops moving.
- Bin the sperms at different times in different spatial regions from centre to calculate concentrations (to compare with data).
## Conclusions
#### Positves?
- Formulated two basic models for sperm concentration/individual motion.
- Used image analysis to try and empirically calculate sperm concentrations from video recordings of live experiments.
#### Difficulties?
- Extracting data proved difficult, hence reconciling data/estimating paramemter for the theoretical models was challenging.
-
#### Next steps?
- Parametize model with experiment data