@@ -73,60 +73,27 @@ cy.boxSelectionEnabled(false); // to disable box selection & hence allow Panning
73
73
/* cy.nodes().forEach(function( ele ) {
74
74
var conType= ele.data('conceptType');
75
75
var imgName= 'Gene'; // default
76
- if(conType === "Biological_Process") {
77
- imgName= 'Biological_process';
78
- }
79
- else if(conType === "Cellular_Component") {
80
- imgName= 'Cellular_component';
81
- }
82
- else if(conType === "Gene") {
83
- imgName= 'Gene';
84
- }
85
- else if(conType === "Protein Domain") {
86
- imgName= 'Protein_domain';
87
- }
88
- else if(conType === "Pathway") {
89
- imgName= 'Pathway';
90
- }
91
- else if(conType === "Reaction") {
92
- imgName= 'Reaction';
93
- }
94
- else if(conType === "Publication") {
95
- imgName= 'Publication';
96
- }
97
- else if(conType === "Protein") {
98
- imgName= 'Protein';
99
- }
100
- else if(conType === "Quantitative Trait Locus") {
101
- imgName= 'QTL';
102
- }
103
- else if(conType === "Enzyme") {
104
- imgName= 'Enzyme';
105
- }
106
- else if(conType === "Molecular_Function") {
107
- imgName= 'Molecular_function';
108
- }
109
- else if((conType === "Enzyme_Classification") || (conType === "Enzyme Classification")) {
110
- imgName= 'Enzyme_classification';
111
- }
112
- else if(conType === "Trait Ontology") {
113
- imgName= 'Trait_ontology';
114
- }
115
- else if(conType === "Scaffold") {
116
- imgName= 'Scaffold';
117
- }
118
- else if((conType === "Compound") || (conType === "SNP")) {
119
- imgName= 'Compound';
120
- }
121
- else if(conType === "Phenotype") {
122
- imgName= 'Phenotype';
123
- }
76
+ if(conType === "Biological_Process") { imgName= 'Biological_process'; }
77
+ else if(conType === "Cellular_Component") { imgName= 'Cellular_component'; }
78
+ else if(conType === "Gene") { imgName= 'Gene'; }
79
+ else if(conType === "Protein Domain") { imgName= 'Protein_domain'; }
80
+ else if(conType === "Pathway") { imgName= 'Pathway'; }
81
+ else if(conType === "Reaction") { imgName= 'Reaction'; }
82
+ else if(conType === "Publication") { imgName= 'Publication'; }
83
+ else if(conType === "Protein") { imgName= 'Protein'; }
84
+ else if(conType === "Quantitative Trait Locus") { imgName= 'QTL'; }
85
+ else if(conType === "Enzyme") { imgName= 'Enzyme'; }
86
+ else if(conType === "Molecular_Function") { imgName= 'Molecular_function'; }
87
+ else if((conType === "Enzyme_Classification") || (conType === "Enzyme Classification")) { imgName= 'Enzyme_classification'; }
88
+ else if(conType === "Trait Ontology") { imgName= 'Trait_ontology'; }
89
+ else if(conType === "Scaffold") { imgName= 'Scaffold'; }
90
+ else if((conType === "Compound") || (conType === "SNP")) { imgName= 'Compound'; }
91
+ else if(conType === "Phenotype") { imgName= 'Phenotype'; }
124
92
var eleImage= 'image/'+ imgName +'.png';
125
93
// var eleImage= data_url +'image/'+ imgName +'.png';
126
-
127
94
// Add these properties to this element's JSON.
128
95
ele.data('nodeImage', eleImage);
129
- // console.log("data.nodeImage "+ ele.data('nodeImage'));
96
+ // console.log("set data.nodeImage "+ ele.data('nodeImage'));
130
97
});
131
98
132
99
// Update the stylesheet for the Network Graph to show background images for Nodes.
@@ -136,8 +103,7 @@ cy.boxSelectionEnabled(false); // to disable box selection & hence allow Panning
136
103
}).update();
137
104
*/
138
105
139
- /** Add a Qtip message to all the nodes & edges using QTip displaying their Concept Type & value when a
140
- * node/ edge is clicked.
106
+ /** Add a Qtip message to all the nodes & edges using QTip displaying their Concept Type & value when a node/ edge is clicked.
141
107
* Note: Specify 'node' or 'edge' to bind an event to a specific type of element.
142
108
* e.g, cy.elements('node').qtip({ }); or cy.elements('edge').qtip({ }); */
143
109
cy . elements ( ) . qtip ( {
@@ -160,10 +126,7 @@ cy.elements().qtip({
160
126
} ,
161
127
style : {
162
128
classes : 'qtip-bootstrap' ,
163
- tip : {
164
- width : 12 ,
165
- height : 6
166
- }
129
+ tip : { width : 12 , height : 6 }
167
130
}
168
131
} ) ;
169
132
@@ -185,15 +148,15 @@ cy.elements().qtip({
185
148
info = info + "<br/><b>To:</b> " + cy . $ ( '#' + toID ) . data ( 'value' ) + " (" + cy . $ ( '#' + toID ) . data ( 'conceptType' ) . toLowerCase ( ) + ")" ;
186
149
}
187
150
}
188
- catch ( err ) { info = "Selected element is neither a Concept nor a Relation" ; }
151
+ catch ( err ) { info = "Selected element is neither a Concept nor a Relation" ; }
189
152
console . log ( info ) ;
190
153
iteminfo . showItemInfo ( thisElement ) ;
191
154
} ) ;
192
155
// cxttap - normalised right click or 2-finger tap event.
193
156
194
157
/** Popup (context) menu: a circular Context Menu for each Node (concept) & Edge (relation) using the 'cxtmenu' jQuery plugin. */
195
158
var contextMenu = {
196
- menuRadius : 75 , // the radius of the circular menu in pixels
159
+ menuRadius : 80 , // the radius of the circular menu in pixels
197
160
198
161
// Use selector: '*' to set this circular Context Menu on all the elements of the core.
199
162
/** Note: Specify selector: 'node' or 'edge' to restrict the context menu to a specific type of element. e.g,
@@ -206,7 +169,6 @@ cy.elements().qtip({
206
169
select : function ( ) {
207
170
// Show Item Info Pane.
208
171
iteminfo . openItemInfoPane ( ) ;
209
-
210
172
// Display Item Info.
211
173
iteminfo . showItemInfo ( this ) ;
212
174
}
@@ -231,11 +193,12 @@ cy.elements().qtip({
231
193
this . addClass ( 'HideEle' ) ;
232
194
// Refresh network legend.
233
195
stats . updateKnetStats ( ) ;
234
- conceptLegend . populateConceptLegend ( ) ;
196
+ conceptLegend . populateConceptLegend ( ) ;
235
197
}
236
198
} ,
237
-
238
- {
199
+
200
+ // disabled Hide by Type feature (Jan. 2020)
201
+ /* {
239
202
content: 'Hide by Type',
240
203
select: function() { // Hide all concepts (nodes) of the same type.
241
204
if(this.isNode()) {
@@ -266,10 +229,62 @@ cy.elements().qtip({
266
229
}
267
230
// Refresh network Stats.
268
231
stats.updateKnetStats();
269
- conceptLegend . populateConceptLegend ( ) ;
232
+ conceptLegend.populateConceptLegend();
270
233
}
234
+ }, */
235
+
236
+ {
237
+ // Turn the highlighter on or off, respectively.
238
+ content : 'Highlighter on/off' ,
239
+ select : function ( ) {
240
+ if ( this . isNode ( ) && this . css ( 'text-background-opacity' ) == '1' ) {
241
+ this . css ( {
242
+ 'text-background-opacity' : '0'
243
+ } ) ;
244
+ }
245
+ else if ( this . isNode ( ) && this . css ( 'text-background-opacity' ) == '0' ) {
246
+ this . css ( {
247
+ 'text-background-opacity' : '1'
248
+ } ) ;
249
+ }
250
+ }
271
251
} ,
272
252
253
+ // {
254
+ // content: 'Hide by Type',
255
+ // select: function() { // Hide all concepts (nodes) of the same type.
256
+ // if(this.isNode()) {
257
+ // var thisConceptType= this.data('conceptType');
258
+ // // console.log("Hide Concept by Type: "+ thisConceptType);
259
+ // cy.nodes().forEach(function( ele ) {
260
+ // if(ele.data('conceptType') === thisConceptType) {
261
+ // //ele.hide();
262
+ // ele.removeClass('ShowEle');
263
+ // ele.addClass('HideEle');
264
+ // }
265
+ // });
266
+ // // Relayout the graph.
267
+ // //rerunLayout();
268
+ // }
269
+ // else if(this.isEdge()) { // Hide all relations (edges) of the same type.
270
+ // var thisRelationType= this.data('label');
271
+ // // console.log("Hide Relation (by Label type): "+ thisRelationType);
272
+ // cy.edges().forEach(function( ele ) {
273
+ // if(ele.data('label') === thisRelationType) {
274
+ // //ele.hide();
275
+ // ele.removeClass('ShowEle');
276
+ // ele.addClass('HideEle');
277
+ // }
278
+ // });
279
+ // // Relayout the graph.
280
+ // // rerunLayout();
281
+ // }
282
+ // // Refresh network Stats.
283
+ // stats.updateKnetStats();
284
+ // conceptLegend.populateConceptLegend();
285
+ // }
286
+ // },
287
+
273
288
{
274
289
content : 'Label on/ off by Type' ,
275
290
select : function ( ) {
@@ -342,7 +357,7 @@ cy.cxtmenu(contextMenu); // set Context Menu for all the core elements.
342
357
$ ( '#infoDialog' ) . slideToggle ( 300 ) ;
343
358
} ) ;
344
359
345
- }
360
+ } ;
346
361
347
362
return my ;
348
363
} ;
0 commit comments