Team:Amsterdam/maarten/
From 2012.igem.org
(Difference between revisions)
Line 3: | Line 3: | ||
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script> | <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script> | ||
<script type='text/javascript'> | <script type='text/javascript'> | ||
+ | |||
+ | (function() { | ||
+ | var ua = navigator.userAgent, | ||
+ | iStuff = ua.match(/iPhone/i) || ua.match(/iPad/i), | ||
+ | typeOfCanvas = typeof HTMLCanvasElement, | ||
+ | nativeCanvasSupport = (typeOfCanvas == 'object' || typeOfCanvas == 'function'), | ||
+ | textSupport = nativeCanvasSupport | ||
+ | && (typeof document.createElement('canvas').getContext('2d').fillText == 'function'); | ||
+ | //I'm setting this based on the fact that ExCanvas provides text support for IE | ||
+ | //and that as of today iPhone/iPad current text support is lame | ||
+ | labelType = (!nativeCanvasSupport || (textSupport && !iStuff))? 'Native' : 'HTML'; | ||
+ | nativeTextSupport = labelType == 'Native'; | ||
+ | useGradients = nativeCanvasSupport; | ||
+ | animate = !(iStuff || !nativeCanvasSupport); | ||
+ | })(); | ||
+ | |||
+ | var Log = { | ||
+ | elem: false, | ||
+ | write: function(text){ | ||
+ | if (!this.elem) | ||
+ | this.elem = document.getElementById('log'); | ||
+ | this.elem.innerHTML = text; | ||
+ | this.elem.style.left = (500 - this.elem.offsetWidth / 2) + 'px'; | ||
+ | } | ||
+ | }; | ||
+ | |||
+ | function visualization(number){ | ||
+ | $('#infovis').empty() | ||
+ | json = JSON.parse(unescape($(':input[name=json'+number+']').val())) | ||
+ | //init data | ||
+ | //init Sunburst | ||
+ | var sb = new $jit.Sunburst({ | ||
+ | //id container for the visualization | ||
+ | injectInto: 'infovis', | ||
+ | //Distance between levels | ||
+ | levelDistance: 90, | ||
+ | //Change node and edge styles such as | ||
+ | //color, width and dimensions. | ||
+ | Node: { | ||
+ | overridable: true, | ||
+ | type: useGradients? 'gradient-multipie' : 'multipie' | ||
+ | }, | ||
+ | //Select canvas labels | ||
+ | //'HTML', 'SVG' and 'Native' are possible options | ||
+ | Label: { | ||
+ | type: labelType | ||
+ | }, | ||
+ | //Change styles when hovering and clicking nodes | ||
+ | NodeStyles: { | ||
+ | enable: true, | ||
+ | type: 'Native', | ||
+ | stylesClick: { | ||
+ | 'color': '#000000' | ||
+ | }, | ||
+ | }, | ||
+ | //Add tooltips | ||
+ | Tips: { | ||
+ | enable: true, | ||
+ | onShow: function(tip, node) { | ||
+ | var html = "<div class=\"tip-title\">" + node.data.description + "</div>"; | ||
+ | var data = node.data; | ||
+ | if("length" in data) { | ||
+ | html += "<b>Length of feature:</b> " + data.length + "bp"; | ||
+ | } | ||
+ | if("type" in data){ | ||
+ | html += "<br\><b>Type of feature:</b> " + data.type; | ||
+ | } | ||
+ | tip.innerHTML = html; | ||
+ | } | ||
+ | }, | ||
+ | //implement event handlers | ||
+ | Events: { | ||
+ | enable: true, | ||
+ | onClick: function(node) { | ||
+ | if(!node) return; | ||
+ | //Build detailed information about the file/folder | ||
+ | //and place it in the right column. | ||
+ | var html = "<h4>" + node.name + "</h4>", data = node.data; | ||
+ | if("dna" in data) { | ||
+ | html += "<br /><br /><b>Sequence:</b><br /><pre>" + data.dna + "</pre>"; | ||
+ | } | ||
+ | $jit.id('inner-details').innerHTML = html; | ||
+ | //hide tip | ||
+ | sb.tips.hide(); | ||
+ | //rotate | ||
+ | //sb.rotate(node, animate? 'animate' : 'replot', { | ||
+ | //duration: 1000, | ||
+ | //transition: $jit.Trans.Quart.easeInOut | ||
+ | //}); | ||
+ | } | ||
+ | }, | ||
+ | // Only used when Label type is 'HTML' or 'SVG' | ||
+ | // Add text to the labels. | ||
+ | // This method is only triggered on label creation | ||
+ | onCreateLabel: function(domElement, node){ | ||
+ | var labels = sb.config.Label.type, | ||
+ | aw = node.getData('length'); | ||
+ | if (labels === 'HTML' && (node._depth < 2 || aw > 2000)) { | ||
+ | domElement.innerHTML = node.name; | ||
+ | } else if (labels === 'SVG' && (node._depth < 2 || aw > 2000)) { | ||
+ | domElement.firstChild.appendChild(document.createTextNode(node.name)); | ||
+ | } | ||
+ | }, | ||
+ | // Only used when Label type is 'HTML' or 'SVG' | ||
+ | // Change node styles when labels are placed | ||
+ | // or moved. | ||
+ | onPlaceLabel: function(domElement, node){ | ||
+ | var labels = sb.config.Label.type; | ||
+ | if (labels === 'SVG') { | ||
+ | var fch = domElement.firstChild; | ||
+ | var style = fch.style; | ||
+ | style.display = ''; | ||
+ | style.cursor = 'pointer'; | ||
+ | style.fontSize = "0.8em"; | ||
+ | fch.setAttribute('fill', "#fff"); | ||
+ | } else if (labels === 'HTML') { | ||
+ | var style = domElement.style; | ||
+ | style.display = ''; | ||
+ | style.cursor = 'pointer'; | ||
+ | style.fontSize = "0.8em"; | ||
+ | style.color = "#ddd"; | ||
+ | var left = parseInt(style.left); | ||
+ | var w = domElement.offsetWidth; | ||
+ | style.left = (left - w / 2) + 'px'; | ||
+ | } | ||
+ | } | ||
+ | }); | ||
+ | //load JSON data. | ||
+ | sb.loadJSON(json); | ||
+ | //compute positions and plot. | ||
+ | sb.refresh(); | ||
+ | |||
+ | //end | ||
+ | } | ||
+ | |||
+ | function addForbiddenSequences(){ | ||
+ | forbiddenSequences.addSite('Forbidden-EcoRI','GAATTC') | ||
+ | forbiddenSequences.addSite('Forbidden-XbaI','GAATTC') | ||
+ | forbiddenSequences.addSite('Forbidden-SpeI','ACTAGT') | ||
+ | forbiddenSequences.addSite('Forbidden-PstI','CTGCAG') | ||
+ | forbiddenSequences.addSite('Forbidden-NotI','GCGGCCGC') | ||
+ | } | ||
+ | |||
+ | var forbiddenSequences = { | ||
+ | forbiddenSequencesArray : {}, | ||
+ | addSite : function(name,sequence){ | ||
+ | forbiddenSequences.forbiddenSequencesArray[name] = sequence | ||
+ | }, | ||
+ | } | ||
+ | |||
+ | function checkOccurrence(target,sequence){ | ||
+ | if (sequence.length > target.length){ | ||
+ | if (sequence.indexOf(target) == -1){ | ||
+ | return false | ||
+ | } else{ | ||
+ | return true | ||
+ | } | ||
+ | } else{ | ||
+ | if (target.indexOf(sequence) == -1){ | ||
+ | return false | ||
+ | } else{ | ||
+ | return true | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function randomDNA(length){ | ||
+ | chars = 'atgc' | ||
+ | inForbiddenSite = true | ||
+ | while (inForbiddenSite === true){ | ||
+ | sequence = '' | ||
+ | inForbiddenSite = false | ||
+ | for (k=0; k<length; k++) { | ||
+ | rnum = Math.floor(Math.random() * chars.length); | ||
+ | sequence += chars.substring(rnum,rnum+1); | ||
+ | } | ||
+ | for (item in forbiddenSequences.forbiddenSequencesArray){ | ||
+ | if (checkOccurrence(sequence,forbiddenSequences.forbiddenSequencesArray[item].toLowerCase()) === false){ | ||
+ | continue | ||
+ | } else{ | ||
+ | inForbiddenSite = true | ||
+ | break | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | return sequence | ||
+ | } | ||
+ | |||
+ | function getMethyltransferases(){ | ||
+ | methyltransferases = new Array() | ||
+ | sca1 = new Object() | ||
+ | sca1.target = "AGTACT" | ||
+ | sca1.sequence = "tccgggcgggactttggatatgtgatacagtcgtccgctgcactatggaatcgactctctacattctcacagagaggaaaagccttggacaccaggcttgcagacatcaagaaggccctggggaagccgtactacgaaacctcggatgtccttctttaccacggcgacagtcttgagctgctcaagtcaatgcctcagcagattttcgaccttaccgtaactagcccaccttacaatattggcaaagagtacgagggtgtactgtcgatcgaggaatacatttcctggtgcgagacatggatgtcgcgcgttcatagggcgaccagcgcaggcggcgcattttggctcaatgttgggtacgtccctgtcccgaaccaaggaaaagcagtcccgattccttacctcttgtgggacaagagtccgttctacatgatccaggaagttgtctggaattacggggcgggagtggcgtctcgaaaatcgttttccccgcgcaatgaaaagtttctctggtatgtgcgcgacccgctgaattattacttcgacctcgattcggtgcgcgacccaaatgtgaaataccccaaccagaaaaagaatgggaagctcaaatgcaacccgttggggaaaaatcccactgacgtttggcagttccccaaggttacgtcgggcgcgaagagatcaagcgtggagcgcaccgcccatccggcacaattcccgtctgctgtcattgaacgggtcatcaaggcgtgcagcccttccgacggcgtcatcctggacccattcctcggttccggaacgacctcgctgaccgccagaaagcaaggccggtgcagcgtcggtatcgaaatccgcgaagactacctcgacatcgcggtgggacgcctggaggcggaggcgcaatccctcttctag" | ||
+ | sca1.description = "M.Sca1" | ||
+ | sca2 = new Object() | ||
+ | sca2.target = "AGTACC" | ||
+ | sca2.sequence = "tccgggcgggactttggatatgtgatacagtcgtccgctgcactatggaatcgactctctacattctcacagagaggaaaagccttggacaccaggcttgcagacatcaagaaggccctggggaagccgtactacgaaacctcggatgtccttctttaccacggcgacagtcttgagctgctcaagtcaatgcctcagcagattttcgaccttaccgtaactagcccaccttacaatattggcaaagagtacgagggtgtactgtcgatcgaggaatacatttcctggtgcgagacatggatgtcgcgcgttcatagggcgaccagcgcaggcggcgcattttggctcaatgttgggtacgtccctgtcccgaaccaaggaaaagcagtcccgattccttacctcttgtgggacaagagtccgttctacatgatccaggaagttgtctggaattacggggcgggagtggcgtctcgaaaatcgttttccccgcgcaatgaaaagtttctctggtatgtgcgcgacccgctgaattattacttcgacctcgattcggtgcgcgacccaaatgtgaaataccccaaccagaaaaagaatgggaagctcaaatgcaacccgttggggaaaaatcccactgacgtttggcagttccccaaggttacgtcgggcgcgaagagatcaagcgtggagcgcaccgcccatccggcacaattcccgtctgctgtcattgaacgggtcatcaaggcgtgcagcccttccgacggcgtcatcctggacccattcctcggttccggaacgacctcgctgaccgccagaaagcaaggccggtgcagcgtcggtatcgaaatccgcgaagactacctcgacatcgcggtgggacgcctggaggcggaggcgcaatccctcttctagg" | ||
+ | sca2.description = "M.Sca2" | ||
+ | methyltransferases[0] = sca1 | ||
+ | methyltransferases[1] = sca2 | ||
+ | addForbiddenSequence(methyltransferases,'hasTarget') | ||
+ | return methyltransferases | ||
+ | } | ||
+ | |||
+ | function getZincFingers(){ | ||
+ | zincFingers = new Array() | ||
+ | rawData = document.plasmidForm.zf.value | ||
+ | rawData = rawData.split('>') | ||
+ | rawData.reverse().pop() | ||
+ | rawData.reverse() | ||
+ | for (zf in rawData){ | ||
+ | zfFormatted = rawData[zf].split('\n') | ||
+ | zfDescription = zfFormatted[0] | ||
+ | zfTarget = zfDescription.split('|')[5] | ||
+ | zfSequence = '' | ||
+ | for (i=1;i<zfFormatted.length;i++){ | ||
+ | zfSequence+=zfFormatted[i] | ||
+ | } | ||
+ | zfObject = new Object() | ||
+ | zfObject.target = zfTarget | ||
+ | zfObject.sequence = zfSequence | ||
+ | zfObject.description = zfDescription | ||
+ | zincFingers[zf] = zfObject | ||
+ | } | ||
+ | addForbiddenSequence(zincFingers,'hasTarget') | ||
+ | return zincFingers | ||
+ | } | ||
+ | |||
+ | function getLinkers(){ | ||
+ | linkers = new Array() | ||
+ | linker1 = new Object() | ||
+ | linker1.sequence = "gcacccggc" | ||
+ | linker1.description = "Linker 1" | ||
+ | linker2 = new Object() | ||
+ | linker2.sequence = "gcaccccgccc" | ||
+ | linker2.description = "Linker 2" | ||
+ | linkers[0] = linker1 | ||
+ | linkers[1] = linker2 | ||
+ | addForbiddenSequence(linkers,'noTarget') | ||
+ | return linkers | ||
+ | } | ||
+ | |||
+ | function getMycTags(){ | ||
+ | mycTags = new Array() | ||
+ | mycTag1 = new Object() | ||
+ | mycTag1.sequence = "gaacagaaactcatctctgaagaggatctg" | ||
+ | mycTag1.description = "Myc Tag 1" | ||
+ | mycTag2 = new Object() | ||
+ | mycTag2.sequence = "gaacagaaactcatctctgaagagaatctgaagactgagtcagt" | ||
+ | mycTag2.description = "Myc Tag 2" | ||
+ | mycTags[0] = mycTag1 | ||
+ | mycTags[1] = mycTag2 | ||
+ | addForbiddenSequence(mycTags,'noTarget') | ||
+ | return mycTags | ||
+ | } | ||
+ | |||
+ | function getTerminators(){ | ||
+ | terminators = new Array() | ||
+ | terminator1 = new Object() | ||
+ | terminator1.sequence = "tcacactggctcaccttcgggtgggcctttctgcgtttatatactagagagagaatataaaaagccagattattaatccggcttttttattattt" | ||
+ | terminator1.description = "B0014 containing BOO12 and BOO11 terminators" | ||
+ | terminator2 = new Object() | ||
+ | terminator2.sequence = "tcacactggctcaccttcgggtgggcctttctgcgtttatatactagagagagaatataaaaagccagattattaatccggcttttttattatttt" | ||
+ | terminator2.description = "Terminator 2" | ||
+ | terminators[0] = terminator1 | ||
+ | terminators[1] = terminator2 | ||
+ | addForbiddenSequence(terminators,'noTarget') | ||
+ | return terminators | ||
+ | } | ||
+ | |||
+ | function getRBS(){ | ||
+ | rbs = new Array() | ||
+ | rbs1 = new Object() | ||
+ | rbs1.sequence = "tcacacaggaaag" | ||
+ | rbs1.description = "BBa_B0032" | ||
+ | rbs2 = new Object() | ||
+ | rbs2.sequence = "aaaaaaaaaaaccccaa" | ||
+ | rbs2.description = "RBS2" | ||
+ | rbs[0] = rbs1 | ||
+ | rbs[1] = rbs2 | ||
+ | addForbiddenSequence(rbs,'noTarget') | ||
+ | return rbs | ||
+ | } | ||
+ | |||
+ | function addForbiddenSequence(array,type){ | ||
+ | if (type == 'hasTarget'){ | ||
+ | for (item in array){ | ||
+ | forbiddenSequences.addSite(array[item].description,array[item].target) | ||
+ | } | ||
+ | } else{ | ||
+ | for (item in array){ | ||
+ | forbiddenSequences.addSite(array[item].description,array[item].sequence) | ||
+ | } | ||
+ | } | ||
+ | |||
+ | } | ||
+ | |||
+ | function getDate(){ | ||
+ | today = new Date() | ||
+ | dd = today.getDate() | ||
+ | mm = today.getMonth()+1 | ||
+ | yyyy = today.getFullYear() | ||
+ | if(dd<10){ | ||
+ | dd='0'+dd | ||
+ | } | ||
+ | if(mm<10){ | ||
+ | mm='0'+mm | ||
+ | } | ||
+ | today = dd+'-'+mm.substring(0,2)+'-'+yyyy; | ||
+ | return today | ||
+ | } | ||
+ | |||
+ | function generateWhiteSpace(amount){ | ||
+ | output = '' | ||
+ | for (i=0;i<amount;i++){ | ||
+ | output += ' ' | ||
+ | } | ||
+ | return output | ||
+ | } | ||
+ | |||
+ | function staticGenbank(name){ | ||
+ | output = 'LOCUS' | ||
+ | output += generateWhiteSpace(16) | ||
+ | output += name | ||
+ | output += generateWhiteSpace(8) | ||
+ | output += memoryPlasmid.dna.length+' bp DNA ' | ||
+ | output += generateWhiteSpace(3) | ||
+ | output += 'linear' | ||
+ | output += generateWhiteSpace(7) | ||
+ | output += getDate()+'<br>' | ||
+ | output += 'DEFINITION<br>' | ||
+ | output += 'ACCESSION<br>' | ||
+ | output += 'VERSION<br>' | ||
+ | output += 'SOURCE<br>' | ||
+ | output += ' ORGANISM<br>' | ||
+ | output += 'COMMENT<br>' | ||
+ | output += 'FEATURES' | ||
+ | output += generateWhiteSpace(13) | ||
+ | output += 'Location/Qualifiers<br>' | ||
+ | return output | ||
+ | } | ||
+ | |||
+ | function genbankRestriction(targetSites){ | ||
+ | restrictionPlasmidOutput = staticGenbank('restriction_plasmid') | ||
+ | restrictionOrigin = memoryPlasmid.features[1].sequence | ||
+ | for (key in targetSites){ | ||
+ | restrictionOrigin += randomDNA(10) | ||
+ | restrictionPlasmidOutput += generateWhiteSpace(5) | ||
+ | restrictionPlasmidOutput += 'misc_feature' | ||
+ | restrictionPlasmidOutput += generateWhiteSpace(5) | ||
+ | restrictionPlasmidOutput += restrictionOrigin.length+1+'...' | ||
+ | restrictionOrigin += targetSites[key].zincFinger | ||
+ | restrictionPlasmidOutput += restrictionOrigin.length+'<br>' | ||
+ | restrictionOrigin += randomDNA(10) | ||
+ | restrictionPlasmidOutput += generateWhiteSpace(5) | ||
+ | restrictionPlasmidOutput += 'misc_feature' | ||
+ | restrictionPlasmidOutput += generateWhiteSpace(5) | ||
+ | restrictionPlasmidOutput += restrictionOrigin.length+1+'...' | ||
+ | restrictionOrigin += targetSites[key].methyltransferase | ||
+ | restrictionPlasmidOutput += restrictionOrigin.length+'<br>' | ||
+ | restrictionOrigin += targetSites[key].methyltransferase | ||
+ | } | ||
+ | restrictionOrigin = restrictionOrigin.toLowerCase() | ||
+ | restrictionOrigin = restrictionOrigin.replace(/[atgc]{10}/g,'$& ').replace(/amp;/g,'').split(' ') | ||
+ | pos = 1 | ||
+ | newString = '' | ||
+ | restrictionPlasmidOutput += 'ORIGIN<br>' | ||
+ | for (i=0;i<restrictionOrigin.length;i++){ | ||
+ | newString = newString+' '+restrictionOrigin[i] | ||
+ | if ((i+1)%6===0){ | ||
+ | whiteSpace = '' | ||
+ | for (j=0;j<9-pos.toString().length;j++){ | ||
+ | whiteSpace+= ' ' | ||
+ | } | ||
+ | newString = whiteSpace+pos + ' ' + newString | ||
+ | restrictionPlasmidOutput+=newString+'<br>' | ||
+ | newString = '' | ||
+ | } else if ((i+1)%6==1){ | ||
+ | if (i!=0){ | ||
+ | pos+=60 | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | if (restrictionOrigin.length%6 != 0){ | ||
+ | newString = '' | ||
+ | whiteSpace = '' | ||
+ | for (j=0;j<9-pos.toString().length;j++){ | ||
+ | whiteSpace+= ' ' | ||
+ | } | ||
+ | newString+=whiteSpace+pos | ||
+ | for (i=0;i<(restrictionOrigin.length%6);i++){ | ||
+ | newString+=' '+restrictionOrigin[restrictionOrigin.length-restrictionOrigin.length%6+i] | ||
+ | } | ||
+ | restrictionPlasmidOutput+=newString+'<br>' | ||
+ | } | ||
+ | restrictionSiteWindow = window.open() | ||
+ | restrictionSiteWindow.document.write(restrictionPlasmidOutput) | ||
+ | restrictionSiteWindow.focus() | ||
+ | } | ||
+ | function genbankMemory(){ | ||
+ | memoryPlasmidOutput = staticGenbank('memory_plasmid') | ||
+ | for (item in memoryPlasmid.memoryObjects){ | ||
+ | for (key in memoryPlasmid.memoryObjects[item]){ | ||
+ | memoryPlasmidOutput += generateWhiteSpace(5) | ||
+ | memoryPlasmidOutput += 'misc_feature' | ||
+ | memoryPlasmidOutput += generateWhiteSpace(5) | ||
+ | memoryPlasmidOutput += memoryPlasmid.memoryObjects[item][key].start+'...'+memoryPlasmid.memoryObjects[item][key].end+'<br>' | ||
+ | memoryPlasmidOutput += generateWhiteSpace(10) | ||
+ | memoryPlasmidOutput += '/label='+memoryPlasmid.memoryObjects[item][key].description+'<br>' | ||
+ | } | ||
+ | |||
+ | } | ||
+ | origin = memoryPlasmid.dna | ||
+ | origin = origin.replace(/[atgc]{10}/g,'$& ').replace(/amp;/g,'').split(' ') | ||
+ | pos = 1 | ||
+ | newString = '' | ||
+ | memoryPlasmidOutput += 'ORIGIN<br>' | ||
+ | for (i=0;i<origin.length;i++){ | ||
+ | newString = newString+' '+origin[i] | ||
+ | if ((i+1)%6===0){ | ||
+ | whiteSpace = '' | ||
+ | for (j=0;j<9-pos.toString().length;j++){ | ||
+ | whiteSpace+= ' ' | ||
+ | } | ||
+ | newString = whiteSpace+pos + ' ' + newString | ||
+ | memoryPlasmidOutput+=newString+'<br>' | ||
+ | newString = '' | ||
+ | } else if ((i+1)%6==1){ | ||
+ | if (i!=0){ | ||
+ | pos+=60 | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | if (origin.length%6 != 0){ | ||
+ | newString = '' | ||
+ | whiteSpace = '' | ||
+ | for (j=0;j<9-pos.toString().length;j++){ | ||
+ | whiteSpace+= ' ' | ||
+ | } | ||
+ | newString+=whiteSpace+pos | ||
+ | for (i=0;i<(origin.length%6);i++){ | ||
+ | newString+=' '+origin[origin.length-origin.length%6+i] | ||
+ | } | ||
+ | memoryPlasmidOutput+=newString+'<br>' | ||
+ | } | ||
+ | |||
+ | myWindow=window.open() | ||
+ | myWindow.document.write(memoryPlasmidOutput) | ||
+ | myWindow.focus() | ||
+ | |||
+ | } | ||
+ | |||
+ | function formatPlasmidInput(backbone){ | ||
+ | backbone = backbone.split('\n') | ||
+ | originBoolean = false | ||
+ | backboneName = '' | ||
+ | sequence = '' | ||
+ | if (backbone[0].toLowerCase().indexOf('locus') != -1){ | ||
+ | for (i=0;i<backbone.length;i++){ | ||
+ | if (originBoolean === true){ | ||
+ | if (backbone[i].indexOf('//') == -1){ | ||
+ | appendThis = backbone[i].replace(/[0-9]|\s|\n|\t/g,'') | ||
+ | sequence = sequence+appendThis | ||
+ | } else{ | ||
+ | originalBoolean = false | ||
+ | } | ||
+ | } | ||
+ | if (backbone[i].indexOf('locus') != -1){ | ||
+ | backboneName = backbone[i].split(/\s+|\t+/g)[1] | ||
+ | } | ||
+ | if (backbone[i].indexOf('origin') != -1){ | ||
+ | originBoolean = true | ||
+ | } | ||
+ | } | ||
+ | } else if (backbone[0][0] == '>'){ | ||
+ | for (i=0;i<backbone.length;i++){ | ||
+ | if (backbone[i][0] != '>'){ | ||
+ | appendThis = backbone[i].replace(/[0-9]|\s|\n|\t/g,'') | ||
+ | sequence = sequence+appendThis | ||
+ | } else{ | ||
+ | backboneName = backbone[i].replace('>','') | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | memoryPlasmid.addFeature(1,sequence.length,'Backbone',sequence,backboneName,'') | ||
+ | return sequence | ||
+ | } | ||
+ | |||
+ | function feature(start,end,type,sequence,description,featureObject){ | ||
+ | this.start = start; | ||
+ | this.end = end; | ||
+ | this.type = type; | ||
+ | this.sequence = sequence; | ||
+ | this.description = description; | ||
+ | this.featureObject = featureObject | ||
+ | } | ||
+ | |||
+ | var restrictionPlasmid = { | ||
+ | backboneName : '', | ||
+ | dna : '', | ||
+ | features : {}, | ||
+ | setBackboneName : function(backboneName){ | ||
+ | restrictionlasmid.backboneName = backboneName | ||
+ | }, | ||
+ | setDNA : function(dna){ | ||
+ | restrictionPlasmid.dna = dna | ||
+ | }, | ||
+ | addFeature : function(start,end,type,sequence,description){ | ||
+ | restrictionPlasmid.features[start] = new feature(start,end,type,sequence,description) | ||
+ | }, | ||
+ | addRecognitionAreaObject : function(zfTarget,mtaseTarget){ | ||
+ | |||
+ | recognitionPlasmid.zfTarget = zfTarget | ||
+ | recognitionPlasmid.mtaseTarget = mtaseTarget | ||
+ | } | ||
+ | } | ||
+ | |||
+ | var memoryPlasmid = { | ||
+ | backboneName : '', | ||
+ | dna : '', | ||
+ | features : {}, | ||
+ | memoryObjects : {}, | ||
+ | setBackboneName : function(backboneName){ | ||
+ | memoryPlasmid.backboneName = backboneName | ||
+ | }, | ||
+ | setDNA : function(dna){ | ||
+ | memoryPlasmid.dna = dna | ||
+ | }, | ||
+ | addMemoryObject : function(sensor,rbs,zincFinger,linker,mycTag,methyltransferase,terminator){ | ||
+ | memoryObject = new Object() | ||
+ | memoryObject.sensor = sensor | ||
+ | memoryObject.rbs = rbs | ||
+ | memoryObject.zincFinger = zincFinger | ||
+ | memoryObject.linker = linker | ||
+ | memoryObject.mycTag = mycTag | ||
+ | memoryObject.methyltransferase = methyltransferase | ||
+ | memoryObject.terminator = terminator | ||
+ | memoryPlasmid.memoryObjects[sensor.start] = memoryObject | ||
+ | }, | ||
+ | addFeature : function(start,end,type,sequence,description){ | ||
+ | memoryPlasmid.features[start] = new feature(start,end,type,sequence,description) | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function sensorObject(name,sequence){ | ||
+ | this.name = name | ||
+ | this.sequence = sequence | ||
+ | |||
+ | } | ||
+ | |||
+ | function formatSensors(sensors){ | ||
+ | sensorArray = new Array() | ||
+ | if (sensors.indexOf('LOCUS') != -1){ | ||
+ | sensors = sensors.split('LOCUS') | ||
+ | sensors.reverse().pop() | ||
+ | for (i=0;i<sensors.length;i++){ | ||
+ | originBoolean = false | ||
+ | sensorName = '' | ||
+ | sequence = '' | ||
+ | sensor = sensors[i].split('\n') | ||
+ | for (j=0;j<sensor.length;j++){ | ||
+ | if (j===0){ | ||
+ | sensorName = sensor[j] | ||
+ | } | ||
+ | if (originBoolean === true){ | ||
+ | if (sensor[j].indexOf('//') == -1){ | ||
+ | appendThis = sensor[j].replace(/[0-9]|\s|\n|\t/g,'') | ||
+ | sequence += appendThis | ||
+ | } else { | ||
+ | originBoolean = false | ||
+ | } | ||
+ | } | ||
+ | if (sensor[j].indexOf('ORIGIN') != -1){ | ||
+ | originBoolean = true | ||
+ | } | ||
+ | } | ||
+ | sensorArray[i] = new sensorObject(sensorName,sequence) | ||
+ | } | ||
+ | } else if (sensors[0] == '>'){ | ||
+ | sensors = sensors.split('//') | ||
+ | sensors.pop() | ||
+ | sensorName = '' | ||
+ | for (i=0;i<sensors.length;i++){ | ||
+ | sensor = sensors[i].split('\n') | ||
+ | sequence = '' | ||
+ | for (j=0;j<sensor.length;j++){ | ||
+ | if (sensor[j][0] != '>'){ | ||
+ | appendThis = sensor[j].replace(/[0-9]|\s|\n|\t/g,'') | ||
+ | sequence = sequence+appendThis | ||
+ | } else if (sensor[j][0] == '>'){ | ||
+ | sensorName = sensor[j].replace('>','') | ||
+ | } | ||
+ | } | ||
+ | sensorArray[i] = new sensorObject(sensorName,sequence) | ||
+ | } | ||
+ | } | ||
+ | return sensorArray | ||
+ | } | ||
+ | |||
+ | function formatPartsregistryPromoters(){ | ||
+ | promoters = new Array() | ||
+ | $("input:checkbox[name=promoter]:checked").each(function(){ | ||
+ | promoter = $(this).val().split(':') | ||
+ | promoters.push(new sensorObject(promoter[0],promoter[2])) | ||
+ | }) | ||
+ | return promoters | ||
+ | } | ||
+ | |||
+ | function configuratePlasmid(sensorArray,number){ | ||
+ | memoryPlasmid.features = {} | ||
+ | memoryPlasmid.memoryObjects = {} | ||
+ | backbone = document.plasmidForm.plasmid.value.toLowerCase() | ||
+ | methyltransferases = getMethyltransferases() | ||
+ | zincFingers = getZincFingers() | ||
+ | linkers = getLinkers() | ||
+ | mycTags = getMycTags() | ||
+ | rbs = getRBS() | ||
+ | terminators = getTerminators() | ||
+ | plasmidSequence = formatPlasmidInput(backbone) | ||
+ | memoryPlasmid.setDNA(plasmidSequence) | ||
+ | for (i=0;i<sensorArray.length;i++){ | ||
+ | featureArray = new Array() | ||
+ | featureArray[0] = new feature(memoryPlasmid.dna.length+1,memoryPlasmid.dna.length+sensorArray[i].sequence.length,'Sensor',sensorArray[i].sequence,sensorArray[i].name,sensorArray[i]) | ||
+ | memoryPlasmid.setDNA(memoryPlasmid.dna+sensorArray[i].sequence) | ||
+ | j = Math.floor((Math.random()*rbs.length)) | ||
+ | featureArray[1] = new feature(memoryPlasmid.dna.length+1,memoryPlasmid.dna.length+rbs[j].sequence.length,'RBS',rbs[j].sequence,rbs[j].description,rbs[j]) | ||
+ | memoryPlasmid.setDNA(memoryPlasmid.dna+rbs[j].sequence+randomDNA(3)) | ||
+ | memoryPlasmid.setDNA(memoryPlasmid.dna+'atg'+randomDNA(10)) | ||
+ | for (j=0;j<zincFingers.length;j++){ | ||
+ | if (checkOccurrence(zincFingers[j].target.toLowerCase(),memoryPlasmid.dna) === true || checkOccurrence(zincFingers[j].sequence.toLowerCase(),memoryPlasmid.dna) === true){ | ||
+ | continue | ||
+ | } else{ | ||
+ | featureArray[2] = new feature(memoryPlasmid.dna.length+1,memoryPlasmid.dna.length+zincFingers[j].sequence.length,'Zinc Finger',zincFingers[j].sequence,'Zinc Finger '+zincFingers[j].description.split('|')[0],zincFingers[j]) | ||
+ | memoryPlasmid.setDNA(memoryPlasmid.dna+zincFingers[j].sequence) | ||
+ | break | ||
+ | } | ||
+ | } | ||
+ | j = Math.floor((Math.random()*linkers.length)) | ||
+ | featureArray[3] = new feature(memoryPlasmid.dna.length+1,memoryPlasmid.dna.length+linkers[j].sequence.length,'Linker',linkers[j].sequence,linkers[j].description,linkers[j]) | ||
+ | memoryPlasmid.setDNA(memoryPlasmid.dna+linkers[j].sequence) | ||
+ | j = Math.floor((Math.random()*mycTags.length)) | ||
+ | featureArray[4] = new feature(memoryPlasmid.dna.length+1,memoryPlasmid.dna.length+mycTags[j].sequence.length,'Myc Tag',mycTags[j].sequence,mycTags[j].description,mycTags[j]) | ||
+ | memoryPlasmid.setDNA(memoryPlasmid.dna+mycTags[j].sequence) | ||
+ | j = Math.floor((Math.random()*methyltransferases.length)) | ||
+ | featureArray[5] = new feature(memoryPlasmid.dna.length+1,memoryPlasmid.dna.length+methyltransferases[j].sequence.length,'Methyltransferase',methyltransferases[j].sequence,methyltransferases[j].description,methyltransferases[j]) | ||
+ | memoryPlasmid.setDNA(memoryPlasmid.dna+methyltransferases[j].sequence) | ||
+ | j = Math.floor((Math.random()*terminators.length)) | ||
+ | featureArray[6] = new feature(memoryPlasmid.dna.length+1,memoryPlasmid.dna.length+terminators[j].sequence.length,'Terminator',terminators[j].sequence,terminators[j].description,terminators[j]) | ||
+ | memoryPlasmid.setDNA(memoryPlasmid.dna+terminators[j].sequence+randomDNA(10)) | ||
+ | memoryPlasmid.addMemoryObject(featureArray[0],featureArray[1],featureArray[2],featureArray[3],featureArray[4],featureArray[5],featureArray[6]) | ||
+ | } | ||
+ | restrictionPlasmid.setDNA(memoryPlasmid.features[1].sequence) | ||
+ | for (item in memoryPlasmid.memoryObjects){ | ||
+ | featureArray = new Array() | ||
+ | mtaseStart = restrictionPlasmid.dna.length+1 | ||
+ | mtaseEnd = restrictionPlasmid.dna.length+memoryPlasmid.memoryObjects[item].methyltransferase.featureObject.target.length | ||
+ | mtaseType = 'Restriction Site' | ||
+ | mtaseTarget = memoryPlasmid.memoryObjects[item].methyltransferase.featureObject.target.toLowerCase() | ||
+ | mtaseDescription = memoryPlasmid.memoryObjects[item].methyltransferase.featureObject.description+' restriction site' | ||
+ | featureArray[0] = new feature(mtaseStart,mtaseEnd,mtaseType,mtaseTarget,mtaseDescription) | ||
+ | restrictionPlasmid.setDNA(restrictionPlasmid.dna+mtaseTarget) | ||
+ | zfStart = restrictionPlasmid.dna.length+1 | ||
+ | zfEnd = restrictionPlasmid.dna.length+memoryPlasmid.memoryObjects[item].zincFinger.featureObject.target.length | ||
+ | zfType = 'Restriction Site' | ||
+ | zfTarget = memoryPlasmid.memoryObjects[item].zincFinger.featureObject.target | ||
+ | zfDescription = memoryPlasmid.memoryObjects[item].zincFinger.featureObject.description+' restriction site' | ||
+ | featureArray[1] = new feature(zfStart,zfEnd,zfType,zfTarget,zfDescription) | ||
+ | restrictionPlasmid.setDNA(restrictionPlasmid.dna+mtaseTarget) | ||
+ | restrictionPlasmid.mtaseTarget = featureArray[0] | ||
+ | restrictionPlasmid.zfTarget = featureArray[1] | ||
+ | } | ||
+ | json = createJSONMemory(number) | ||
+ | //genbankMemory() | ||
+ | $('#visualizationButtons').append('<input type="hidden" name="json'+number+'" value="'+escape(JSON.stringify(json))+'"/><input class="submit" type="submit" value="Memory Plasmid '+(number+1)+'" onclick="visualization('+number+');return false"/>'); | ||
+ | } | ||
+ | |||
function setup(){ | function setup(){ | ||
- | |||
$('#visualizationButtons').empty() | $('#visualizationButtons').empty() | ||
$('#infovis').empty() | $('#infovis').empty() | ||
Line 11: | Line 686: | ||
sensors = document.plasmidForm.sensors.value.toLowerCase() | sensors = document.plasmidForm.sensors.value.toLowerCase() | ||
sensorArray = formatSensors(sensors) | sensorArray = formatSensors(sensors) | ||
- | + | promoters = formatPartsregistryPromoters() | |
sensorArray = promoters.concat(sensorArray) | sensorArray = promoters.concat(sensorArray) | ||
tempArray = new Array() | tempArray = new Array() | ||
Line 21: | Line 696: | ||
j++ | j++ | ||
if (j%5 === 0){ | if (j%5 === 0){ | ||
- | if (j !== 0){ | + | if ( j !== 0){ |
configuratePlasmid(tempArray,number) | configuratePlasmid(tempArray,number) | ||
number++ | number++ | ||
Line 59: | Line 734: | ||
$('#visualizationButtons').append('<input type="hidden" name="json-1" value="'+escape(JSON.stringify(json))+'"/><input class="submit" type="submit" value="Restriction Plasmid" onclick="visualization(-1);return false"/>'); | $('#visualizationButtons').append('<input type="hidden" name="json-1" value="'+escape(JSON.stringify(json))+'"/><input class="submit" type="submit" value="Restriction Plasmid" onclick="visualization(-1);return false"/>'); | ||
$('#readout').append('<input type="textfield" name="readout" value=""/><input class="submit" type="submit" value="Submit" onClick="getReadout();return false"/>'); | $('#readout').append('<input type="textfield" name="readout" value=""/><input class="submit" type="submit" value="Submit" onClick="getReadout();return false"/>'); | ||
+ | } | ||
+ | |||
+ | function getReadout(){ | ||
+ | inputArray = new Array() | ||
+ | json = JSON.parse(unescape($(':input[name=json-1]').val())) | ||
+ | inputs = $(':input[name=readout]').val() | ||
+ | inputArray = inputs.split(',') | ||
+ | totalLength = json.children[0].data.length | ||
+ | uncutArray = new Array() | ||
+ | i = 0 | ||
+ | for (child in json.children){ | ||
+ | totalLength+=json.children[child].data.length | ||
+ | if (json.children[child].data.description.indexOf('Methyltransferase') != -1){ | ||
+ | uncutArray[i] = [json.children[child].id,totalLength] | ||
+ | i++ | ||
+ | } | ||
+ | } | ||
+ | bandsArray = new Array () | ||
+ | j = 0 | ||
+ | for (item in uncutArray){ | ||
+ | i = 0 | ||
+ | tempBandArray = new Array() | ||
+ | tempBandArray[i] = [uncutArray[item][1],uncutArray[item][0]] | ||
+ | i++ | ||
+ | for (bandArray in bandsArray){ | ||
+ | for (band in bandsArray[bandArray]){ | ||
+ | tempBandArray[i] = [uncutArray[item][1] - bandsArray[bandArray][band][0],uncutArray[item][0]] | ||
+ | i++ | ||
+ | } | ||
+ | } | ||
+ | bandsArray[j] = tempBandArray | ||
+ | j++ | ||
+ | } | ||
+ | matchingBands = new Array() | ||
+ | i = 0 | ||
+ | for (input in inputArray){ | ||
+ | difference = 100000000000 | ||
+ | bandSize = inputArray[input] | ||
+ | for (bandArray in bandsArray){ | ||
+ | for (band in bandsArray[bandArray]){ | ||
+ | if (bandSize > bandsArray[bandArray][band][0]){ | ||
+ | tempDifference = bandSize - bandsArray[bandArray][band][0] | ||
+ | } else{ | ||
+ | tempDifference = bandsArray[bandArray][band][0] - bandSize | ||
+ | } | ||
+ | if (tempDifference < difference){ | ||
+ | matchingBand = bandsArray[bandArray][band][1] | ||
+ | difference = tempDifference | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | matchingBands[i] = matchingBand | ||
+ | i++ | ||
+ | } | ||
+ | i = 0 | ||
+ | sensedSignals = new Array() | ||
+ | for (matchingBand in matchingBands){ | ||
+ | for (child in json.children){ | ||
+ | if (json.children[child].id == matchingBands[matchingBand]){ | ||
+ | sensedSignals[i] = json.children[child].data.sensor | ||
+ | i++ | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | for (signal in sensedSignals){ | ||
+ | $('#readout').append('<br>'+sensedSignals[signal]) | ||
+ | } | ||
+ | } | ||
+ | |||
+ | function createJSONRestriction(targetSites){ | ||
+ | json = { | ||
+ | "children": [], | ||
+ | "data": { | ||
+ | "$type": "none", | ||
+ | }, | ||
+ | "id": "Source", | ||
+ | "name": "Restriction Plasmid" | ||
+ | }; | ||
+ | |||
+ | json.children[0] = {} | ||
+ | json.children[0].data = {} | ||
+ | json.children[0].data.description = memoryPlasmid.features[1].description | ||
+ | json.children[0].data.$color = '#B2ABF4' | ||
+ | json.children[0].data.length = memoryPlasmid.features[1].end - memoryPlasmid.features[1].start | ||
+ | json.children[0].data.$angularWidth = 1000 | ||
+ | json.children[0].data.type = memoryPlasmid.features[1].type | ||
+ | json.children[0].data.dna = memoryPlasmid.dna | ||
+ | json.children[0].children = [] | ||
+ | json.children[0].name = memoryPlasmid.features[1].description | ||
+ | json.children[0].id = memoryPlasmid.features[1].description | ||
+ | totalLength = memoryPlasmid.dna.length | ||
+ | i = 1 | ||
+ | for (item in targetSites){ | ||
+ | site = targetSites[item] | ||
+ | json.children[i] = {} | ||
+ | json.children[i].data = {} | ||
+ | json.children[i].children = [] | ||
+ | json.children[i].data.description = '120bp random DNA' | ||
+ | json.children[i].data.$color = '#FFFF00' | ||
+ | json.children[i].data.length = 120 | ||
+ | json.children[i].data.$angularWidth = 1000 | ||
+ | json.children[i].data.dna = randomDNA(120+i*10) | ||
+ | json.children[i].name = '120bp DNA' | ||
+ | json.children[i].id = i | ||
+ | i++ | ||
+ | json.children[i] = {} | ||
+ | json.children[i].data = {} | ||
+ | json.children[i].children = [] | ||
+ | json.children[i].data.description = site.zincFingerDescription | ||
+ | json.children[i].data.$color = '#FF0000' | ||
+ | json.children[i].data.length = site.zincFingerLength | ||
+ | json.children[i].data.$angularWidth = 1000 | ||
+ | json.children[i].data.dna = site.zincFinger | ||
+ | json.children[i].name = site.zincFingerDescription.split('|')[0]+'|'+site.zincFingerDescription.split('|')[1] | ||
+ | json.children[i].id = i | ||
+ | i++ | ||
+ | json.children[i] = {} | ||
+ | json.children[i].data = {} | ||
+ | json.children[i].children = [] | ||
+ | json.children[i].data.description = '120bp random DNA' | ||
+ | json.children[i].data.$color = '#FFFF00' | ||
+ | json.children[i].data.length = 120 | ||
+ | json.children[i].data.$angularWidth = 1000 | ||
+ | json.children[i].data.dna = randomDNA(120) | ||
+ | json.children[i].name = '120bp DNA' | ||
+ | json.children[i].id = i | ||
+ | i++ | ||
+ | json.children[i] = {} | ||
+ | json.children[i].data = {} | ||
+ | json.children[i].children = [] | ||
+ | json.children[i].data.description = 'Methyltransferase: '+site.methyltransferaseDescription | ||
+ | json.children[i].data.$color = '#0000CD' | ||
+ | json.children[i].data.length = site.methyltransferaseLength | ||
+ | json.children[i].data.$angularWidth = 1000 | ||
+ | json.children[i].data.dna = site.methyltransferase | ||
+ | json.children[i].data.sensor = site.sensor | ||
+ | json.children[i].name = site.methyltransferaseDescription.split('|')[0] | ||
+ | json.children[i].id = i | ||
+ | i++ | ||
+ | json.children[i] = {} | ||
+ | json.children[i].data = {} | ||
+ | json.children[i].children = [] | ||
+ | json.children[i].data.description = '120bp random DNA' | ||
+ | json.children[i].data.$color = '#FFFF00' | ||
+ | json.children[i].data.length = 120 | ||
+ | json.children[i].data.$angularWidth = 1000 | ||
+ | json.children[i].data.dna = randomDNA(120) | ||
+ | json.children[i].name = '120bp DNA' | ||
+ | json.children[i].id = i | ||
+ | i++ | ||
+ | json.children[i] = {} | ||
+ | json.children[i].data = {} | ||
+ | json.children[i].children = [] | ||
+ | json.children[i].data.description = site.zincFingerDescription | ||
+ | json.children[i].data.$color = '#FF0000' | ||
+ | json.children[i].data.length = site.zincFingerLength | ||
+ | json.children[i].data.$angularWidth = 1000 | ||
+ | json.children[i].data.dna = site.zincFinger | ||
+ | json.children[i].name = site.zincFingerDescription.split('|')[0]+'|'+site.zincFingerDescription.split('|')[1] | ||
+ | json.children[i].id = i | ||
+ | i++ | ||
+ | } | ||
+ | return json | ||
+ | } | ||
+ | |||
+ | function createJSONMemory(number){ | ||
+ | var json = {} | ||
+ | json = { | ||
+ | "children": [], | ||
+ | "data": { | ||
+ | "$type": "none", | ||
+ | }, | ||
+ | "id": "Source", | ||
+ | "name": "Memory Plasmid" | ||
+ | }; | ||
+ | |||
+ | json.children[0] = {} | ||
+ | json.children[0].data = {} | ||
+ | json.children[0].data.description = memoryPlasmid.features[1].description | ||
+ | json.children[0].data.$color = '#B2ABF4' | ||
+ | json.children[0].data.length = memoryPlasmid.features[1].end - memoryPlasmid.features[1].start | ||
+ | json.children[0].data.$angularWidth = 1000 | ||
+ | json.children[0].data.type = memoryPlasmid.features[1].type | ||
+ | json.children[0].data.dna = memoryPlasmid.dna | ||
+ | json.children[0].children = [] | ||
+ | json.children[0].name = memoryPlasmid.features[1].description | ||
+ | json.children[0].id = memoryPlasmid.features[1].description | ||
+ | i = 1 | ||
+ | for (memoryObject in memoryPlasmid.memoryObjects){ | ||
+ | for (item in memoryPlasmid.memoryObjects[memoryObject]){ | ||
+ | json.children[i] = {} | ||
+ | json.children[i].children = [] | ||
+ | json.children[i].data = {} | ||
+ | json.children[i].data.description = memoryPlasmid.memoryObjects[memoryObject][item].description | ||
+ | type = memoryPlasmid.memoryObjects[memoryObject][item].type | ||
+ | if (type == 'Sensor'){ | ||
+ | color = '#00FFFF' | ||
+ | } else if (type == 'RBS'){ | ||
+ | color = '#FFFF00' | ||
+ | } else if (type == 'Zinc Finger'){ | ||
+ | color = '#800080' | ||
+ | } else if (type == 'Linker'){ | ||
+ | color = '#00FF00' | ||
+ | } else if (type == 'Myc Tag'){ | ||
+ | color = '#FF00FF' | ||
+ | } else if (type == 'Methyltransferase'){ | ||
+ | color = '#FFA500' | ||
+ | } else if (type == 'Terminator'){ | ||
+ | color = '#FF0000' | ||
+ | } else{ | ||
+ | color = '#B2ABF4' | ||
+ | } | ||
+ | json.children[i].data.$color = color | ||
+ | json.children[i].data.length = memoryPlasmid.memoryObjects[memoryObject][item].end - memoryPlasmid.memoryObjects[memoryObject][item].start | ||
+ | json.children[i].data.$angularWidth = 1000 | ||
+ | json.children[i].data.type = type | ||
+ | json.children[i].data.dna = memoryPlasmid.memoryObjects[memoryObject][item].sequence | ||
+ | json.children[i].id = i | ||
+ | if (memoryPlasmid.memoryObjects[memoryObject][item].description.length > 14){ | ||
+ | json.children[i].name = memoryPlasmid.memoryObjects[memoryObject][item].description.substring(0,14) | ||
+ | } else{ | ||
+ | json.children[i].name = memoryPlasmid.memoryObjects[memoryObject][item].description | ||
+ | } | ||
+ | i++ | ||
+ | } | ||
+ | } | ||
+ | return json | ||
+ | |||
+ | //end | ||
} | } | ||
</script> | </script> |
Revision as of 19:45, 3 September 2012