Skip to content

Commit a5fd5f6

Browse files
committed
new knetmaps 2.0.1
1 parent be2cb00 commit a5fd5f6

13 files changed

+1953
-2504
lines changed

config/url_mappings.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ var url_mappings= {
5656
{"cv": "TX", "weblink": "http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=", "cc_restriction": ""},
5757
{"cv": "UNIPROTKB", "weblink": "http://www.uniprot.org/uniprot/", "cc_restriction": ""},
5858
{"cv": "YeastCyc", "weblink": "https://yeast.biocyc.org/YEAST/NEW-IMAGE?type=NIL&object=", "cc_restriction": ""},
59-
{"cv": "HumanCyc", "weblink": "https://humancyc.org/HUMAN/substring-search?type=NIL&object=", "cc_restriction": ""}
59+
{"cv": "HumanCyc", "weblink": "https://humancyc.org/HUMAN/substring-search?type=NIL&object=", "cc_restriction": ""},
60+
{"cv": "CHEMBL", "weblink": "https://www.ebi.ac.uk/chembl/compound_report_card/", "cc_restriction": ""}
6061
]
61-
};
62+
};

css/knet-style.css

+10-9
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@
4444
#knetmaps-menu input#relayoutNetwork.unhover { border: none; width:36px; height:36px; background:url("../img/relayoutNetwork.png") no-repeat; }
4545
#knetmaps-menu input#openItemInfoBtn.unhover { border: none; width:36px; height:36px; background:url("../img/openItemInfoBtn.png") no-repeat; }
4646
#knetmaps-menu input#resetNetwork.unhover { border: none; width:36px; height:36px; background:url("../img/resetNetwork.png") no-repeat; }
47-
#knetmaps-menu input#savePNG.unhover { border: none; width:36px; height:36px; background:url("../img/savePNG.png") no-repeat; }
48-
#knetmaps-menu input#saveJSON.unhover { border: none; width:36px; height:36px; background:url("../img/saveJSON.png") no-repeat; }
47+
/* #knetmaps-menu input#savePNG.unhover { border: none; width:36px; height:36px; background:url("../img/savePNG.png") no-repeat; }
48+
#knetmaps-menu input#saveJSON.unhover { border: none; width:36px; height:36px; background:url("../img/saveJSON.png") no-repeat; } */
4949
#knetmaps-menu input#helpURL.unhover { border: none; width:36px; height:36px; background:url("../img/help.png") no-repeat; }
50-
#knetmaps-menu input#openJSON.unhover { border: none; width:36px; height:36px; background:url("../img/openJSON.png") no-repeat; }
50+
/* #knetmaps-menu input#openJSON.unhover { border: none; width:36px; height:36px; background:url("../img/openJSON.png") no-repeat; } */
5151
input#btnCloseItemInfoPane { border: none; width:22px; height:22px; background:url("../img/close-icon.png") no-repeat; }
5252

5353
#knetmaps-menu input#maximizeOverlay.max.hover { border: none; width:36px; height:36px; background:url("../img/maximizeOverlay_hover.png") no-repeat; }
@@ -56,10 +56,10 @@ input#btnCloseItemInfoPane { border: none; width:22px; height:22px; background:u
5656
#knetmaps-menu input#relayoutNetwork.hover { border: none; width:36px; height:36px; background:url("../img/relayoutNetwork_hover.png") no-repeat; }
5757
#knetmaps-menu input#openItemInfoBtn.hover { border: none; width:36px; height:36px; background:url("../img/openItemInfoBtn_hover.png") no-repeat; }
5858
#knetmaps-menu input#resetNetwork.hover { border: none; width:36px; height:36px; background:url("../img/resetNetwork_hover.png") no-repeat; }
59-
#knetmaps-menu input#savePNG.hover { border: none; width:36px; height:36px; background:url("../img/savePNG_hover.png") no-repeat; }
60-
#knetmaps-menu input#saveJSON.hover { border: none; width:36px; height:36px; background:url("../img/saveJSON_hover.png") no-repeat; }
59+
/* #knetmaps-menu input#savePNG.hover { border: none; width:36px; height:36px; background:url("../img/savePNG_hover.png") no-repeat; }
60+
#knetmaps-menu input#saveJSON.hover { border: none; width:36px; height:36px; background:url("../img/saveJSON_hover.png") no-repeat; } */
6161
#knetmaps-menu input#helpURL.hover { border: none; width:36px; height:36px; background:url("../img/help_hover.png") no-repeat; }
62-
#knetmaps-menu input#openJSON.hover { border: none; width:36px; height:36px; background:url("../img/openJSON_hover.png") no-repeat; }
62+
/* #knetmaps-menu input#openJSON.hover { border: none; width:36px; height:36px; background:url("../img/openJSON_hover.png") no-repeat; } */
6363
input.knetSynonym { border: none; width:22px; height:22px; background:url("../img/labelEye.png") }
6464

6565
input.knetCon_Biological_Process { border: none; width:22px; height:22px; background:url("../img/Biological_Process.png") }
@@ -270,10 +270,11 @@ input.knetCon_Trait_Ontology { border: none; width:22px; height:22px; background
270270
.icon_caption {
271271
display: block;/*float:below;*/
272272
font-size: 11.5px;
273-
}
274-
275-
/* Alter opacity of images */
273+
}
274+
275+
/* Alter opacity of images */
276276
.opacity_class {
277277
opacity:0.4;
278278
filter:alpha(opacity=40); /* For IE8 and earlier */
279279
}
280+

gulp.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ module.exports = function () {
1818
'./libs/jquery*.js',
1919
'./libs/FileSaver.min.js',
2020
'./libs/cytoscape.min.js',
21-
'./libs/cytoscape-*.js',
21+
'./libs/cytoscape-*.js'
2222
],
2323

2424
// the development output
25-
build: './dist/',
25+
build: './dist/',
2626
outputImages: './dist/img',
2727
outputCss: './dist/css',
2828
outputJs: './dist/js',

image/saveJSON.png

-692 Bytes
Loading

image/saveJSON_hover.png

-803 Bytes
Loading

image/saveJSON_hover_old.png

2.1 KB
Loading

image/saveJSON_old.png

1.97 KB
Loading

javascript/knet-container.js

+79-64
Original file line numberDiff line numberDiff line change
@@ -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({ }); */
143109
cy.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

347362
return my;
348363
};

javascript/knet-generator.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ KNETMAPS.Generator = function() {
1111

1212
var my = function() {};
1313

14-
// initialize and generate the network from default global vars
14+
// initialize and generate the network from default global vars
1515
my.generateNetworkGraph=function(eles_jsons, metadata_json, eles_styles) {
1616
//console.log("Dataset file path: "+ json_File);
1717
graphJSON = eles_jsons; // set graphJSON to reloaded JSON.
@@ -37,7 +37,7 @@ KNETMAPS.Generator = function() {
3737
my.generateNetworkGraphRaw=function(json_blob) {
3838
//console.log("Dataset file path: "+ json_File);
3939
eval(json_blob+'; my.initializeNetworkView(graphJSON, allGraphData); my.blurNodesWithHiddenNeighborhood(); stats.updateKnetStats(); legend.populateConceptLegend();');
40-
}
40+
};
4141

4242
// initialize the network
4343
my.initializeNetworkView=function(networkJSON, metadataJSON, existing_styles) {

0 commit comments

Comments
 (0)