@@ -73,60 +73,27 @@ cy.boxSelectionEnabled(false); // to disable box selection & hence allow Panning
7373/* cy.nodes().forEach(function( ele ) {
7474 var conType= ele.data('conceptType');
7575 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'; }
12492 var eleImage= 'image/'+ imgName +'.png';
12593// var eleImage= data_url +'image/'+ imgName +'.png';
126-
12794 // Add these properties to this element's JSON.
12895 ele.data('nodeImage', eleImage);
129- // console.log("data.nodeImage "+ ele.data('nodeImage'));
96+ // console.log("set data.nodeImage "+ ele.data('nodeImage'));
13097 });
13198
13299 // 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
136103 }).update();
137104*/
138105
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.
141107 * Note: Specify 'node' or 'edge' to bind an event to a specific type of element.
142108 * e.g, cy.elements('node').qtip({ }); or cy.elements('edge').qtip({ }); */
143109cy . elements ( ) . qtip ( {
@@ -160,10 +126,7 @@ cy.elements().qtip({
160126 } ,
161127 style : {
162128 classes : 'qtip-bootstrap' ,
163- tip : {
164- width : 12 ,
165- height : 6
166- }
129+ tip : { width : 12 , height : 6 }
167130 }
168131} ) ;
169132
@@ -185,15 +148,15 @@ cy.elements().qtip({
185148 info = info + "<br/><b>To:</b> " + cy . $ ( '#' + toID ) . data ( 'value' ) + " (" + cy . $ ( '#' + toID ) . data ( 'conceptType' ) . toLowerCase ( ) + ")" ;
186149 }
187150 }
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" ; }
189152 console . log ( info ) ;
190153 iteminfo . showItemInfo ( thisElement ) ;
191154 } ) ;
192155// cxttap - normalised right click or 2-finger tap event.
193156
194157 /** Popup (context) menu: a circular Context Menu for each Node (concept) & Edge (relation) using the 'cxtmenu' jQuery plugin. */
195158 var contextMenu = {
196- menuRadius : 75 , // the radius of the circular menu in pixels
159+ menuRadius : 80 , // the radius of the circular menu in pixels
197160
198161 // Use selector: '*' to set this circular Context Menu on all the elements of the core.
199162 /** 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({
206169 select : function ( ) {
207170 // Show Item Info Pane.
208171 iteminfo . openItemInfoPane ( ) ;
209-
210172 // Display Item Info.
211173 iteminfo . showItemInfo ( this ) ;
212174 }
@@ -231,11 +193,12 @@ cy.elements().qtip({
231193 this . addClass ( 'HideEle' ) ;
232194 // Refresh network legend.
233195 stats . updateKnetStats ( ) ;
234- conceptLegend . populateConceptLegend ( ) ;
196+ conceptLegend . populateConceptLegend ( ) ;
235197 }
236198 } ,
237-
238- {
199+
200+ // disabled Hide by Type feature (Jan. 2020)
201+ /* {
239202 content: 'Hide by Type',
240203 select: function() { // Hide all concepts (nodes) of the same type.
241204 if(this.isNode()) {
@@ -266,10 +229,62 @@ cy.elements().qtip({
266229 }
267230 // Refresh network Stats.
268231 stats.updateKnetStats();
269- conceptLegend . populateConceptLegend ( ) ;
232+ conceptLegend.populateConceptLegend();
270233 }
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+ }
271251 } ,
272252
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+
273288 {
274289 content : 'Label on/ off by Type' ,
275290 select : function ( ) {
@@ -342,7 +357,7 @@ cy.cxtmenu(contextMenu); // set Context Menu for all the core elements.
342357 $ ( '#infoDialog' ) . slideToggle ( 300 ) ;
343358 } ) ;
344359
345- }
360+ } ;
346361
347362return my ;
348363} ;
0 commit comments