Number of mutations and mutated sequences
Expected number of mutations in a single sequence: $$p_{m} = \frac{N_{mutations} }{L_{Sequence} } = N_{generations} \cdot r_{mutation} = t_{total} \cdot \Phi \cdot r_{mutation}$$ The expected share of sequences that shows at least one mutation in \(L_{Sequence}\) bp is the probability that \(L_{sequence}\) basepairs stay unchanged when \(\frac{N_{mutations} }{L_{Sequence} }\) mutations are expected: $$p_{M} = \frac{N_{mutated} }{N_{Sequences} } = 1 - p(N_{mutations}=0) = 1 - (1-p_{m})^{L_{Sequence} } $$ With this equation we can also calculate the number of sequences \(N_{Sequences}\) that have to be sequenced in order to find a mutated one with a probability of \(p(N_{mutated} > 0)\). $$ N_{Sequences} = \frac{p(N_{mutated} > 0)}{p_{M} } $$ The probability to find at least one mutated sequence under the given conditions is $$p(N_{mutated}>0) = 1 - (1-p_{M})^{N_{sequences} }$$ which gives $$N_{Sequences} = \frac{ln(1-p(N_{mutated}>0))}{ln(1-p_{M})}$$ Set \(\Phi\) to zero to use the number of generations for the calculation. If \(\Phi\) and the number of generations are given, \(\Phi\) is used. Consider \(L_{Sequence}\) as the number of basepairs that is expected to be mutated. If half of the sequence you are interested in, is highly conserved choose a lower \(L_{Sequence}\).\(p_{m} =\) %(bp/bp).
\(N_{mutations} =\) bp per sequence.
The share of sequences that shows at least one mutation in \(L_{Sequence}\) bp is \(p_{M}=\) % of sequences
Diff tool
Marks differences in two strings, ignores newlines.Glucose Concentratoin
Calculate the ideal glucose concentration in the medium used for either a turbidostat or a single flask. The glucose concentration in the turbidostat \(c_{G_{T} }\) is increased with the incoming medium with a flow rate of \(\Phi\) and a glucose concentration of \(c_{G_{M} }\). It is decreased by with the medium that leaves the turbidostat with the same flow rate, but a glucose concentration of \(c_{G_{T} }\). Additionally E. coli take up glucose with a concentration of \(c_{E}\) and a rate of \(q\). $$ \frac{\partial c_{G_{T} }(t)}{\partial t} = \Phi \cdot c_{G_{M} } - \Phi \cdot c_{G_{T} } - c_{E} \cdot q $$ In the case of a turbidostat we can assume a dynamic equilibrium: $$ \frac{\partial c_{G_{T} }(t)}{\partial t} = 0 $$ This results in $$ c_{G_{T} } = c_{G_{M} } - \frac{c_{E. coli} \cdot q}{\Phi} $$ $$ \Leftrightarrow c_{G_{M} } (c_{G_{T} }) = c_{G_{T} } + \frac{c_{E} \cdot q}{\Phi} $$ When a lagoon with Volume \(V_{L}\) and a flowrate of \(\Phi_{L}\) is supplied by the turbidostat the glucose consumption in that lagoon can be modeled the same way. Because the E. coli titer, glucose concentration and flow rate into the lagoon are constant, a steady state equilibrium can be assumed: $$ c_{G_{L} } = c_{G_{T} } - \frac{c_{E. coli} \cdot q}{\Phi_{L} } $$ In the context of PACE mutagenesis plasmids are induced in the lagoons which stops growth of E. coli, hence the E. coli titer is assumed to be the same as in the turbidostat. $$ c_{G_{L} } = c_{G_{M} } - \frac{c_{E} \cdot q}{\Phi} - \frac{c_{E} \cdot q}{\Phi_{L} } $$ $$ \Leftrightarrow c_{G_{M} } (c_{G_{L} }) = c_{G_{L} } + \frac{c_{E} \cdot q}{\Phi} + \frac{c_{E} \cdot q}{\Phi_{L} } $$If the concentration of glucose in a flask, \(c_{G_{F} }\) needs to be determined, the functional dependencies are as follows. As there is no incoming medium, or medium that leaves the flask, the concentration of glucose is only changed by E. coli degrading it. $$ \frac{\partial c_{G_{F} }(t)}{\partial t} = q \cdot \int_{t_{0} }^{t} c_{E}(t) \: dt $$ Exponential growth of the E. coli is assumed, resulting in $$c_{G_{F} }(t) = c_{G_{F} }(t_{0}) - q \cdot \int_{t_{0} }^{t} c_{E}(t) \: dt $$ $$ = c_{G_{F} }(t_{0}) -q \cdot \int_{t_{0} }^{t} c_{E}(t_{0}) \cdot exp\left(\frac{ln(2) \cdot t}{t_{E} }\right) dt $$ $$ = c_{G_{F} }(t_{0}) - q \cdot c_{E}(t_{0}) \cdot t_{E} \cdot \left(exp\left(\frac{ln(2) \cdot t}{t_{E} }\right) - exp\left(\frac{ln(2) \cdot t_{0} }{t_{E} }\right)\right) $$ So the glucose starting concentration \(c_{G_{F} }(t_{0})\) needed to get a concentration of \(c_{G_{f} }(t)\) afer a duration of \(t\) is calculated by $$ c_{G_{F} }(t_{0}) = c_{G_{F} }(t) + q \cdot c_{E}(t_{0}) \cdot t_{E} \cdot \left(exp\left(\frac{ln(2) \cdot t}{t_{E} }\right) - exp\left(\frac{ln(2) \cdot t_{0} }{t_{E} }\right)\right) $$ If logistic growth is assumed, the term for \(c_{E}(t)\) changes. Here \(c_{c}\) is the capacity, the maximum concentration of E. coli under the present conditions. $$ c_{G_{F} }(t) = c_{G_{F} }(t_{0}) - q \cdot \int_{t_{0} }^{t} c_{E}(t) \: dt $$ $$ = c_{G_{F} } (t_{0}) -q \int_{t_{0} }^{t} \frac{c_{E}(t_{0}) \: exp \big(ln(2) \cdot \frac{t}{t_{E} } \big)}{1+ \frac{c_{E}(t_{0})}{c_{c} } \: exp \big(ln(2) \cdot \frac{t}{t_{E} }\big)} \: dt $$ $$ = c_{G_{F} } (t_{0}) - q \: \frac{t_{E} \cdot c_{c} }{ln(2)} \cdot ln \Bigg( \frac{1 + \frac{c_{E}(t_{0})}{c_{c} } exp\big(ln(2) \: \frac{t}{t_{e} } \big)}{1 + \frac{c_{E}(t_{0})}{c_{c} } } \Bigg) $$ So the glucose starting concentration \(c_{G_{F} }(t_{0})\) needed to get a concentration of \(c_{G_{f} }(t)\) afer a duration of \(t\) is calculated by $$ c_{G_{F} } (t_{0}) = c_{G_{F} } (t) + q \: \frac{t_{E} \cdot c_{c} }{ln(2)} \cdot ln \Bigg( \frac{1 + \frac{c_{E}(t_{0})}{c_{c} } exp\big(ln(2) \: \frac{t}{t_{e} } \big)}{1 + \frac{c_{E}(t_{0})}{c_{c} } } \Bigg) $$
Further calculations for simplification of entering data: $$ c_{E. coli_{DW} } = c_{E. coli_{OD600} } \cdot 0.36 $$ according to Milo et al.
References
<script type="text/javascript">
var call = 0;
//example that contains everything needed function dummy(){
//get the values var mr = Number(document.getElementById('mr').value);
//initialise variables var a_mutations = 0;
//calculate if(phi==0){ a_mutations = ng * mr; }
//return the results $("#amount_mutated").html((Math.round(100000 * a_mutated))/1000); $("#number_generations").html(ng_out);
//end the function return false;
}
function number_mutations(){
//get the values var mr = Number(document.getElementById('mr').value); var phi = Number(document.getElementById('phi').value); var ng = Number(document.getElementById('ng').value); var tt = Number(document.getElementById('tt').value); var ls = Number(document.getElementById('ls').value); var ns = Number(document.getElementById('ns').value); var pm = Number(document.getElementById('pm').value);
//initialise variables var a_mutations = 0; var n_mutations = '?'; var a_mutated = '?'; var ng_out = ""; var number_to_seq_out = ""; var number_to_seq = 0; var probability_positive_sequencing = var warnings = ""
//Check, if given values make sense:
if(mr>1){ warnings += "A mutation rate that is above one mutation per basepair, per generation does not make sense. 100 % should be enough, right? "; mr = 1; }
if(pm>1){ warnings += "A probability of 100 % should be enough, right?. "; pm = 1; }
//calculate if(phi*tt==0){ a_mutations = 1 - Math.pow((1 - mr), ng); ng_out = ""; } else{ a_mutations = 1 - Math.pow((1 - mr), tt*phi); ng = tt*phi; ng_out = "The conditions result in " + ng + " generations."; }
n_mutations = ls * a_mutations; a_mutated = 1 - Math.pow((1-a_mutations), ls);
if(ns!=0){ probability_positive_sequencing = ns*a_mutated; $("#probability_positive_sequencing").html("Sequencing " + ns + " sequences results in a " + ((Math.round(probability_positive_sequencing*100))/100) + "% probabiltiy of finding at least one mutated sequence."); } else{ $("#probability_positive_sequencing").html(""); }
if(pm!=0){ number_to_seq = Math.max(1, Math.round((Math.log(1-pm))/(Math.log(1-a_mutated)))); if(isNaN(number_to_seq)){ if(pm==1){ number_to_seq_out = "To be 100 % sure, sequence infinitely many sequences."; } else{ number_to_seq_out = "Unluckily we were unable to calculate the number of sequences to sequence to have a " + (pm*100) + "% probability for a positive result."; } } else{ number_to_seq_out = "Sequence " + number_to_seq + " clones to have a " + (pm*100) + " % probability to have at least one mutated under the results."; } }
//return the results $("#amount_mutations").html((Math.round(1000000 * a_mutations))/10000); $("#number_mutations").html((Math.round(n_mutations*100))/100); $("#amount_mutated").html((Math.round(100000 * a_mutated))/1000); $("#number_generations").html(ng_out); $("#number_to_seq").html(number_to_seq_out); $("#warnings_mutations").html(warnings);
//end the function return false;
}
</script> <script type="text/javascript">
function glucosecont(){
glucose('cont');
} function glucosecont_lagoon(){
glucose('cont_lagoon');
} function glucosecont_forward(){
glucose('cont_forward');
}
function glucosedis(){
glucose('dis');
} function glucosedisnew(){
glucose('disnew');
}
function glucosedis_forward(){
glucose('disforward');
} function glucosedisnew_forward(){
glucose('disnewforward');
}
</script> <script type="text/javascript">
console.log('alive');
function glucose(mode){
//get the values var cturbidostat = Number(document.getElementById('cturbidostat').value); var cturbidostatmol = Number(document.getElementById('cturbidostatmol').value); var fr = Number(document.getElementById('fr').value); var ectiterod = Number(document.getElementById('ectiterod').value); var ectiterdw = Number(document.getElementById('ectiterdw').value); var q = Number(document.getElementById('q').value); var te = Number(document.getElementById('te').value); var gluc_time = Number(document.getElementById('gluc_time').value); var ec0dw = Number(document.getElementById('ec0dw').value); var ec0od = Number(document.getElementById('ec0od').value); var vl = Number(document.getElementById('vl').value); var phil = Number(document.getElementById('phil').value); var cmaxod = Number(document.getElementById('cmaxod').value); var cmaxdw = Number(document.getElementById('cmaxdw').value); var logistic = document.getElementById("logistic").checked; //initialise variables var glucoseout = ""; var frl = 0; var glucosemedium = 0; var gl_OD = 0.36; frl = phil*60/vl; if(ectiterdw == 0){ ectiterdw = ectiterod * gl_OD; } else{ ectiterod = ectiterdw/gl_OD; } if(cturbidostatmol != 0){ cturbidostat = cturbidostatmol * 180.1559/1000.0; } else{ cturbidostatmol = cturbidostat/(180.1559/1000.0); } if(te != 0){ fr = 60.0 * Math.LN2/te; } else{ te = fr * Math.LN2/60.0; } if(ec0dw == 0){ ec0dw = ec0od * gl_OD; } else{ ec0od = ec0dw/gl_OD; } if(cmaxdw == 0){ cmaxdw = cmaxod * gl_OD; } else{ cmaxod = cmaxdw/gl_OD; } if(mode == 'cont'){ //calculate glucosemedium = cturbidostat + ((ectiterdw * q)/fr);
var glucosemediummol = glucosemedium/(180.1559/1000.0);
//return the results glucoseout = "With a glucose concentration of " + (0.01*Math.round(100*glucosemedium)) + " g/L, " + (0.01*Math.round(100*glucosemediummol)) + "mmol/l in the medium, a flow rate of " + (0.01*Math.round(100*fr)) + " Volumes/h, or a generation time of " + Math.round(te) + " min, an E. coli titer of " + (0.01*Math.round(100*ectiterdw)) + " g/l, an OD600 of " + (0.01*Math.round(100*ectiterod)) + " and a degradation rate of " + (0.01*Math.round(100*q)) + " g l-1cfu-1h-1 a concentration of " + (0.01*Math.round(100*cturbidostat)) + " g/L, " + (0.01*Math.round(100*cturbidostatmol)) + " mmol/l is maintained."; $("#glucoseplot").html();
} else if(mode=='cont_lagoon'){ glucosemedium_lagoon = cturbidostat + ((ectiterdw * q)/fr) + ((ectiterdw * q)/fr); glucose_turbidostat = glucosemedium_lagoon - ((ectiterdw * q)/fr); var glucose_turbidostat_mol = glucose_turbidostat/(180.1559/1000.0);
var glucosemedium_lagoon_mol = glucosemedium_lagoon/(180.1559/1000.0);
//return the results glucoseout = "With a glucose concentration of " + (0.01*Math.round(100*glucosemedium_lagoon)) + " g/l, " + (0.01*Math.round(100*glucosemedium_lagoon_mol)) + "mmol/l in the medium, a turbidostat flow rate of " + (0.01*Math.round(100*fr)) + " Volumes/h, or a generation time of " + Math.round(te) + " min, a lagoon with a volume of " + vl + " ml and a flow rate of " + phil + " ml/min, an E. coli titer of " + (0.01*Math.round(100*ectiterdw)) + " g/l, an OD600 of " + (0.01*Math.round(100*ectiterod)) + " and a degradation rate of " + (0.01*Math.round(100*q)) + " g l-1cfu-1h-1 a concentration of " + (0.01*Math.round(100*cturbidostat)) + " g/L, " + (0.01*Math.round(100*cturbidostatmol)) + " mmol/l in the lagoon is maintained. Under this conditions the in the turbidostat the glucose concentration is " + (0.01*Math.round(100*glucose_turbidostat)) + "g/l, " + (0.01*Math.round(100*glucose_turbidostat_mol)) + " mmol/l." ; $("#glucoseplot").html(); } else if(mode=='cont_forward'){ glucosemedium_lagoon = Math.max(0, cturbidostat - ((ectiterdw * q)/fr) - ((ectiterdw * q)/fr)); glucose_turbidostat = Math.max(0, cturbidostat - ((ectiterdw * q)/fr)); var glucose_turbidostat_mol = glucose_turbidostat/(180.1559/1000.0);
var glucosemedium_lagoon_mol = glucosemedium_lagoon/(180.1559/1000.0);
//return the results glucoseout = "With a glucose concentration of " + (0.01*Math.round(100*cturbidostat)) + " g/l, " + (0.01*Math.round(100*cturbidostatmol)) + "mmol/l in the medium</b>, a turbidostat flow rate of " + (0.01*Math.round(100*fr)) + " Volumes/h, or a generation time of " + Math.round(te) + " min, a lagoon with a volume of " + vl + " ml and a flow rate of " + phil + " ml/min, an E. coli titer of " + (0.01*Math.round(100*ectiterdw)) + " g/l, an OD600 of " + (0.01*Math.round(100*ectiterod)) + " and a degradation rate of " + (0.01*Math.round(100*q)) + " g l-1cfu-1h-1 a concentration of " + (0.01*Math.round(100*glucosemedium_lagoon)) + " g/L, " + (0.01*Math.round(100*glucosemedium_lagoon_mol)) + " mmol/l in the lagoon is maintained. Under this conditions the in the turbidostat the glucose concentration is " + (0.01*Math.round(100*glucose_turbidostat)) + "g/l, " + (0.01*Math.round(100*glucose_turbidostat_mol)) + " mmol/l." ; $("#glucoseplot").html(); } else{ if(mode.endsWith('forward')){ glucosemedium = cturbidostat; if(logistic){
cturbidostat = Math.max(0, glucosemedium - q * ((te * cmaxdw)/Math.LN2) * Math.log((1+(((ec0dw/cmaxdw) * Math.exp(Math.LN2 * gluc_time/te))))/1+(ec0dw/cmaxdw))); }
else{ cturbidostat = Math.max(0, glucosemedium - q * ec0dw * te * (Math.exp(Math.LN2 * gluc_time/te) - 1)); } } else{ if(logistic){ glucosemedium = Math.max(0, cturbidostat + (q * ((te * cmaxdw)/Math.LN2) * Math.log((1 + ((ec0dw/cmaxdw) * Math.exp(Math.LN2 * gluc_time/te)))/(1 + (ec0dw/cmaxdw))))); } else{ glucosemedium = Math.max(0, cturbidostat + q * ec0dw * te * (Math.exp(Math.LN2 * gluc_time/te) - 1)); } } var glucosemediummol = glucosemedium/(180.1559/1000.0); var od_warning = ""; var end_od = ec0od * Math.exp(Math.LN2 * gluc_time/te); if(end_od > 1.0){ if(!logistic){ od_warning = "
Warning: With an OD of " + end_od + " the E. coli are not in exponential phase at the end of the experiment. This model is designed for applications with E. coli in exponential phase and therfore assumes exponential growth. The glucose consumption is overestimated as well as the concentration in the medium needed to reach the desired concentration.";
}
}
//return the results glucoseout = "With a glucose concentration of " + (0.01*Math.round(100*Math.max(0,glucosemedium))) + " g/L, " +(0.01*Math.round(100*Math.max(0,glucosemediummol))) + "mmol/l in the medium, a generation time of " + (0.01*Math.round(100*te)) + " min, an E. coli starting titer of " + (0.01*Math.round(100*ec0dw)) + " g/l, an OD600 of " + (0.01*Math.round(100*ec0od)) + " and a degradation rate of " + (0.0001*Math.round(10000*q)) + " g l-1cfu-1h-1 a concentration of " + (0.01*Math.round(100*cturbidostat)) + " g/L, " + (0.01*Math.round(100* cturbidostatmol)) + " mmol/l is reached after " + gluc_time + " minutes." + od_warning; if(logistic){ glucoseout += " This calculation assumed logistic growth with a maximum capacity of OD600 = " + cmaxod + ", " + cmaxdw + " g/L dryweight."; } else{ glucoseout += " This calculation assumed exponential growth."; } } $("#glucoseout").html(glucoseout); //plot glucose concentration and e. coli titer if(mode.startsWith('dis')){ if(mode.startsWith('disnew')){ call = 0; } var glucoseplot = document.getElementById('glucoseplot'); var gluc_time_exp = 1.25 * gluc_time; var t = new Array(501); var cecoli = new Array(501); var cg = new Array(501); if(logistic){ for(var it = 0; it <=500; it++){ t[it] = it*gluc_time_exp/500;
cecoli[it] = Math.max(0, (ec0od * Math.exp(Math.LN2 * t[it]/te))/(1 + (ec0od/cmaxod) * Math.exp(Math.LN2 * (t[it]/te))));
cg[it] = Math.max(0, glucosemedium - (q * ((te * cmaxdw)/Math.LN2) * Math.log((1 + (ec0dw/cmaxdw) * Math.exp(Math.LN2 * t[it]/te))/(1 + (ec0dw/cmaxdw))))); } } else{ for(var it = 0; it <=500; it++){ t[it] = it*gluc_time_exp/500;
cecoli[it] = Math.max(0, ec0od * Math.exp(Math.LN2 * t[it]/te));
cg[it] = Math.max(0, glucosemedium - (q * ec0dw * te * (Math.exp(Math.LN2 * (t[it]/te)) - 1.0))); } } var xticks = [0, (gluc_time/4), (2*gluc_time/4), (3*gluc_time/4), (gluc_time), (gluc_time*1.25)]; var ecolicolors = ['#005493', '#6698BE', '#B2CBDD', '#009193', '#66BDEE', '#B3DEDE']; var glucosecolors = ['#9D1C20', '#BB5651', '#D89F9C', '#F8991D', '#FBB748', '#FED699']; if(cg[0] == 0){ var glucrange = [-0.1, 1.1]; } else{ var glucrange = [-0.1*cg[0], cg[0]*1.1]; } var glucosedata = [{x: t, y: cg, name: 'Glucose [g/l] ' + (call+1), line: {color: glucosecolors[call % glucosecolors.length]}, hoverlabel: {font: {family: 'Josefin Sans'}} }, {x: t, y: cecoli, name: 'E. coli [OD600] ' + (call+1), yaxis: 'y2', line: {color: ecolicolors[call % glucosecolors.length]}, hoverlabel: {font: {family: 'Josefin Sans'}} }]; var color = '#393939'; var font = { family: 'Josefin Sans', size: 18, color: color }; var layout = { title: 'Glucose concentration and phage titer in discontinuous culture', showlegend: true, width: 800, font: font, legend: { orientation: 'v', x: 1.15, xanchor: 'left', y: 1 }, xaxis: { title: 'Duration [min]', titlefont: font, showgrid: false, ticks: 'outside', ticklen: 2, tickwidth: 2, tickfont: font, tickvals: xticks, tickmode: 'array', linecolor: color, linewidth: 3, zeroline: false }, yaxis: { title: 'Glucose concentration [g/l]', titlefont: font, showgrid: false, ticks: 'outside', ticklen: 2, tickwidth: 2, tickfont: font, tick0: 0, dtick: glucrange[1]/7.0, linecolor: color, linewidth: 3, zeroline: false, range: glucrange }, yaxis2: { range: [0.0, Math.min(1.0, cecoli[500])], title: 'E. coli titer [OD600]', side: 'right', overlaying: 'y', titlefont: font, showgrid: false, ticks: 'outside', ticklen: 2, tickwidth: 2, tickfont: font, tick0: 0, dtick: cecoli[cecoli.length-1]*1.1/7.0, linecolor: color, linewidth: 3, zeroline: false, range: [-0.1*cecoli[cecoli.length-1], cecoli[cecoli.length-1]*1.1] }, shapes: [{ type: 'line', x0: gluc_time, x1: gluc_time, y0: glucrange[0], y1: glucrange[1], line:{ width: 2, color: color, }, visible: true }] };
if(mode.startsWith('disnew') || call == 0){ Plotly.newPlot(glucoseplot, glucosedata, layout); call++; } else{ Plotly.plot(glucoseplot, glucosedata, layout); call++; } }
}
</script>
<script type="text/javascript">
function differences(){
//get the values var str1 = document.getElementById('str1').value; var str2 = document.getElementById('str2').value; str1 = str1.replace(/(\r\n|\n|\r)/gm,""); str2 = str2.replace(/(\r\n|\n|\r)/gm,"");
//initialise variables var diff = []; var outstr1 = ""; var outstr2 = ""; var diffs = 0; var lendiffs = 0; var sharedlen = 0; var diffinfo = ""; var str1_comp = str1; var str2_comp = str2; //calculate if(document.getElementById("case_sensitive").checked == false){ str1_comp = str1.toLowerCase(); str2_comp = str2.toLowerCase(); } var i = 0; while(i < str1.length){ if(i==str2.length){ break; } if(str1_comp[i]==str2_comp[i]){ outstr1 += str1[i]; outstr2 += str2[i]; } else{ diffs += 1; outstr1 += '' + str1[i] + ''; outstr2 += '' + str2[i] + ''; } i++; } sharedlen = i; while(i < str1.length){ outstr1 = outstr1 + '' + str1[i] + ''; i++; lendiffs++; } while(i < str2.length){ outstr2 = outstr2 + '' + str2[i] + ''; i++; lendiffs++; } diffinfo = "The strings are different for " + diffs + " from " + sharedlen + " positions (" + (0.01*Math.round(10000*(diffs/sharedlen))) + "%)and their length differs by " + lendiffs + " positions.";
//return the results $("#outstr1").html(outstr1); $("#outstr2").html(outstr2); $("#diffinfo").html(diffinfo);
//end the function return false;
}
</script>