Class 12: Exercises on Systems

Computing for Molecular Biology 2

Andrés Aravena, PhD

9 April 2021

Water

A chemical reaction combines hydrogen and oxygen to produce water

To make it simple we will assume that the reaction is this: \[2H+O\leftrightarrow H_2O\]

Our system has 3 items:

  • Hydrogen
  • Oxygen
  • Water

The simple system

Reactions are bidirectional

The items of the system

We represent hydrogen by H, oxygen by O, and water by W.

Each vector has the number of atoms or molecules for different times

We will measure the number of atoms and molecules in moles

The initial quantities are:

  • 1 mole oxygen,
  • 1 mole hydrogen, and
  • 0 mole water

The rules are the following:

There are two reactions at the same time:

  1. from hydrogen and oxygen into water
    (that is, left to right),

  2. from water into hydrogen and oxygen
    (that is, right to left).

Exercise: finish it

Create a water_formation function.

Inputs are:

  • N: Number of steps in the simulation
  • H_ini: initial amount of hydrogen
  • O_ini: initial amount of oxygen
  • W_ini: initial amount of water
  • reaction1_rate: reaction 1 rate
  • reaction2_rate: reaction 2 rate

Test it

  • N: Try 100 or 1000
  • H_ini: 1
  • O_ini: 1
  • W_ini: 0
  • reaction1_rate: 0.1
  • reaction2_rate: 0.1

Exercise 2: conservation of mass

One atom of oxygen has 16 times the mass of one atom of hydrogen

Therefore one molecule of water has mass 18

Show that the total mass never changes

Fibonacci series

Rabbits

We have three kinds of rabbits: baby, adult and pregnant rabbits.

Each month baby rabbits grow, so the number of adult rabbits increases and the number of baby rabbits decreases. The same happens with adult and pregnant rabbits.

On the other side, each of pregnant rabbit produces a new baby rabbit, so the number of baby rabbits increases by the number of pregnant rabbits.

What are the parts and what are the processes of this system?

  • What vectors will represent the state?
  • What values represent the process rates?
  • What are the initial values that we need to know?

Please answer in plain English. Then draw the system

Drawing

Initial conditions

The initial conditions are:

  • baby_ini=1,
  • adult_ini=0 and
  • pregnant_ini=0.

The rate constants for growth, mating and birth are 1.

Please simulate the system for N=24 steps.

Epidemy

COVID systems

We start with a lot of Healthy people and one Infected person.

The process of infection transforms healthy people into infected people.

They can die before treatment though the dying process, or can be accepted in a Hospital through the process of diagnostic.

People in the hospital can become Recovered through the healing process, or become Dead through the death process.

What are the parts and what are the processes?

  • What vectors will represent the state?
  • What values represent the process rates?
  • What are the initial values that we need to know?

Please answer in plain English. Then draw it.

What is the effect of social isolation in the process rates?

  • What is the effect of better test kits?
  • What is the effect of better treatment methods?
  • What is the effect on the process rates of a vaccine?

The public health decisions do not change the model, or the initial values. We can only change the process rates.

Please explain how process rates change with each action.

This system is represented by this figure

Simulate it and test your predictions

Zombie Attack!

According to some movies…

dead people can revive in the form of zombies

Some of the dead get revived by Afro-caribean voodoo magic. Zombies go around looking for humans to eat.

When a zombie and a human meet, two things can happen.

  • If the zombie attacks the human, then the human becomes another zombie.
  • If the human kills the zombie, then the human is safe and the zombie becomes dead again.

see “Night of the Living Dead”, George A. Romero, 1968 or “Shaun of the Dead”, Simon Pegg, 2002

The horror movie system

We will simulate hour by hour for 28 days

So N=28*24

The attack rate is 5e-3,
kill rate is 1e-3 and
the voodoo rate is 1e-2.

What will happen with us?