|
|
Line 5: |
Line 5: |
| <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> | | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> |
| <script type="text/javascript" src="/Team:EPF-Lausanne/PrimerDesignHelper.js?action=raw&ctype=text/javascript"></script> | | <script type="text/javascript" src="/Team:EPF-Lausanne/PrimerDesignHelper.js?action=raw&ctype=text/javascript"></script> |
- | <script type="text/javascript">
| |
- | var tails = [
| |
- | {
| |
- | name: "Biobrick (gene)",
| |
- | value: "biobrickGene",
| |
- | primer1Tail: "GTT TCT TCG AAT TCG CGG CCG CTT CTA G",
| |
- | primer2Tail: "GTT TCT TCC TGC AGC GGC CGC TAC TAG TA TTA TTA",
| |
- | messages: [
| |
- | "Don't forget to include the first ATG and to exclude the stop codon!",
| |
- | "The recommended minimum length of a BioBrick primer is 20bp",
| |
- | "The recommended Tm of a BioBrick primer is between 55 and 65 °C",
| |
- | "Check that the following restriction sites are absent: EcoRI, SpeI, XbaI, PstI, NotI",
| |
- | "Check out <a href='http://openwetware.org/wiki/Synthetic_Biology:BioBricks/Part_fabrication'>OpenWetWare's reference page</a>"
| |
- | ],
| |
- | validate: function(primer1, primer2){
| |
- | var end = primer2.substr(0, 3).toUpperCase();
| |
- | // TAA TGA TAG
| |
- | if(end == "TTA" || end == "TCA" || end == "CTA"){
| |
- | return "<b>Remove the stop codons from the sequence!</b>"
| |
- | }
| |
- | }
| |
- | },
| |
- | {
| |
- | name: "Biobrick (other)",
| |
- | value: "biobrickOther",
| |
- | primer1Tail: "GTT TCT TCG AAT TCG CGG CCG CTT CTA GAG",
| |
- | primer2Tail: "GTT TCT TCC TGC AGC GGC CGC TAC TAG TA",
| |
- | messages: [
| |
- | "The recommended minimum length of a BioBrick primer is 20bp",
| |
- | "The recommended Tm of a BioBrick primer is between 55 and 65 °C",
| |
- | "Check that the following restriction sites are absent: EcoRI, SpeI, XbaI, PstI, NotI",
| |
- | "Check out <a href='http://openwetware.org/wiki/Synthetic_Biology:BioBricks/Part_fabrication'>OpenWetWare's reference page</a>"
| |
- | ]
| |
- | }
| |
- | ];
| |
- | window.calc = function(){
| |
- | var data = document.getElementById("data").value;
| |
- | var isNormal = document.getElementById("primerTypeNormal").checked;
| |
- | var isRS = document.getElementById("primerTypeRestrictionSites").checked;
| |
- | var isKnown = document.getElementById("primerTypeKnownTail").checked;
| |
- | var goalTm = document.getElementById("goalTm").value;
| |
- |
| |
- | try{
| |
- | var p = new Primer(data);
| |
- | var validate = function(primer1, primer2){};
| |
- |
| |
- | if(isRS){
| |
- | p.setTails(Sequence.fromString(document.getElementById("primer1Tail").value), Sequence.fromString(document.getElementById("primer2Tail").value));
| |
- | }
| |
- |
| |
- | var messages = [];
| |
- | if(isKnown){
| |
- | var selected = $("#knownTailSelect").val();
| |
- |
| |
- | var tail1 = "";
| |
- | var tail2 = "";
| |
- |
| |
- | for(var i = 0; i < tails.length; i++){
| |
- | if(tails[i].value == selected){
| |
- | tail1 = tails[i].primer1Tail;
| |
- | tail2 = tails[i].primer2Tail;
| |
- | if(tails[i].messages)
| |
- | messages = [].concat(tails[i].messages);
| |
- | if(tails[i].validate)
| |
- | validate = tails[i].validate;
| |
- | }
| |
- | }
| |
- |
| |
- | p.setTails(Sequence.fromString(tail1), Sequence.fromString(tail2));
| |
- | }
| |
- |
| |
- | var primers = p.generate(goalTm);
| |
- |
| |
- | /*if(isRS){
| |
- | var rand1 = Sequence.fromRandom($("#primerRandBases").val());
| |
- | var rand2 = Sequence.fromRandom($("#primerRandBases").val());
| |
- | primers.primer1 = rand1.toString()+" "+primers.primer1;
| |
- | primers.primer2 = rand2.toString()+" "+primers.primer2;
| |
- | primers.primer1Tailbp += rand1.length();
| |
- | primers.primer2Tailbp += rand2.length();
| |
- | }*/
| |
- |
| |
- | var result = validate(primers.primer1NoTail, primers.primer2NoTail);
| |
- |
| |
- | if(result)
| |
- | messages.push(result);
| |
- |
| |
- | if(messages.length > 0){
| |
- | window.output({
| |
- | primers: primers,
| |
- | messages: messages
| |
- | });
| |
- | }else{
| |
- | window.output({
| |
- | primers: primers
| |
- | });
| |
- | }
| |
- | }catch(e){
| |
- | window.output({
| |
- | error: e.message
| |
- | });
| |
- | }
| |
- | };
| |
- | window.output = function(options){
| |
- | var output = {
| |
- | message: [],
| |
- | primer1: "No data",
| |
- | primer1Temp: "NaN",
| |
- | primer1bp: "NaN",
| |
- | primer1Tailbp: "NaN",
| |
- | primer2: "No data",
| |
- | primer2Temp: "NaN",
| |
- | primer2bp: "NaN",
| |
- | primer2Tailbp: "NaN"
| |
- | };
| |
- | if(options.error){
| |
- | output.message.push(options.error);
| |
- | }
| |
- | if(options.messages){
| |
- | output.message = output.message.concat(options.messages);
| |
- | }
| |
- | if(options.primers){
| |
- | for(var key in options.primers){
| |
- | if(key == "message"){
| |
- | output[key].push(options.primers[key]);
| |
- | }else{
| |
- | output[key] = options.primers[key];
| |
- | }
| |
- | }
| |
- | }
| |
- |
| |
- | if(Math.abs(output.primer1Temp - output.primer2Temp) > 5){
| |
- | output.message.push("The difference is more than 5 °C");
| |
- | }
| |
- |
| |
- | if(Math.min(output.primer1Temp, output.primer2Temp) > 72){
| |
- | output.message.push("Consider using the two-step PCR protocol");
| |
- | }
| |
- |
| |
- | if(Math.min(output.primer1Temp, output.primer2Temp) < 45){
| |
- | output.message.push("The annealing temperature should be more than 45 °C");
| |
- | }
| |
- |
| |
- | document.getElementById("messages").innerHTML = output.message.length > 0 ? "<ul><li>"+output.message.join("</li><li>")+"</li></ul>" : "";
| |
- | document.getElementById("primer1").innerHTML = output.primer1;
| |
- | document.getElementById("primer1Temp").innerHTML = output.primer1Temp;
| |
- | document.getElementById("primer1bp").innerHTML = output.primer1Tailbp != 0 && output.primer1Tailbp != "NaN" ? output.primer1Tailbp+" + "+output.primer1bp : output.primer1bp;
| |
- | document.getElementById("primer2").innerHTML = output.primer2;
| |
- | document.getElementById("primer2Temp").innerHTML = output.primer2Temp;
| |
- | document.getElementById("primer2bp").innerHTML = output.primer2Tailbp != 0 && output.primer2Tailbp != "NaN" ? output.primer2Tailbp+" + "+output.primer2bp : output.primer2bp;
| |
- | document.getElementById("annealingTemp").innerHTML = Math.min(output.primer1Temp, output.primer2Temp);
| |
- | };
| |
- |
| |
- | window.updateRadioElements = function(){
| |
- | if(document.getElementById('primerTypeRestrictionSites').checked){
| |
- | $('#restrictionSiteRow').show();
| |
- | }else{
| |
- | $('#restrictionSiteRow').hide();
| |
- | }
| |
- | if(document.getElementById('primerTypeKnownTail').checked){
| |
- | $('#knownTailRow').show();
| |
- | }else{
| |
- | $('#knownTailRow').hide();
| |
- | }
| |
- | };
| |
- | </script>
| |
| <h1>Primer design helper</h1> | | <h1>Primer design helper</h1> |
| <p> | | <p> |