-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPD_stringDB.html
More file actions
3902 lines (3195 loc) · 129 KB
/
PD_stringDB.html
File metadata and controls
3902 lines (3195 loc) · 129 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<meta charset="utf-8">
<script src="../authentication/js/environment.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script type="text/javascript" src="script/jquery-3.3.1.js"></script>
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> -->
<!-- <script src='/script/jquery-ui.js'></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>-->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.8/FileSaver.js"></script>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script type="text/javascript" src="script/d3-legend.min.js"></script>
<script type="text/javascript" src="script/math.js"></script>
<link rel="stylesheet" type="text/css" href="css/network.css">
<!-- <script src="./.url.js"></script> -->
<script>
function getItemFromStorage(key) {
if (window.location.pathname.split('/').includes("pdnet_dev")) {
return localStorage.getItem(key + '_dev');
} else {
return localStorage.getItem(key);
}
}
function setItemToStorage(key, item) {
if (window.location.pathname.split('/').includes("pdnet_dev")) {
localStorage.setItem(key + '_dev', item);
} else {
localStorage.setItem(key, item);
}
}
//An ajax call to read universal node file which contain data for different filters.
// $.getJSON( "data/json/GRCH38-p12-uniNode_V4.json", function( json ) {
// console.log( "JSON Data received, name is " + json.name);
// });
// $.ajax({
// //url: 'data/json/GRCH38-p12-uniNode_V4.json', // taking long time to load
// url: 'data/json/PD_universal_GRCH38p13_V4.json', // taking long time to load
// dataType: 'json',
// // crossDomain: 'http://*',
// success: function (data) {
function getUniversal(data) {
console.log("uniNode loaded")
uniNode = data;
uniNodeHeaders = Object.keys(uniNode.headers);
//Seperate different headers like Pathways, Directions, etc. to populate corresponding drop-down
uniNodeLogFC = uniNodeHeaders.filter((header) => header.startsWith("logFC_"));
// uniNodePLogFC = uniNodeLogFC.filter((header) => header.startsWith("logFC_proteomics"));
uniNodeGLogFC = uniNodeLogFC.filter((header) => header.startsWith("logFC_"));
uniNodeDirection = uniNodeHeaders.filter((header) => header.startsWith("direction_"));
uniNodePathway = uniNodeHeaders.filter((header) => header.startsWith("pathway_"));
uniNodeMarkers = uniNodeHeaders.filter((header) => header.startsWith("CellType_"));
uniNodePvalue = uniNodeHeaders.filter((header) => header.startsWith("pvalue_"));
uniNodeTrait = uniNodeHeaders.filter((header) => header.startsWith("trait_"));
uniNodeGWAS = uniNodeHeaders.filter((header) => header.startsWith("GWAS_"));
uniNodeDBs = uniNodeHeaders.filter((header) => header.startsWith("database_"));
uniNodeCustomColors = uniNodeHeaders.filter((header) => header.startsWith("custom_color_"));
// console.log("uniNodeDBs:", uniNodeDBs)
uniNodeRelevence = uniNodeHeaders.filter((header) => header.startsWith("relevence_"));
//************************* TO POPULATE DROP DOWNS
//Populate all the dropdowns (logFCID4Color, directionID4Color, etc.) in left menu with different headers
for (var key = 0; key < uniNodeLogFC.length; key++) {
$('<option/>').val(uniNodeLogFC[key]).text(jsUcFirst(uniNodeLogFC[key])).appendTo(
'#logFCID4Color')
};
//For Direction Color
for (var key = 0; key < uniNodeDirection.length; key++) {
$('<option/>').val(uniNodeDirection[key]).text(jsUcFirst(uniNodeDirection[key])).appendTo(
'#directionID4Color')
};
//For Direction Size
for (var key = 0; key < uniNodeDirection.length; key++) {
$('<option/>').val(uniNodeDirection[key]).text(jsUcFirst(uniNodeDirection[key])).appendTo(
'#directionID4Size')
};
//For Direction Shape
//for (var key = 0; key < uniNodeDirection.length; key++) {
//$('<option/>').val(uniNodeDirection[key]).text(jsUcFirst(uniNodeDirection[key])).appendTo('#directionID4Shape')
//};
//For Pathways color
for (var key = 0; key < uniNodePathway.length; key++) {
//var val = sample[0]+"_"+pathwayList[key];
$('<option/>').val(uniNodePathway[key]).text(jsUcFirst(uniNodePathway[key])).appendTo(
'#pathwayID4Color')
};
//For Custom color
for (var key = 0; key < uniNodeCustomColors.length; key++) {
//var val = sample[0]+"_"+pathwayList[key];
$('<option/>').val(uniNodeCustomColors[key]).text(jsUcFirst(uniNodeCustomColors[key])).appendTo(
'#custom4Color')
};
//For Pathways Shape
for (var key = 0; key < uniNodePathway.length; key++) {
//var val = sample[0]+"_"+pathwayList[key];
$('<option/>').val(uniNodePathway[key]).text(jsUcFirst(uniNodePathway[key])).appendTo(
'#pathwayID4Shape')
};
for (var key = 0; key < uniNodeGLogFC.length; key++) {
$('<option/>').val(uniNodeGLogFC[key]).text(jsUcFirst(uniNodeGLogFC[key])).appendTo(
'#GlogFCID4Size')
};
//Trait for Size
for (var key = 0; key < uniNodeTrait.length; key++) {
//var val = sample[0]+"_"+pathwayList[key];
if (uniNodeTrait[key] != "trait_Module_ID") $('<option/>').val(uniNodeTrait[key]).text(
jsUcFirst(uniNodeTrait[key])).appendTo('#traitID4Size')
//$('<option/>').val("trait_" + traitList[key]).text(jsUcFirst(traitList[key])).appendTo('#traitID4Size')
};
//GWAS 4 color
for (var key = 0; key < uniNodeGWAS.length; key++) {
//var val = sample[0]+"_"+pathwayList[key];
if (uniNodeGWAS[key] != "GWAS_Module_ID") $('<option/>').val(uniNodeGWAS[key]).text(jsUcFirst(
uniNodeGWAS[key])).appendTo('#GWAS4Color')
//$('<option/>').val("trait_" + traitList[key]).text(jsUcFirst(traitList[key])).appendTo('#traitID4Size')
};
//GWAS 4 shape
for (var key = 0; key < uniNodeGWAS.length; key++) {
//var val = sample[0]+"_"+pathwayList[key];
if (uniNodeGWAS[key] != "GWAS_Module_ID") $('<option/>').val(uniNodeGWAS[key]).text(jsUcFirst(
uniNodeGWAS[key])).appendTo('#GWAS4Shape')
//$('<option/>').val("trait_" + traitList[key]).text(jsUcFirst(traitList[key])).appendTo('#traitID4Size')
};
//GWAS 4 Size
for (var key = 0; key < uniNodeGWAS.length; key++) {
//var val = sample[0]+"_"+pathwayList[key];
if (uniNodeGWAS[key] != "GWAS_Module_ID") $('<option/>').val(uniNodeGWAS[key]).text(jsUcFirst(
uniNodeGWAS[key])).appendTo('#gwasID4Size')
//$('<option/>').val("trait_" + traitList[key]).text(jsUcFirst(traitList[key])).appendTo('#traitID4Size')
};
//Databases 4 color
for (var key = 0; key < uniNodeDBs.length; key++) {
//var val = sample[0]+"_"+pathwayList[key];
if (uniNodeDBs[key] != "DBs_Module_ID") $('<option/>').val(uniNodeDBs[key]).text(jsUcFirst(
uniNodeDBs[key])).appendTo('#DBs4Color')
//$('<option/>').val("trait_" + traitList[key]).text(jsUcFirst(traitList[key])).appendTo('#traitID4Size')
};
//Databases 4 Shape
for (var key = 0; key < uniNodeDBs.length; key++) {
//var val = sample[0]+"_"+pathwayList[key];
if (uniNodeDBs[key] != "DBs_Module_ID") $('<option/>').val(uniNodeDBs[key]).text(jsUcFirst(
uniNodeDBs[key])).appendTo('#DBs4Shape')
//$('<option/>').val("trait_" + traitList[key]).text(jsUcFirst(traitList[key])).appendTo('#traitID4Size')
};
//CellType_Markers 4 color
for (var key = 0; key < uniNodeMarkers.length; key++) {
//var val = sample[0]+"_"+pathwayList[key];
if (uniNodeMarkers[key] != "markers_Module_ID") $('<option/>').val(uniNodeMarkers[key]).text(
jsUcFirst(uniNodeMarkers[key])).appendTo('#markers4Color')
//$('<option/>').val("trait_" + traitList[key]).text(jsUcFirst(traitList[key])).appendTo('#traitID4Size')
};
//CellType_Markers 4 shape
for (var key = 0; key < uniNodeMarkers.length; key++) {
if (uniNodeMarkers[key] != "markers_Module_ID") $('<option/>').val(uniNodeMarkers[key]).text(
jsUcFirst(uniNodeMarkers[key])).appendTo('#markers4Shape')
};
for (var key = 0; key < uniNodeTrait.length; key++) {
//var val = sample[0]+"_"+pathwayList[key];
if (uniNodeTrait[key] != "trait_Module_ID") $('<option/>').val(uniNodeTrait[key]).text(
jsUcFirst(uniNodeTrait[key])).appendTo('#traitID4Color')
if (uniNodeTrait[key] != "trait_Module_ID") $('<option/>').val(uniNodeTrait[key]).text(
jsUcFirst(uniNodeTrait[key])).appendTo('#nodeDegreeID4Size')
//$('<option/>').val("trait_" + traitList[key]).text(jsUcFirst(traitList[key])).appendTo('#traitID4Size')
};
// relevence in radial analysis
// for(let key=0; key<uniNodeRelevence.length; key++){
// $('<option/>').val(uniNodeGLogFC[key]).text(jsUcFirst(uniNodeGLogFC[key])).appendTo('#nodeDegreeID4Size')
// }
//console.log("uniNode: ", uniNode)
}
// statusCode: {
// 404: function () {
// alert('There was a problem with the server. Try again soon!');
// }
// }
// });
//End of ajax call.
</script>
<body>
<div id="loader" class="spinner-box">
<div class="circle-border">
<div class="circle-core"></div>
</div>
</div>
<!-- table for selected nodes -->
<div style="display: none;" id="node-modal-background-alert">
<div id="alertModal">
<div class="modal-header">
<span class="alert header-text">
Big Network Alert!
</span>
<button class="modal-close-btn" onclick="closeAlert()">x</button>
</div>
<div class="modal-body">
<ul>
<li>
Network is bigger in size. Number of nodes or interactions are high.
</li>
<li>
Network will respond / render slow.
</li>
</ul>
</div>
</div>
</div>
<!-- table for selected nodes -->
<div style="display: none;" id="node-modal-background">
<div id="nodeModal">
<div class="modal-header">
<span class="header-text">
Node Details
</span>
<button class="modal-close-btn" onclick="closeModal()">x</button>
</div>
<div class="modal-body">
<table class="fixed_header">
<thead>
<tr>
<th style="width: 50px;">No.</th>
<th>Gene</th>
<th>Ensemble</th>
<th>Description</th>
</tr>
</thead>
<tbody id="table_data-ip">
<tr>
<td>row 1-0</td>
<td>row 1-1</td>
<td>row 1-2</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- table for selected hub genes -->
<div style="display:none" id="node-modal-background-2">
<div id="nodeModal-2">
<div class="modal-header">
<span class="header-text">
Node Details(hub genes)
</span>
<button class="modal-close-btn" onclick="closeModalHUB()">x</button>
</div>
<div class="modal-body">
<table class="fixed_header">
<thead>
<tr>
<th style="width: 50px;">No.</th>
<th>Gene</th>
<th>Ensemble</th>
<th>Description</th>
</tr>
</thead>
<tbody id="table_data-ip-2">
<tr>
<td style="width: 50px;">2000.</td>
<td>row 1-1</td>
<td>row 1-2</td>
<td style="width: 360px;">row 1-2</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Following DIV will display FORCE DIRECTED GRAPH-->
<div class="network" style="float:left; width:100%; position:relative; outline: 0;">
<div id="openDraw"
style="font-size:20px;cursor:pointer;display:inline-block; background: rgb(255, 255, 255, 0.3); position:absolute; top: 0px;"
onclick="openNav()">☰ open</div> <!-- Open Menu Button-->
</div>
<!-- Following DIV will create a LEFT MENU for network filters/modifications features-->
<div id="mySidenav" class="sidenav">
<!-- Close Menu Button-->
<div class="heading" style="word-wrap: normal;">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()" style="padding: 0px;">×</a>
</div>
<div class="legends" style="background: rgb(255, 255, 255, 0.6);">
<button class="accordion active">Node Color</button>
<!-- To change the color of nodes based on different parameters-->
<div class="panel" style="max-height:600px;">
<p>
<input type="radio" name="nodeColor" id="none" value="0" checked> None <br>
<input type="radio" name="nodeColor" id="Direction" value="1"> Direction <br>
<input type="radio" name="nodeColor" id="logFC" value="2"> logFC <br>
<input type="radio" name="nodeColor" id="Pathways" value="3"> Pathways <br>
<!-- <input type="radio" name="nodeColor" id="Proteomic1" value="5"> OTHER PROTEOMIC <br> -->
<input type="radio" name="nodeColor" id="Traits" value="4"> Traits<br>
<input type="radio" name="nodeColor" id="gwas" value="5"> GWAS <br>
<input type="radio" name="nodeColor" id="DBs" value="6"> Databases <br>
<input type="radio" name="nodeColor" id="markers" value="7"> Celltype Markers <br>
<input type="radio" name="nodeColor" id="custom_color" value="8"> Custom <br>
<!-- Dropdown for pathways name to highlight nodes-->
<div id="pathwayInput" style="padding-bottom:5px;display:none;">
Select Pathway:
<select id="pathwayID4Color" name="pathwayID4Color" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
<!-- Dropdown for GWAS DATA TO highlight nodes-->
<div id="GWASInput" style="padding-bottom:5px;display:none;">
Select GWAS data:
<select id="GWAS4Color" name="GWAS4Color" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
<!-- logFC Dropdown to highlight node with color spectrum-->
<div id="logFCInput" style="padding-bottom:5px;display:none;">
Select logFC:
<select id="logFCID4Color" name="logFCID4Color" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
<!-- Direction Dropdown to highlight nodes-->
<div id="directionInput" style="padding-bottom:5px;display:none;">
Select Direction:
<select id="directionID4Color" name="directionID4Color" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
<!-- Trait dropdown to highlight nodes -->
<div id="traitInput" style="padding-bottom:5px;display:none;">
Select Trait:
<select id="traitID4Color" name="traitID4Color" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
<!-- Database and assocition dropdown to highlight nodes -->
<div id="DBsInput" style="padding-bottom:5px;display:none;">
Select significance from databases:
<select id="DBs4Color" name="DBsID4Color" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
<!-- celltype markers dropdown to highlight nodes -->
<div id="celltypemarkerInput" style="padding-bottom:5px;display:none;">
Select celltype markers:
<select id="markers4Color" name="markers4Color" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
<!-- custom color options dropdown to highlight nodes -->
<div id="custom_color_input" style="padding-bottom:5px;display:none;">
Select Custom Options:
<select id="custom4Color" name="custom4Color" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
</p>
</div>
<!-- Node size change button -->
<button class="accordion active">Node Size</button>
<div class="panel" style="max-height: 300px;">
<p>
<input type="radio" name="nodeSize" id="none" value="0" checked> None <br>
<input type="radio" name="nodeSize" id="GlogFC" value="1"> LogFC <br>
<!-- <input type="radio" name="nodeSize" id="PlogFC" value="2"> Proteomic logFC <br> -->
<input type="radio" name="nodeSize" id="Traits4Size" value="2"> Traits <br>
<input type="radio" name="nodeSize" id="GWAS4Size" value="3"> GWAS <br>
<input type="radio" name="nodeSize" id="direction4Size" value="4"> Direction <br>
<!-- Genomic logFC Dropdown to change the node size-->
<div id="GlogFCInput4Size" style="padding-bottom:5px;display:none;">
Select logFC:
<select id="GlogFCID4Size" name="GlogFCID4Size" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
<!-- Trait P-values Dropdown to change the node size-->
<div id="traitInput4Size" style="padding-bottom:5px;display:none;">
Select Trait:
<select id="traitID4Size" name="traitID4Size" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
<!-- GWAS Dropdown to change the node size-->
<div id="gwasInput4Size" style="padding-bottom:5px;display:none;">
Select GWAS:
<select id="gwasID4Size" name="gwasID4Size" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
<!-- Direction Dropdown to change the node size-->
<div id="directionInput4Size" style="padding-bottom:5px;display:none;">
Select Direction:
<select id="directionID4Size" name="directionID4Size" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
</p>
</div>
<!-- Node Shape -->
<!-- <div class="legends" style="background: rgb(255, 255, 255, 0.6);">
<button class="accordion active">Node Shape</button>
<div class="panel" style="max-height: 300px;">
<p>
<input type="radio" name="nodeShape" id="none" value="0" checked> None <br>
<input type="radio" name="nodeShape" id="PathwaysShape" value="2"> Pathways <br>
<input type="radio" name="nodeShape" id="gwasShape" value="4"> GWAS <br>
<input type="radio" name="nodeShape" id="DBsShape" value="5"> Databases <br>
<input type="radio" name="nodeShape" id="markersShape" value="6"> Celltype Markers <br>
<div id="pathwayShapeInput" style="padding-bottom:5px;display:none;">
Select Pathway:
<select id="pathwayID4Shape" name="pathwayID4Shape" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
<div id="GWASShapeInput" style="padding-bottom:5px;display:none;">
Select GWAS data:
<select id="GWAS4Shape" name="GWAS4Shape" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
<div id="directionShapeInput" style="padding-bottom:5px;display:none;">
Select Direction:
<select id="directionID4Shape" name="directionID4Shape" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
<div id="traitShapeInput" style="padding-bottom:5px;display:none;">
Select Trait:
<select id="traitID4Shape" name="traitID4Shape" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
<div id="DBsShapeInput" style="padding-bottom:5px;display:none;">
Select significance from databases:
<select id="DBs4Shape" name="DBsID4Shape" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
<div id="celltypemarkerShapeInput" style="padding-bottom:5px;display:none;">
Select celltype markers:
<select id="markers4Shape" name="markers4Shape" style="max-width:90%;">
<option value="none" selected="selected">None</option>
</select>
</div>
</p>
</div> -->
<!-- Radial Analysis -->
<button class="accordion active">Radial Analysis</button>
<div class="panel" style="max-height: 250px;">
<p>
<input type="radio" name="radialAnylisis" id="none" value="0" checked> None <br>
<input type="radio" name="radialAnylisis" id="EdgeWeightCutOff" value="1"> Edge weight cut-off
<br>
<input type="radio" name="radialAnylisis" id="NodeDegree" value="2"> Node cutoff <br>
<input type="radio" name="radialAnylisis" id="HubGenes" value="3"> Hub genes <br>
<input type="radio" name="radialAnylisis" id="stringDBchanal" value="4"> Interaction Type <br>
<!-- Threshold for weight -->
<div class="slidecontainer" id="EdgeWeightCutOffRange" style="padding-bottom:5px;display:none;">
<input type="range" min="0" max="1" step=".1" value="0" class="slider" id="myRange">
<br>
<p>Edge Weight: <span id="thresh"></span></p>
</div>
<!-- node weight dropdown options -->
<div id="db4weight" class="slidecontainer" style="padding-bottom:5px;display:none;">
Select Interaction Type:
<select onchange="changedWeight()" id="stringDBchanal4weight" name="stringDBchanal4weight" style="width:100%;">
<option value="combined_score" selected="selected">Combined score</option>
<option value="textmining">Textmining</option>
<option value="experiments">Experiments</option>
<option value="database">Databases</option>
<option value="coexpression">Co-expression</option>
<option value="neighborhood">Neighborhood</option>
<option value="fusion">Gene Fusion</option>
<option value="cooccurrence">Co-occurrence</option>
</select>
</div>
<!-- node degree dropdown options -->
<div id="nodeDegreeInput4Size" class="slidecontainer" style="padding-bottom:5px;display:none;">
Select Node cutoff:
<select id="nodeDegreeID4Size" name="nodeDegreeID4Size" style="max-width:90%;">
<option value="none" selected="selected">None</option>
<option value="node_degree">Gene Degree</option>
</select>
</div>
<!-- Threshold for Degree -->
<div class="slidecontainer" id="NodeDegreeRange" style="padding-bottom:5px;display:none;">
<input type="range" min="0" max="20" step="1" value="0" class="slider" id="myDegree">
<p>node Degree: <span id="thresh1"></span></p>
</div>
<!-- Gene connections -->
<div class="slidecontainer" id="HubGenesRange" style="padding-bottom:5px;display:none;">
<input type="range" min="0" max="50" step="1" value="0" class="slider" id="myConnection">
<br>
<p>Hub Node Size: <span id="thresh2"></span></p>
</div>
<div id="hub_genes_button_div"></div>
</p>
</div>
<!-- Find node panel-->
<button class="accordion">Custom search</button>
<div class="panel">
<div id="geneinput">
<form name="geneinput">
<br>
<p>Find Node<span id="thresh1"></span></p>
<textarea rows="2" style="width:90%" id="gene_list" name="gene_list" form="form3"
placeholder="Enter Genes list (comma seperated)"></textarea>
<!-- <input id="genesymbol" type="text" value="" name="genesymbol" placeholder="Gene symbol"/> -->
<input type="submit" id="submit" value="Submit" />
<button type="reset" value="Reset" onclick="resetText()">Reset </button>
<a id="currentgenesymbol"></a>
</form>
</div>
</div>
<!-- Node colors legend-->
<button class="accordion">Legends</button>
<div class="panel" id="legendPanel">
<p></p>
</div>
<button id="button_snap" style="outline: 0;" type="button" class="btn btn-default">Take a
Screenshot!
</button>
<script>
// Weight Change
function changedWeight() {
graph = ""
$("#loader").css('display', 'block')
let w = $('#stringDBchanal4weight').val()
let d = JSON.parse(getItemFromStorage('pd_net_stringDB'));
console.log(d)
d.analysedWeight = w;
// localStorage.setItem('pd_net_stringDB', JSON.stringify(d));
setItemToStorage('pd_net_stringDB', JSON.stringify(d));
$.ajax({
url: `${URLs()}/get/network/fromNodes`,
type: "POST",
dataType:'json',
data: d,
success: function (result) {
$("#loader").css('display', 'none')
startD3(result);
// force.start();
},
error: function(err) {
$("#loader").css('display', 'none')
alert(err.responseJSON.message ? err.responseJSON.message : "There is an issue. Please try after some time");
// window.location.href = '/pdnet';
}
});
}
var width = 1280,
height = 720;
// function takesnapshot() {
d3.select('#button_snap').on('click', function () {
jQuery('#button_snap').html('loading ...');
$('#button_snap').css('background', 'transparent');
$('#button_snap').css('pointer-events', 'none');
$('#button_snap').css('border', 'none');
var svgString = getSVGString(svg.node());
svgString2Image(svgString, 10 * width, 10 * height, 'png',
save); // passes Blob and filesize String to the callback
function save(dataBlob, filesize) {
console.log('BLOB', dataBlob, jsonFile)
jQuery('#button_snap').html('Take a Screenshot!');
jQuery('#button_snap').css('background', 'white');
$('#button_snap').css('pointer-events', 'all');
// $('#button_snap').append("Take a Screenshot!")
saveAs(dataBlob, `${'savethis'}.png`); // FileSaver.js function
}
});
function getSVGString(svgNode) {
svgNode.setAttribute('xlink', 'http://www.w3.org/1999/xlink');
var cssStyleText = getCSSStyles(svgNode);
appendCSS(cssStyleText, svgNode);
var serializer = new XMLSerializer();
var svgString = serializer.serializeToString(svgNode);
svgString = svgString.replace(/(\w+)?:?xlink=/g, 'xmlns:xlink='); // Fix root xlink without namespace
svgString = svgString.replace(/NS\d+:href/g, 'xlink:href'); // Safari NS namespace fix
return svgString;
function getCSSStyles(parentElement) {
var selectorTextArr = [];
// Add Parent element Id and Classes to the list
selectorTextArr.push('#' + parentElement.id);
for (var c = 0; c < parentElement.classList.length; c++)
if (!contains('.' + parentElement.classList[c], selectorTextArr))
selectorTextArr.push('.' + parentElement.classList[c]);
// Add Children element Ids and Classes to the list
var nodes = parentElement.getElementsByTagName("*");
for (var i = 0; i < nodes.length; i++) {
var id = nodes[i].id;
if (!contains('#' + id, selectorTextArr))
selectorTextArr.push('#' + id);
var classes = nodes[i].classList;
for (var c = 0; c < classes.length; c++)
if (!contains('.' + classes[c], selectorTextArr))
selectorTextArr.push('.' + classes[c]);
}
// Extract CSS Rules
var extractedCSSText = "";
for (var i = 0; i < document.styleSheets.length; i++) {
var s = document.styleSheets[i];
try {
if (!s.cssRules) continue;
} catch (e) {
if (e.name !== 'SecurityError') throw e; // for Firefox
continue;
}
var cssRules = s.cssRules;
for (var r = 0; r < cssRules.length; r++) {
if (contains(cssRules[r].selectorText, selectorTextArr))
extractedCSSText += cssRules[r].cssText;
}
}
return extractedCSSText;
function contains(str, arr) {
return arr.indexOf(str) === -1 ? false : true;
}
}
function appendCSS(cssText, element) {
var styleElement = document.createElement("style");
styleElement.setAttribute("type", "text/css");
styleElement.innerHTML = cssText;
var refNode = element.hasChildNodes() ? element.children[0] : null;
element.insertBefore(styleElement, refNode);
}
}
function svgString2Image(svgString, width, height, format, callback) {
var format = format ? format : 'png';
var imgsrc = 'data:image/svg+xml;base64,' + btoa(unescape(encodeURIComponent(
svgString))); // Convert SVG string to data URL
var canvas = document.createElement("canvas");
var context = canvas.getContext("2d");
canvas.width = width;
canvas.height = height;
var image = new Image();
image.onload = function () {
context.clearRect(0, 0, width, height);
context.drawImage(image, 0, 0, width, height);
canvas.toBlob(function (blob) {
var filesize = Math.round(blob.length / 1024) + ' KB';
if (callback) callback(blob, filesize);
});
};
console.log(imgsrc);
image.src = imgsrc;
}
// }
</script>
<!-- <button class="reset-all-btn">Reset All</button> -->
<!-- network setting page -->
<!-- Select node panel-->
<!-- <button class="accordion">Selected Node</button>
<div class="panel" id="sgeneinput">
<p>
<div id="sgeneinput1">
<textarea rows="2" style="width:90%" id="sgene_list" name="sgene_list" placeholder="Nothing selected"></textarea>
</div></p>
</div>
<div class="resetBtn">
<button type="reset" value="Reset" onclick="resetText()" style="margin:auto;display:block; box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);" >Reset the network </button>
</div> -->
<!--button type="reset" value="Reset" onclick="resetText()" >Reset </button-->
<!-- <div class="resetBtn">
<button type="reset" value="Reset" onclick="resetText()"
style="margin:auto;display:block; box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2), 0 6px 20px 0 rgba(0,0,0,0.19);">Reset
the network </button>
</div> -->
</div>
</div>
<div class="setting_wrapper" id="mysetting" style="display: none">
<div class="setting_close">
close
<a href="javascript:void(0)" class="closebtn" onclick="closeSetting()" style="padding: 0px;">×</a>
</div>
<!-- // gravity .1
// distance infinity
// chargeDistance infinity
// linkStrength 1
// theta .8 -->
<button class="accordion active">Network layout</button>
<div class="panel" style="max-height: 202px;">
<p>
<input type="radio" name="force_setting" id="none" value="0" checked> None <br>
<input type="radio" name="force_setting" id="link_distance" value="1"> Link Distance<br>
<input type="radio" name="force_setting" id="charge" value="2"> Link Charge <br>
<input type="radio" name="force_setting" id="link_Strength" value="3"> Distance<br>
<!-- <input type="radio" name="force_setting" id="gravity" value="3"> Link Distance<br>
<input type="radio" name="force_setting" id="theta" value="1"> Link Distance<br> -->
<!-- Threshold for weight -->
<div class="forcecontainer" id="linkdistanceRange" style="padding-bottom:5px;display:none;">
<input type="range" min="1" max="100" step="1" value="0" class="slider" id="linkdistance">
<br>
<p>link distance: <span id="linkdistanceinput"></span></p>
</div>
<!-- Threshold for Degree -->
<div class="forcecontainer" id="linkchargeRange" style="padding-bottom:5px;display:none;">
<input type="range" min="-300" max="50" step="1" value="-200" class="slider" id="linkcharge">
<br>
<p>node charge: <span id="linkchargeinput"></span></p>
</div>
<div class="forcecontainer" id="linkStrengthRange" style="padding-bottom:5px;display:none;">
<input type="range" min="1" max="1000" step="10" value="1" class="slider" id="linkStrength">
<br>
<p>distance: <span id="linkStrengthinput"></span></p>
</div>
<!-- <button type="reset" value="Reset" class="networklayoutreset" onclick="resetLayout()">Reset
</button> -->
<!-- Gene connections -->
</p>
</div>
<button class="accordion active">Network parameters</button>
<div class="panel" style="max-height:400px;">
<p>
<input type="radio" name="network_parameters" id="none" value="0" checked> None <br>
<input type="radio" name="network_parameters" id="nodecolor" value="1"> Node Color Change<br>
<input type="radio" name="network_parameters" id="linkcolor" value="2"> Link Color Opacity<br>
<input type="radio" name="network_parameters" id="linkcolor" value="3"> Node Size<br>
<input type="radio" name="network_parameters" id="linkcolor" value="4"> Text Size<br>
<input type="radio" name="network_parameters" id="linkcolor" value="5"> Network Zoom<br>
<!-- <input type="radio" name="force_setting" id="gravity" value="3"> Link Distance<br>
<input type="radio" name="force_setting" id="theta" value="1"> Link Distance<br> -->
<!-- Threshold for weight -->
<div class="networkcontainer" id="color_range" style="padding-bottom:5px;display:none;">
<div class="colorParam" id="color_ouput" style="background: rgb(23,190,207)"></div>
<p>color R: <span id="rRange">23</span></p>
<input type="range" min="0" max="255" step="1" value="23" class="slider" id="redRange"
onchange="colorFinc()">
<br>
<p>color G: <span id="gRange">190</span></p>
<input type="range" min="0" max="255" step="1" value="190" class="slider" id="greenRange"
onchange="colorFinc()">
<br>
<p>color B: <span id="bRange">207</span></p>
<input type="range" min="0" max="255" step="1" value="207" class="slider" id="blueRange"
onchange="colorFinc()">
</div>
<div class="networkcontainer" id="opacity_range" style="padding-bottom:5px;display:none;">
<p>opacity: <span id="oRange">1</span></p>
<input type="range" min="0" max="1" step=".1" value="1" class="slider" id="opacityRange"
onchange="opacityFunc()">
</div>
<div class="networkcontainer" id="node_size" style="padding-bottom:5px;display:none;">
<p>node size: <span id="nRange">8</span></p>
<input type="range" min="8" max="15" step="1" value="8" class="slider" id="nodeRange"
onchange="nodeSizeFunc()">
</div>
<div class="networkcontainer" id="text_size" style="padding-bottom:5px;display:none;">
<p>text size: <span id="tRange">8</span></p>
<input type="range" min="2" max="15" step="1" value="8" class="slider" id="textRange"
onchange="textSizeFunc()">
<!--CHANGE IS NEEDED-->
</div>
<div class="networkcontainer" id="zoom_network" style="padding-bottom:5px;display:none;">
<button class="zoom_btn" id="zoom_in">+</button>
<button class="zoom_btn" id="zoom_out">-</button>
</div>
<!-- Threshold for Degree -->
<!-- <div class="forcecontainer" id="linkchargeRange" style="padding-bottom:5px;display:none;">
<input type="range" min="-300" max="50" step="1" value="-200" class="slider" id="linkcharge">
<br>
<p>node charge: <span id="linkchargeinput"></span></p>
</div>
<div class="forcecontainer" id="linkStrengthRange" style="padding-bottom:5px;display:none;">
<input type="range" min="1" max="1000" step="10" value="1" class="slider" id="linkStrength">
<br>
<p>distance: <span id="linkStrengthinput"></span></p>
</div> -->
<!-- <button type="reset" value="Reset" class="networklayoutreset" onclick="reset_param()">Reset
</button> -->
<!-- Gene connections -->
</p>
</div>
<button class="accordion active">Annotations</button>
<div class="panel" style="max-height:200px;">
<div id="gene_info"></div>
</div>
<div style="margin: 10px">
<b>NETWORK INFO:</b>
<div id="network_details">
</div>
</div>
<button class="accordion active">Add Paper</button>
<div class="panel" style="max-height:400px;">
<div style="margin: 10px">
<b>Add a file:</b>
<div id="">
<input type="file" id="universal_ext">
<button onclick="universal_ext_update()" style="color: black; margin-top: 5px;">submit</button>
<button onclick="resetUniversals()" style="color: black; margin-top: 5px;">Reset Universal</button>
<div id="uploading_custom_universal" style="display: none ;margin: 10px 0">Processing...</div>
<div id="uploaded_custom_universal" style="display: none ;margin: 10px 0">Done</div>
</div>
</div>
</div>
<!-- Node colors legend 2-->
<!-- <button class="accordion">Legends</button>
<div class="panel" id="legendPanel">
<p></p>
</div> -->
</div>
</div>
<div class="networksetting">
<h4 onclick="settingFunc()">Setting ⚙ </h4>
</div>
<script>
// clear universal data
function clearUniData() {
// GWAS4Color
document.getElementById('pathwayID4Color').innerHTML = `<option value="none" selected="selected">None</option>`;
document.getElementById('GWAS4Color').innerHTML = `<option value="none" selected="selected">None</option>`;
document.getElementById('logFCID4Color').innerHTML = `<option value="none" selected="selected">None</option>`;
document.getElementById('directionID4Color').innerHTML = `<option value="none" selected="selected">None</option>`;
document.getElementById('traitID4Color').innerHTML = `<option value="none" selected="selected">None</option>`;
document.getElementById('DBs4Color').innerHTML = `<option value="none" selected="selected">None</option>`;
document.getElementById('markers4Color').innerHTML = `<option value="none" selected="selected">None</option>`;
document.getElementById('custom4Color').innerHTML = `<option value="none" selected="selected">None</option>`;
document.getElementById('GlogFCID4Size').innerHTML = `<option value="none" selected="selected">None</option>`;
document.getElementById('traitID4Size').innerHTML = `<option value="none" selected="selected">None</option>`;
document.getElementById('gwasID4Size').innerHTML = `<option value="none" selected="selected">None</option>`;
document.getElementById('directionID4Size').innerHTML = `<option value="none" selected="selected">None</option>`;
}
// Reset universal
function resetUniversals() {
resetText()
clearUniData()
getUniversal(currentUniversal);
}
// new value to universal file
function universal_ext_update() {
$('#uploading_custom_universal').css('display', 'block');
let f = document.getElementById('universal_ext').files[0]
let fromdata = new FormData();
fromdata.append('universal', JSON.stringify(currentUniversal));
fromdata.append('avatar', f);
// console.log(d);
$.ajax({
url: `${URLs()}/get/updateUniversal`,
method: 'POST',
data: fromdata,
processData: false,
contentType: false,
success: (result) => {