diff --git a/app/img/sbml-legend.svg b/app/img/sbml-legend.svg index 181c7bdd..e3e3a3b8 100644 --- a/app/img/sbml-legend.svg +++ b/app/img/sbml-legend.svg @@ -24,9 +24,9 @@ inkscape:deskcolor="#d1d1d1" inkscape:document-units="mm" showgrid="false" - inkscape:zoom="0.66504031" - inkscape:cx="348.85104" - inkscape:cy="544.32791" + inkscape:zoom="0.62905313" + inkscape:cx="265.47837" + inkscape:cy="437.16498" inkscape:window-width="1440" inkscape:window-height="847" inkscape:window-x="0" @@ -3217,50 +3217,6 @@ inkscape:export-xdpi="53.959999" inkscape:export-ydpi="53.959999" inkscape:export-filename="C:\Users\ugur\Google Drive\toolbar\process.png" />negative influence + id="path3-84" /> diff --git a/app/js/backbone-views.js b/app/js/backbone-views.js index ed840a80..79a9c44a 100644 --- a/app/js/backbone-views.js +++ b/app/js/backbone-views.js @@ -2188,6 +2188,23 @@ var NeighborhoodQueryView = Backbone.View.extend({ currentGeneralProperties.inferNestingOnLoad = currentInferNestingOnLoad; chiseInstance.endSpinner("neighborhood-spinner"); + + // Highlighting feature + eles = cy.collection(); + geneSymbolsArray.forEach(function (gene) { + eles.merge(cy.nodes().filter(function (ele) { + if(ele.data('label') && ele.data('label').toLowerCase().indexOf(gene.toLowerCase()) >= 0){ + return true; + } + return false; + })) + }) + var x = cy.elements().kNeighborhood(eles, self.currentQueryParameters.lengthLimit, 'BOTHSTREAM'); + cy.viewUtilities('get').highlight(x.neighborNodes, 2); + cy.viewUtilities('get').highlight(x.neighborEdges, 2); + cy.viewUtilities('get').highlight(eles, 0); + // Highlighting feature end + $(document).trigger("sbgnvizLoadFileEnd", [filename, cy]); } else { new PromptEmptyQueryResultView({ @@ -2256,6 +2273,23 @@ var NeighborhoodQueryView = Backbone.View.extend({ currentGeneralProperties.inferNestingOnLoad = currentInferNestingOnLoad; chiseInstance.endSpinner("neighborhood-spinner"); + + // Highlighting feature + eles = cy.collection(); + geneSymbolsArray.forEach(function (gene) { + eles.merge(cy.nodes().filter(function (ele) { + if(ele.data('label') && ele.data('label').toLowerCase().indexOf(gene.toLowerCase()) >= 0){ + return true; + } + return false; + })) + }) + var x = cy.elements().kNeighborhood(eles, self.currentQueryParameters.lengthLimit, 'BOTHSTREAM'); + cy.viewUtilities('get').highlight(x.neighborNodes, 2); + cy.viewUtilities('get').highlight(x.neighborEdges, 2); + cy.viewUtilities('get').highlight(eles, 0); + // Highlighting feature end + $(document).trigger("sbgnvizLoadFileEnd", [filename, cy]); } else if (data.error) { let { code } = data.error; @@ -2441,6 +2475,23 @@ var PathsBetweenQueryView = Backbone.View.extend({ currentGeneralProperties.inferNestingOnLoad = currentInferNestingOnLoad; chiseInstance.endSpinner("paths-between-spinner"); + + // Highlighting feature + eles = cy.collection(); + geneSymbolsArray.forEach(function (gene) { + eles.merge(cy.nodes().filter(function (ele) { + if(ele.data('label') && ele.data('label').toLowerCase().indexOf(gene.toLowerCase()) >= 0){ + return true; + } + return false; + })) + }) + var x = cy.elements().pathsBetween(eles, self.currentQueryParameters.lengthLimit, 'UNDIRECTED'); + cy.viewUtilities('get').highlight(x.resultEdges, 2); + cy.viewUtilities('get').highlight(x.resultNodes, 2); + cy.viewUtilities('get').highlight(eles, 0); + // Highlighting feature end + $(document).trigger("sbgnvizLoadFileEnd", [filename, cy]); } else { new PromptEmptyQueryResultView({ @@ -2506,6 +2557,23 @@ var PathsBetweenQueryView = Backbone.View.extend({ currentGeneralProperties.inferNestingOnLoad = currentInferNestingOnLoad; chiseInstance.endSpinner("paths-between-spinner"); + + // Highlighting feature + eles = cy.collection(); + geneSymbolsArray.forEach(function (gene) { + eles.merge(cy.nodes().filter(function (ele) { + if(ele.data('label') && ele.data('label').toLowerCase().indexOf(gene.toLowerCase()) >= 0){ + return true; + } + return false; + })) + }) + var x = cy.elements().pathsBetween(eles, self.currentQueryParameters.lengthLimit, 'UNDIRECTED'); + cy.viewUtilities('get').highlight(x.resultEdges, 2); + cy.viewUtilities('get').highlight(x.resultNodes, 2); + cy.viewUtilities('get').highlight(eles, 0); + // Highlighting feature end + $(document).trigger("sbgnvizLoadFileEnd", [filename, cy]); } else { new PromptEmptyQueryResultView({ @@ -2722,6 +2790,33 @@ var PathsFromToQueryView = Backbone.View.extend({ currentGeneralProperties.inferNestingOnLoad = currentInferNestingOnLoad; chiseInstance.endSpinner("paths-fromto-spinner"); + + // Highlighting feature + source_eles = cy.collection(); + sourceSymbolsArray.forEach(function (gene) { + source_eles.merge(cy.nodes().filter(function (ele) { + if(ele.data('label') && ele.data('label').toLowerCase().indexOf(gene.toLowerCase()) >= 0){ + return true; + } + return false; + })) + }) + target_eles = cy.collection(); + targetSymbolsArray.forEach(function (gene) { + target_eles.merge(cy.nodes().filter(function (ele) { + if(ele.data('label') && ele.data('label').toLowerCase().indexOf(gene.toLowerCase()) >= 0){ + return true; + } + return false; + })) + }) + var x = cy.elements().pathsFromTo(source_eles, target_eles, self.currentQueryParameters.lengthLimit, self.currentQueryParameters.lengthLimit, 'UNDIRECTED'); + cy.viewUtilities('get').highlight(x.edgesOnThePaths, 2); + // cy.viewUtilities('get').highlight(x.nodesOnThePaths, 2); + cy.viewUtilities('get').highlight(source_eles, 0); + cy.viewUtilities('get').highlight(target_eles, 1); + // Highlighting feature end + $(document).trigger("sbgnvizLoadFileEnd", [filename, cy]); } else { new PromptEmptyQueryResultView({ @@ -2787,6 +2882,32 @@ var PathsFromToQueryView = Backbone.View.extend({ currentGeneralProperties.inferNestingOnLoad = currentInferNestingOnLoad; chiseInstance.endSpinner("paths-fromto-spinner"); + + // Highlighting feature + source_eles = cy.collection(); + sourceSymbolsArray.forEach(function (gene) { + source_eles.merge(cy.nodes().filter(function (ele) { + if(ele.data('label') && ele.data('label').toLowerCase().indexOf(gene.toLowerCase()) >= 0){ + return true; + } + return false; + })) + }) + target_eles = cy.collection(); + targetSymbolsArray.forEach(function (gene) { + target_eles.merge(cy.nodes().filter(function (ele) { + if(ele.data('label') && ele.data('label').toLowerCase().indexOf(gene.toLowerCase()) >= 0){ + return true; + } + return false; + })) + }) + cy.viewUtilities('get').highlight(source_eles, 0); + cy.viewUtilities('get').highlight(target_eles, 1); + var x = cy.elements().pathsFromTo(source_eles, target_eles, self.currentQueryParameters.lengthLimit, 1, 'UNDIRECTED'); + cy.viewUtilities('get').highlight(x.edgesOnThePaths, 2); + // Highlighting feature end + $(document).trigger("sbgnvizLoadFileEnd", [filename, cy]); } else { new PromptEmptyQueryResultView({ @@ -2960,6 +3081,24 @@ var CommonStreamQueryView = Backbone.View.extend({ currentGeneralProperties.inferNestingOnLoad = currentInferNestingOnLoad; chiseInstance.endSpinner("common-stream-spinner"); + + // Highlighting feature + eles = cy.collection(); + geneSymbolsArray.forEach(function (gene) { + eles.merge(cy.nodes().filter(function (ele) { + if(ele.data('label') && ele.data('label').toLowerCase().indexOf(gene.toLowerCase()) >= 0){ + return true; + } + return false; + })) + }) + var x = cy.elements().commonStream(eles, self.currentQueryParameters.lengthLimit, 'BOTHSTREAM'); + cy.viewUtilities('get').highlight(x.nodesOnPath, 2); + cy.viewUtilities('get').highlight(x.edgesOnPath, 2); + cy.viewUtilities('get').highlight(x.commonNodes, 1); + cy.viewUtilities('get').highlight(eles, 0); + // Highlighting feature end + $(document).trigger("sbgnvizLoadFileEnd", [filename, cy]); } else { new PromptEmptyQueryResultView({ @@ -3025,6 +3164,24 @@ var CommonStreamQueryView = Backbone.View.extend({ currentGeneralProperties.inferNestingOnLoad = currentInferNestingOnLoad; chiseInstance.endSpinner("common-stream-spinner"); + + // Highlighting feature + eles = cy.collection(); + geneSymbolsArray.forEach(function (gene) { + eles.merge(cy.nodes().filter(function (ele) { + if(ele.data('label') && ele.data('label').toLowerCase().indexOf(gene.toLowerCase()) >= 0){ + return true; + } + return false; + })) + }) + var x = cy.elements().commonStream(eles, self.currentQueryParameters.lengthLimit, 'BOTHSTREAM'); + cy.viewUtilities('get').highlight(x.nodesOnPath, 2); + cy.viewUtilities('get').highlight(x.edgesOnPath, 2); + cy.viewUtilities('get').highlight(x.commonNodes, 1); + cy.viewUtilities('get').highlight(eles, 0); + // Highlighting feature end + $(document).trigger("sbgnvizLoadFileEnd", [filename, cy]); } else { new PromptEmptyQueryResultView({ diff --git a/app/main.js b/app/main.js index 069cd304..97b18b32 100644 --- a/app/main.js +++ b/app/main.js @@ -28,6 +28,7 @@ var cyAutopanOnDrag = require('cytoscape-autopan-on-drag'); var cyNodeEditing = require('cytoscape-node-editing'); var cyPopper = require('cytoscape-popper'); var cyLayoutUtilities = require('cytoscape-layout-utilities'); +var cyGraphAlgos = require('cytoscape-graph-algos'); // Register cy extensions cyPanzoom( cytoscape, $ ); @@ -45,6 +46,7 @@ cyAutopanOnDrag( cytoscape ); cyNodeEditing( cytoscape, $, konva ); cyPopper( cytoscape ); cyLayoutUtilities( cytoscape ); +cyGraphAlgos( cytoscape ); // Libraries to pass sbgnviz var libs = {}; diff --git a/package.json b/package.json index 0b283253..f3187c69 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,7 @@ "cytoscape-edgehandles": "~2.13.1", "cytoscape-expand-collapse": "github:iVis-at-Bilkent/cytoscape.js-expand-collapse#unstable", "cytoscape-fcose": "github:iVis-at-Bilkent/cytoscape.js-fcose#unstable", + "cytoscape-graph-algos": "github:iVis-at-Bilkent/cytoscape.js-graph-algos#master", "cytoscape-grid-guide": "github:iVis-at-Bilkent/cytoscape.js-grid-guide#unstable", "cytoscape-layout-utilities": "github:iVis-at-Bilkent/cytoscape.js-layout-utilities#unstable", "cytoscape-node-editing": "github:iVis-at-Bilkent/cytoscape.js-node-editing#unstable",