One important question that we want to answer is
What happens in the long term
In may cases it is not easy to guess. Our intuition is bad
We need to simulate and see what happens
The Polymerase Chain Reaction (PCR) is a method used to synthesize millions of copies of a given DNA sequence.
A typical PCR reaction consists of series of cycles:
This loop is repeated between 25 and 30 times
We simplify and we forget about the polymerase and the dNTP. They both will be represented by primers.
We have a system with two parts, DNA and primers and one process, the thermal cycle.
The system is represented by this diagram:
This system was in Homework 8
Many of you noticed that this system has the same shape of cell-food system
Same shape means same behavior
Let’s write a function to simulate the PCR reaction.
The function name should be pcr
and it must take four inputs:
N
,DNA_ini
,primer_ini
, andcycle_rate
.The function must return a data frame with cycle
, DNA
and primer
.
pcr <- function(N, DNA_ini, primer_ini, cycle_rate) {
DNA <- d_DNA <- rep(NA, N)
primer <- d_primer <- rep(NA, N)
DNA[1] <- DNA_ini
primer[1] <- primer_ini
d_DNA[1] <- d_primer[1] <- 0
for(i in 2:N) {
cycle <- cycle_rate * primer[i-1] * DNA[i-1]
d_DNA[i] <- cycle
d_primer[i] <- -cycle
DNA[i] <- DNA[i-1] + d_DNA[i]
primer[i] <- primer[i-1] + d_primer[i]
}
return(data.frame(cycle=1:N, DNA, primer, d_DNA, d_primer))
}
cycle DNA primer d_DNA d_primer
1 1 1000000 100000000 0 0
2 2 2000000 99000000 1000000 -1000000
3 3 3980000 97020000 1980000 -1980000
4 4 7841396 93158604 3861396 -3861396
5 5 15146331 85853669 7304935 -7304935
6 6 28150012 72849988 13003681 -13003681
Does final DNA depends on
initial DNA concentration?
initial primer concentration?
PCR reaction rate?
The PCR reaction curve depends on the initial concentration of DNA.
We want to understand this dependency for the following values of initial DNA concentration:
[1] 1e+00 1e+01 1e+02 1e+03 1e+04 1e+05 1e+06
position_of_half()
How would you write that function?
position_of_half()
functionone possible solution
DNA concentration crosses 50% at 21 cycles
CT <- rep(NA, length(initial_DNA))
for(i in 1:length(initial_DNA)) {
exprmnt <- pcr(N=30, DNA_ini=initial_DNA[i],
primer_ini=1e8, cycle_rate=1e-8)
CT[i] <- position_of_half(exprmnt$DNA)
}
or, better
We conclude that the CT
value can be used to predict the initial DNA concentration.
The speed of reaction r1 depends on the reaction rate, the number of oxygen atoms, and the square of the number of hydrogen atoms
The speed of r2 depends on the reaction rate and the number of water molecules
The actual reaction rates depend on the temperature and other conditions
r1_rate
r1_rate
valuesWe can measure how much water we got.
If at the end we have 0.5 mol of water, then …
… with the curve we can find what was the reaction rate
The two cases we saw had the same long-term behavior: equilibrium
Other systems (such as predator-prey model) can have other behavior: cycle