Team:Groningen/Modelling/Characterization

From 2009.igem.org

(Difference between revisions)
m (Make use of timekey.)
(Simulated annealing)
Line 56: Line 56:
{{todo|TODO: List results. Take conversion from nmol/mg and mg/ml to µM and Vc/Vs into account.}}
{{todo|TODO: List results. Take conversion from nmol/mg and mg/ml to µM and Vc/Vs into account.}}
 +
{|
 +
!id="iter"|
 +
!best
 +
!cur
 +
|-
 +
|v5
 +
|id="v5"|
 +
|id="v5cur"|
 +
|-
 +
|K5
 +
|id="K5"|
 +
|id="K5cur"|
 +
|-
 +
|E
 +
|id="E"|
 +
|id="Ecur"|
 +
|}
<html>
<html>
-
<input type="button" value="Fit" onClick="alert(computeCost(arsenicModelConstants(),experiments));"/>
+
<input type="button" value="Fit" onClick="fitConstants();"/>
<script type="text/javascript" src="/Team:Groningen/Modelling/Arsenic.js?action=raw"></script>
<script type="text/javascript" src="/Team:Groningen/Modelling/Arsenic.js?action=raw"></script>
<script type="text/javascript" src="/Team:Groningen/Modelling/Model.js?action=raw"></script>
<script type="text/javascript" src="/Team:Groningen/Modelling/Model.js?action=raw"></script>
<script type="text/javascript">
<script type="text/javascript">
var experiments = [{constants:{Vc:0.0073e-3,Vs:(1.1-0.0073)*1e-3,beta4:0},AsT:10e-6*1e-3,
var experiments = [{constants:{Vc:0.0073e-3,Vs:(1.1-0.0073)*1e-3,beta4:0},AsT:10e-6*1e-3,
-
                     AsinT:[101.917808219178,394.520547945205,723.287671232877,
+
                     AsinT:[101.917808219178e-6,394.520547945205e-6,723.287671232877e-6,
-
                           1111.23287671233,1229.58904109589],
+
                           1111.23287671233e-6,1229.58904109589e-6],
-
                     time:[1,10,20,40,60]}];
+
                     time:[60,600,1200,2400,3600]}];
 +
 
function computeCost(c,e) {
function computeCost(c,e) {
   var cost = 0, n = 0, x0, xt, times;
   var cost = 0, n = 0, x0, xt, times;
   for(var i in e) {
   for(var i in e) {
-
    alert("Experiment "+i);
 
     var nc = {};
     var nc = {};
     for(var a in c) nc[a] = c[a];
     for(var a in c) nc[a] = c[a];
     for(var a in e[i].constants) nc[a] = e[i].constants[a];
     for(var a in e[i].constants) nc[a] = e[i].constants[a];
-
    times = [];
 
-
    for(var t=0; t<e[i].time.length; t++) times.push(60*e[i].time[t]);
 
-
    alert("Times "+times);
 
     x0 = arsenicModelInitialization(nc,e[i].AsT);
     x0 = arsenicModelInitialization(nc,e[i].AsT);
-
    alert("x0.AsinT "+x0.AsinT);
+
     xt = simulate(x0,e[i].time,function(t,d){return arsenicModelGradient(nc,d);});
-
     xt = simulate(x0,times,function(t,d){return arsenicModelGradient(nc,d);});
+
-
    alert("Ready simulating");
+
     for(var j in xt.timeKey) {
     for(var j in xt.timeKey) {
       cost += Math.pow(e[i].AsinT[j]-xt.AsinT[xt.timeKey[j]],2);
       cost += Math.pow(e[i].AsinT[j]-xt.AsinT[xt.timeKey[j]],2);
Line 85: Line 97:
   }
   }
   return Math.sqrt(cost/n);
   return Math.sqrt(cost/n);
 +
}
 +
 +
var varsToMutate = ['v5','K5'];
 +
function mutate(c) {
 +
  var vn = varsToMutate[Math.floor(Math.random()*varsToMutate.length)];
 +
  var nc = {};
 +
  for(var a in c) nc[a] = c[a];
 +
  if (Math.random()>=0.5) {
 +
    nc[vn] *= 2-Math.exp(-Math.random());
 +
  } else {
 +
    nc[vn] /= 2-Math.exp(-Math.random());
 +
  }
 +
  return nc;
 +
}
 +
 +
function fitConstants() {
 +
  var c = arsenicModelConstants();
 +
  c.v5 = 1e-3;
 +
  c.K5 = 1e-3;
 +
  var E = computeCost(c,experiments);
 +
  var cBest = c, EBest = E;
 +
  var numiter = 10000;
 +
  var iter = 0;
 +
  var timer = setInterval(function(){
 +
    iter++;
 +
    if (iter>numiter) {
 +
      clearInterval(timer);
 +
      return;
 +
    }
 +
    setOutput('iter',iter);
 +
    var cNew = mutate(c);
 +
    var ENew = computeCost(cNew,experiments);
 +
    if (ENew < EBest) {
 +
      cBest = cNew;
 +
      EBest = ENew;
 +
      setOutput('v5',cBest.v5);
 +
      setOutput('K5',cBest.K5);
 +
      setOutput('E',EBest);
 +
    }
 +
    var T = 1 - (iter/numiter);
 +
    if (ENew<E || Math.exp((E-ENew)/T)>=Math.random()) {
 +
      c = cNew;
 +
      E = ENew;
 +
      setOutput('v5cur',c.v5);
 +
      setOutput('K5cur',c.K5);
 +
      setOutput('Ecur',E);
 +
    }
 +
  },1);
}
}
</script>
</script>
</html>
</html>

Revision as of 14:31, 28 September 2009

Igemhomelogo.png


TODO: Talk about the devices we have and in what way we want to characterize them.

Uptake measurements

Sampling scheme
Time (min)
0 10 20 40 60
As(III)exT(0)
(µM)
0 x
10 x x x x x
20 x
50 x
100 x

To efficiently look at both time and concentration dependent processes we took samples as in the table on the right. Below we list all results, which have been used for fitting all necessary parameters.

TODO: List results. Take conversion from nmol/mg and mg/ml to µM and Vc/Vs into account.

best cur
v5
K5
E