Skip to content

Commit

Permalink
set default value for old position values in pre-processing (might no…
Browse files Browse the repository at this point in the history
…t actually be necessary). Also now valid types are identified with lowercase identifying names, making any type of casing in the json valid. The name in the json is converted to lower and then compared.
  • Loading branch information
ivp08001 committed Jan 24, 2016
1 parent c3ad490 commit 3559188
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 25 deletions.
50 changes: 27 additions & 23 deletions VQI_PathwayEditorGUI.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var VQI_PathwayEditorGUI = function (parent) {

// Globals
var self = this;
var types = ["bundleOne", "bundleTwo", "gene", "geneProduct", "protein", "rna", "microRNA", "kinase", "ligand", "receptor", "biologicalProcess", "triangle", "rectangle", "circle", "ellipse", "pentagon", "hexagon", "heptagon", "octagon", "star", "diamond", "vee", "rhomboid", "label"];
var types = ["bundleone", "bundletwo", "gene", "geneproduct", "protein", "rna", "microrna", "kinase", "ligand", "receptor", "biologicalprocess", "triangle", "rectangle", "circle", "ellipse", "pentagon", "hexagon", "heptagon", "octagon", "star", "diamond", "vee", "rhomboid", "label"];
var personId = "";
var pathName = "";
var states = [];
Expand Down Expand Up @@ -155,8 +155,8 @@ var VQI_PathwayEditorGUI = function (parent) {
strVar += " <fieldset>";
strVar += " <label for=\"" + parent + "-type-bundle\">type:<\/label>";
strVar += " <select style=\"width: 150px\" id=\"" + parent + "-type-bundle\" name=\"" + parent + "-type-bundle\">";
strVar += " <option selected=\"\">bundleOne<\/option>";
strVar += " <option>bundleTwo<\/option>";
strVar += " <option selected=\"\">bundleone<\/option>";
strVar += " <option>bundletwo<\/option>";
strVar += " <\/select>";
strVar += " <\/fieldset>";
strVar += " <\/form>";
Expand Down Expand Up @@ -248,17 +248,17 @@ var VQI_PathwayEditorGUI = function (parent) {
strVar += " <div class =\"form-group\">";
strVar += " <label for=\"" + parent + "-type-node\">type:<\/label>";
strVar += " <select style=\"width: 150px\" id=\"" + parent + "-type-node\" class=\"form-control\" name=\"" + parent + "-type-node\">";
strVar += " <option id=\"" + parent + "-select-bundleOne\" selected=\"\">bundleOne<\/option>";
strVar += " <option id=\"" + parent + "-select-bundleTwo\">bundleTwo<\/option>";
strVar += " <option id=\"" + parent + "-select-bundleOne\" selected=\"\">bundleone<\/option>";
strVar += " <option id=\"" + parent + "-select-bundleTwo\">bundletwo<\/option>";
strVar += " <option id=\"" + parent + "-select-gene\">gene<\/option>";
strVar += " <option id=\"" + parent + "-select-geneProduct\">geneProduct<\/option>";
strVar += " <option id=\"" + parent + "-select-geneProduct\">geneproduct<\/option>";
strVar += " <option id=\"" + parent + "-select-protein\">protein<\/option>";
strVar += " <option id=\"" + parent + "-select-rna\">rna<\/option>";
strVar += " <option id=\"" + parent + "-select-mircoRNA\">microRNA<\/option>";
strVar += " <option id=\"" + parent + "-select-mircoRNA\">microrna<\/option>";
strVar += " <option id=\"" + parent + "-select-kinase\">kinase<\/option>";
strVar += " <option id=\"" + parent + "-select-ligand\">ligand<\/option>";
strVar += " <option id=\"" + parent + "-select-receptor\">receptor<\/option>";
strVar += " <option id=\"" + parent + "-select-biologicalProcess\">biologicalProcess<\/option>";
strVar += " <option id=\"" + parent + "-select-biologicalprocess\">biologicalProcess<\/option>";
strVar += " <option id=\"" + parent + "-select-triangle\">triangle<\/option>";
strVar += " <option id=\"" + parent + "-select-rectangle\">rectangle<\/option>";
strVar += " <option id=\"" + parent + "-select-circle\">circle<\/option>";
Expand Down Expand Up @@ -510,9 +510,11 @@ var VQI_PathwayEditorGUI = function (parent) {
obj.elements.nodes[i].data.zIndex = 0;
}

if (types.indexOf(obj.elements.nodes[i].data.Type) == -1) {
if (types.indexOf(obj.elements.nodes[i].data.Type.toLowerCase()) == -1) {
obj.elements.nodes[i].data.Type = "label";
}
} else {
obj.elements.nodes[i].data.Type = obj.elements.nodes[i].data.Type.toLowerCase();
}

if (typeof (obj.elements.nodes[i].data.rna) == "undefined") {
obj.elements.nodes[i].data.rna = 0;
Expand All @@ -525,10 +527,13 @@ var VQI_PathwayEditorGUI = function (parent) {
if (typeof (obj.elements.nodes[i].data.mut) == "undefined") {
obj.elements.nodes[i].data.mut = 0;
}

if (obj.elements.nodes[i].data.Type == "gene") {
obj.elements.nodes[i].data.Height = 20;
obj.elements.nodes[i].data.Width = 50;

if (typeof (obj.elements.nodes[i].data.oldPositionX) == "undefined") {
obj.elements.nodes[i].data.oldPositionX = 0;
}

if (typeof (obj.elements.nodes[i].data.oldPositionY) == "undefined") {
obj.elements.nodes[i].data.oldPositionY = 0;
}
}

Expand Down Expand Up @@ -738,8 +743,7 @@ var VQI_PathwayEditorGUI = function (parent) {
}
}
dupCounter++;
cy.add(node);
cy.add(edge);
cy.add(node.concat(edge));
postAddProcessing();
saveState();
}
Expand Down Expand Up @@ -1590,15 +1594,15 @@ var VQI_PathwayEditorGUI = function (parent) {
'background-image-opacity': .75,
'opacity': 0.75,
'text-opacity': 0.75
}).selector('node[Type="bundleOne"]').css({
}).selector('node[Type="bundleone"]').css({
'shape': 'roundrectangle',
'background-color': 'lightgray',
'color': 'black',
'text-valign': 'center',
'border-color': 'black',
'border-style': 'solid',
'border-width': 1
}).selector('node[Type="bundleTwo"]').css({
}).selector('node[Type="bundletwo"]').css({
'shape': 'roundrectangle',
'background-color': 'gray',
'color': 'black',
Expand All @@ -1616,7 +1620,7 @@ var VQI_PathwayEditorGUI = function (parent) {
'border-color': 'black',
'border-style': 'solid',
'border-width': 1
}).selector('node[Type="geneProduct"]').css({
}).selector('node[Type="geneproduct"]').css({
'shape': 'circle',
'radius': 5,
'color': 'black',
Expand Down Expand Up @@ -1644,7 +1648,7 @@ var VQI_PathwayEditorGUI = function (parent) {
'border-color': 'black',
'border-style': 'dotted',
'border-width': 1
}).selector('node[Type="microRNA"]').css({
}).selector('node[Type="microrna"]').css({
'shape': 'circle',
'radius': 5,
'color': 'black',
Expand Down Expand Up @@ -1683,7 +1687,7 @@ var VQI_PathwayEditorGUI = function (parent) {
'border-color': 'black',
'border-style': 'double',
'border-width': 1
}).selector('node[Type="biologicalProcess"]').css({
}).selector('node[Type="biologicalprocess"]').css({
'shape': 'roundrectangle',
'width': 'data(Width)',
'height': 'data(Height)',
Expand Down Expand Up @@ -1939,8 +1943,8 @@ var VQI_PathwayEditorGUI = function (parent) {
'height': .01
}).selector('.collapsed_informative').css({
'shape': 'circle',
'width': 7,
'height': 7,
'width': 6,
'height': 6,
'color': 'black',
'text-valign': 'center',
'border-color': 'black',
Expand Down
5 changes: 3 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@
<script src="dependencies/cytoscape.js-2.5.4/cytoscape.js"></script>
</head>
<body>
<input type=button onclick="load()" value="load">
<!-- <input type=button onclick="load()" value="load">
<input type=button onclick="spray()" value="spray">
<input type=button onclick="setPersonId()" value="set Person id">
<input type=button onclick="print()" value="print">
<input type=button onclick="save()" value="save">
<input id="file" type=file value="spray from file">
-->
<div id="parent"></div>
<script src="VQI_Observable.js"></script>
<script src="VQI_PathwayEditorGUI.js"></script>
Expand Down Expand Up @@ -62,7 +63,7 @@ function save() {
objVQI_PathwayEditorNoGUI.produceJSONExternalNoGUI();
}
document.getElementById("file").addEventListener("change", sprayFromFile);
// document.getElementById("file").addEventListener("change", sprayFromFile);
</script>
</body>
</html>

0 comments on commit 3559188

Please sign in to comment.