Team:Amsterdam/maarten/

From 2012.igem.org

(Difference between revisions)
(Undo revision 86032 by MaartenR (talk))
(Undo revision 86026 by MaartenR (talk))
Line 7: Line 7:
<script type="text/javascript" src="jquery-1.2.3.min.js"></script>
<script type="text/javascript" src="jquery-1.2.3.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 init(){
 
-
alert('yeahbaby')
 
-
    //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': '#33dddd'
 
-
          },
 
-
        },
 
-
        //Add tooltips
 
-
        Tips: {
 
-
          enable: true,
 
-
          onShow: function(tip, node) {
 
-
            var html = "<div class=\"tip-title\">" + node.name + "</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("description" in data) {
 
-
              html += "<br /><br /><b>Last commit was:</b><br /><pre>" + data.description + "</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('angularWidth');
 
-
          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(){
function addForbiddenSequences(){
Line 618: Line 483:
         return promoters
         return promoters
}
}
-
 
+
function configuratePlasmid(){
-
function configuratePlasmid(sensorArray,number){
+
        addForbiddenSequences()
-
memoryPlasmid.features = {}
+
-
memoryPlasmid.memoryObjects = {}
+
         backbone = document.plasmidForm.plasmid.value.toLowerCase()
         backbone = document.plasmidForm.plasmid.value.toLowerCase()
 +
        sensors = document.plasmidForm.sensors.value.toLowerCase()
         methyltransferases = getMethyltransferases()
         methyltransferases = getMethyltransferases()
         zincFingers = getZincFingers()
         zincFingers = getZincFingers()
Line 631: Line 495:
         plasmidSequence = formatPlasmidInput(backbone)
         plasmidSequence = formatPlasmidInput(backbone)
         memoryPlasmid.setDNA(plasmidSequence)
         memoryPlasmid.setDNA(plasmidSequence)
 +
        sensorArray = formatSensors(sensors)
 +
        promoters = formatPartsregistryPromoters()
 +
        sensorArray = promoters.concat(sensorArray)
         for (i=0;i<sensorArray.length;i++){
         for (i=0;i<sensorArray.length;i++){
    featureArray = new Array()
    featureArray = new Array()
Line 661: Line 528:
    memoryPlasmid.setDNA(memoryPlasmid.dna+terminators[j].sequence+randomDNA(10))
    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])
             memoryPlasmid.addMemoryObject(featureArray[0],featureArray[1],featureArray[2],featureArray[3],featureArray[4],featureArray[5],featureArray[6])
-
}
+
        }
 +
               
restrictionPlasmid.setDNA(memoryPlasmid.features[1].sequence)
restrictionPlasmid.setDNA(memoryPlasmid.features[1].sequence)
for (item in memoryPlasmid.memoryObjects){
for (item in memoryPlasmid.memoryObjects){
Line 682: Line 550:
restrictionPlasmid.zfTarget = featureArray[1]
restrictionPlasmid.zfTarget = featureArray[1]
}
}
-
//genbank()
+
        genbank()
-
json = createJSON()
+
-
$('.visualizationButtons').append('<form name="test"><input type="textfield" value="'+escape(JSON.stringify(json))+'"><input type="submit" id="visualizationButton'+number+'" value="Submit" onClick="init()"/></form>')
+
-
}
+
-
 
+
-
function setup(){
+
-
addForbiddenSequences()
+
-
sensors = document.plasmidForm.sensors.value.toLowerCase()
+
-
sensorArray = formatSensors(sensors)
+
-
        promoters = formatPartsregistryPromoters()
+
-
        sensorArray = promoters.concat(sensorArray)
+
-
tempArray = new Array()
+
-
j = 0
+
-
number = 0
+
-
for (sensor in sensorArray){
+
-
tempArray[j] = sensorArray[sensor]
+
-
j++
+
-
if (j%5 === 0 && j !== 0){
+
-
configuratePlasmid(tempArray,number)
+
-
number++
+
-
tempArray = new Array()
+
-
j = 0
+
-
}
+
-
}
+
-
if (j%5 !== 0){
+
-
configuratePlasmid(tempArray,number)
+
-
}
+
-
}
+
-
 
+
-
function createJSON(){
+
-
var json = {
+
-
    "children": [
+
-
      {
+
-
        "children": [],
+
-
        "data": {
+
-
          "description": "Fixed polar interpolation problem when theta = pi",
+
-
          "$color": "#B0AAF6",
+
-
          "$angularWidth": 1000,
+
-
        },
+
-
        "id": "Source/Coordinates",
+
-
        "name": "Backbone"
+
-
      },
+
-
      {
+
-
        "children": [],
+
-
        "data": {
+
-
          "description": "Memory part",
+
-
          "$color": "#B2ABF4",
+
-
          "$angularWidth": 1000,
+
-
        },
+
-
        "id": "Source/Core",
+
-
        "name": "Memory part"
+
-
      },
+
-
     
+
-
    ],
+
-
    "data": {
+
-
      "$type": "none"
+
-
    },
+
-
    "id": "Source",
+
-
    "name": "Plasmid"
+
-
  };
+
-
json.children[0].children[0] = {}
+
-
json.children[0].children[0].data = {}
+
-
json.children[0].children[0].data.description = memoryPlasmid.features[1].description
+
-
json.children[0].children[0].data.$color = '#B2ABF4'
+
-
json.children[0].children[0].data.length = memoryPlasmid.features[1].end - memoryPlasmid.features[1].start
+
-
json.children[0].children[0].data.$angularWidth = 1000
+
-
json.children[0].children[0].data.type = memoryPlasmid.features[1].type
+
-
json.children[0].children[0].children = []
+
-
json.children[0].children[0].name = memoryPlasmid.features[1].description
+
-
json.children[0].children[0].id = memoryPlasmid.features[1].description
+
-
    i = 0
+
-
  for (memoryObject in memoryPlasmid.memoryObjects){
+
-
for (feature in memoryPlasmid.memoryObjects[memoryObject]){
+
-
json.children[1].children[i] = []
+
-
json.children[1].children[i].data = {}
+
-
json.children[1].children[i].data.description = memoryPlasmid.memoryObjects[memoryObject][feature].description
+
-
type = memoryPlasmid.memoryObjects[memoryObject][feature].type
+
-
color = '#B2ABF4'
+
-
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[1].children[i].data.$color = color
+
-
json.children[1].children[i].data.length = memoryPlasmid.memoryObjects[memoryObject][feature].end - memoryPlasmid.memoryObjects[memoryObject][feature].start
+
-
json.children[1].children[i].data.$angularWidth = 1000
+
-
json.children[1].children[i].data.type = type
+
-
json.children[1].children[i].id = i
+
-
json.children[1].children[i].name = memoryPlasmid.memoryObjects[memoryObject][feature].description
+
-
i++
+
-
}
+
-
  }
+
-
  return json
+
-
    //end
+
}
}

Revision as of 18:42, 3 September 2012

Enter your plasmid in fasta or genbank format


Enter your sensors in fasta or genbank format


Parts registry sensors: Madras


Parts registry sensors: Phage


Parts registry sensors: Metal sensitive

Parts registry sensors: Cell signalling