Skip to content

Commit

Permalink
Merge pull request #714 from umut-er/unstable
Browse files Browse the repository at this point in the history
Highlight query seed genes / paths #389
  • Loading branch information
umut-er authored Jun 13, 2024
2 parents 7abcfd5 + fd17962 commit 2a0c4a2
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 0 deletions.
157 changes: 157 additions & 0 deletions app/js/backbone-views.js
Original file line number Diff line number Diff line change
Expand Up @@ -2183,6 +2183,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({
Expand Down Expand Up @@ -2251,6 +2268,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;
Expand Down Expand Up @@ -2421,6 +2455,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({
Expand Down Expand Up @@ -2486,6 +2537,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({
Expand Down Expand Up @@ -2702,6 +2770,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({
Expand Down Expand Up @@ -2767,6 +2862,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({
Expand Down Expand Up @@ -2940,6 +3061,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({
Expand Down Expand Up @@ -3005,6 +3144,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({
Expand Down
2 changes: 2 additions & 0 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, $ );
Expand All @@ -45,6 +46,7 @@ cyAutopanOnDrag( cytoscape );
cyNodeEditing( cytoscape, $, konva );
cyPopper( cytoscape );
cyLayoutUtilities( cytoscape );
cyGraphAlgos( cytoscape );

// Libraries to pass sbgnviz
var libs = {};
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 2a0c4a2

Please sign in to comment.