-
Notifications
You must be signed in to change notification settings - Fork 0
/
MSTree_object_holder.html
1618 lines (1495 loc) · 59.7 KB
/
MSTree_object_holder.html
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>
<html>
<head>
<title>GrapeTree</title>
<link rel="stylesheet" href='static/js/jquery-ui-1.11.4/jquery-ui.min.css'>
<link rel="stylesheet" href="static/css/bootstrap.min.css">
<link rel="stylesheet" href="static/css/grapetree.css">
<!-- LeafletJS CSS -->
<link rel="stylesheet" href="static/css/leaflet.css"/>
<!-- CUSTOM
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<link rel="stylesheet" href="cohesive-theme/css/mstree-object.css">
</head>
<body>
<!--metadata div-->
<link rel="stylesheet" href="static/js/SlickGrid/slick.grid.css" type="text/css" />
<link rel="stylesheet" href="static/js/SlickGrid/examples/examples.css" type="text/css" />
<script src="static/js/SlickGrid/lib/firebugx.js"></script>
<script src="static/js/SlickGrid/lib/jquery-1.11.2.min.js"></script>
<script src="static/js/SlickGrid/lib/jquery-ui-1.11.3.min.js"></script>
<script src="static/js/SlickGrid/lib/jquery.event.drag-2.3.0.js"></script>
<script src="static/js/SlickGrid/slick.core.js"></script>
<script src="static/js/SlickGrid/plugins/slick.cellrangedecorator.js"></script>
<script src="static/js/SlickGrid/plugins/slick.cellrangeselector.js"></script>
<script src="static/js/SlickGrid/plugins/slick.cellselectionmodel.js"></script>
<script src="static/js/SlickGrid/slick.formatters.js"></script>
<script src="static/js/SlickGrid/slick.editors.js"></script>
<script src="static/js/SlickGrid/slick.grid.js"></script>
<script src="static/js/SlickGrid/slick.dataview.js"></script>
<script src="static/js/tree/context.js?version=1"></script>
<script src="static/js/tree/grid.js?version=1"></script>
<script src="static/js/tree/help.js?version=1"></script>
<script src="static/js/spectrum/spectrum.min.js"></script>
<link rel="stylesheet" href="static/js/spectrum/spectrum.css" type="text/css"/>
<!--information divs-->
<div id='welcome-div' style='background:white;padding:10px'>
<!-- CUSTOM
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div id='welcome-div-close' class="close" onclick="$('#welcome-div').hide()">
<img src="cohesive-theme/img/iconic/close-circle.svg" alt="Close modal">
</div>
<!--span id='welcome-div-close' class="glyphicon glyphicon-remove" onclick="$('#welcome-div').hide()"></span-->
<!--
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div id='welcome-div-text'>
</div>
</div>
<div id='information-div' class="modal fade" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content modal-sm">
<div id="modal-header" class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<p align='center'><img id='waiting-image' style='display:none' src='static/js/img/ms_failed_1.png'></img></p>
<span id='modal-title'></span>
</div>
<div class="modal-body">
<p id='waiting-information'></p>
<div id='param-panel' style='display:none'>
<label>Method</label>
<select id='method-select'>
<option class='show-tooltip' title='MSTreeV2 uses a directed graph to handle missing data' value='MSTreeV2'>MSTreeV2</option>
<option class='show-tooltip' title='A traditional Minimum spanning tree + eBurst weighting' value='MSTree'>MSTree</option>
<option class='show-tooltip' title='A standard Neighbor-Joining algorithm implemented in FastME V2.0' value='NJ'>Standard Neighbour Joining</option>
<option class='show-tooltip' title='Rapid Neighbour Joining for very large datasets' value='RapidNJ'>RapidNJ</option>
</select>
<label><input id='check-memory' type="checkbox" checked /> Check memory usage</label>
</div>
</div>
<div class="modal-footer">
<button id="modal-ok-button" type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
<script charset="utf-8">
$("#modal-ok-button").click(function(e){
var profile_file = $(this).data("profile_file")
if (profile_file){
processProfileFile(profile_file);
$(this).data("profile_file",null);
$("#modal-ok-button").html("Close");
$("#param-panel").hide();
e.stopImmediatePropagation();
$("#modal-title").hide();
showWaitingDialog("Processing Profiles");
}
});
$("#method-select").change(function(e) {
if ($(this).val() == "MSTree") $("#MST-option").show();
else $("#MST-option").hide();
});
$("#matrix-select").change(function(e) {
if ($(this).val() == "symmetric") $("#symmetric-option").show();
else $("#symmetric-option").hide();
});
</script>
</div><!-- /.modal -->
<div id='sidebar'>
<div id='input-output-panel' class='panel panel-default'>
<div class='panel-heading mst-menu-title' id='file-menu'>
<b id='input-output-title'>Inputs/Outputs</b>
<span id='file-menu-icon' class='glyphicon glyphicon-menu-down'> </span>
</div>
<div class="panel-body" id='file-menu-panel'>
<div id='load-panel'>
<button title='Handles trees, profiles and metadata files' id='button-files' class=''>Load GrapeTree</button>
<!--span class="glyphicon glyphicon-question-sign" style="float:right;margin-right:5px" onclick="getHelpBox('load_files');"></span-->
<hr>
</div>
<div id='save-panel'>
<!-- CUSTOM
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="help help-tooltip" onclick="getHelpBox('save_grapetree');">
<img src="cohesive-theme/img/iconic/help-circle.svg" alt="Suggerimento">
</div>
<!--
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<button id="save-tree-json">Save GrapeTree</button>
<!-- span class="glyphicon glyphicon-question-sign" style="float:right;margin-right:5px" onclick="getHelpBox('save_grapetree');"></span-->
<!--br-->
<!--button id="save-tree-nwk">Save as Newick Tree</button-->
<!--br-->
<button id="mst-download-svg">Download SVG</button>
<!--br-->
</div>
</div>
</div>
<div class='panel panel-default'>
<div class='panel-heading mst-menu-title' id='tree-menu'>
<b id>Tree Layout</b>
<span id='tree-menu-icon' class='glyphicon glyphicon-menu-right'> </span>
</div>
<!--div class="panel-body" id='tree-menu-panel' style='padding:0px;'-->
<!--br-->
<div class="panel-body" id='tree-menu-panel'>
<!-- CUSTOM
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="help help-tooltip" onclick="getHelpBox('tree_layout');">
<img src="cohesive-theme/img/iconic/help-circle.svg" alt="Suggerimento">
</div>
<!--
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="panel-body-section">
<button id='button-goback'> Original tree</button>
<!--button id='button-goback' style='margin-left:15px;' onclick='loadMSTree(tree_raw);if(current_metadata_file) {loadMetadataText(current_metadata_file[0], current_metadata_file[1]);}'> Original tree</button-->
<!--span class="glyphicon glyphicon-question-sign" style="float:right;margin-right:15px" onclick="getHelpBox('tree_layout');"></span-->
<!--br-->
<button id='button-refresh'>Static Redraw</button>
<!--button id='button-refresh' style='margin-left:15px;'> Static Redraw </button-->
<!--br-->
<button id="center-graph-button">Centre Tree</button>
<!--button id="center-graph-button" style='margin-left:15px;'>Centre Tree</button-->
<!--br-->
<label>
<input id='show-node-tooltip' type="checkbox" checked />
Show Tooltips
</label>
</div><!-- ./panel-body-section -->
<div class="panel-body-section" id="draggable-area">
<!--p align='center'-->
<label>Drag Icon to Rotate:</label>
<!--span id="rotation-icon" class="glyphicon glyphicon-refresh"></span-->
<div class="drag-trigger" id="rotation-icon"></div>
<!--br-->
<!-- exported in tools -->
<!--label>Zoom: </label>
<span onclick="javascript:the_tree.setScale(1.1,true)" class=' zoom-icon glyphicon glyphicon-zoom-in'></span>
<span onclick="javascript:the_tree.setScale(0.9,true)" class='zoom-icon glyphicon glyphicon-zoom-out'></span -->
<!--/p -->
</div><!-- ./panel-body-section -->
</div>
</div>
<!-- CUSTOM - SUBPANEL EXTRACTION
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<!--div class='panel panel-default sub-panel'-->
<div class='panel panel-default'>
<div class='panel-heading mst-menu-title' id='mst-node-menu'>
<b id>Node Style</b>
<span id='mst-node-menu-icon' class="glyphicon glyphicon-menu-right"></span>
</div>
<!-- CUSTOM - SEVERAL CHANGES FROM ORIGINAL PANEL
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="panel-body" id='mst-node-menu-panel'>
<div class="panel-body-section">
<!-- custom addition -->
<label>Colour By:</label>
<!--br-->
<select id='metadata-select'>
<!--select style="width:160px" id='metadata-select'-->
<!--option value='nothing'>No category</option-->
</select>
</div><!-- ./panel-body-section -->
<!--hr-->
<div class="panel-body-section">
<!-- custom addition -->
<!-- CUSTOM
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="help help-tooltip" onclick="getHelpBox('show_labels');">
<img src="cohesive-theme/img/iconic/help-circle.svg" alt="Suggerimento">
</div>
<!--
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<label>
<input id='show-node-labels' type="checkbox" checked /> Show Labels
</label>
<!--span class="glyphicon glyphicon-question-sign" style="float:right;margin-right:5px" onclick="getHelpBox('show_labels');"></span-->
<select id='node-label-text'></select>
<!--select style='width:160px' id='node-label-text'></select-->
<!--br-->
<div class="spinner-box">
<!-- added -->
<label>Font Size:</label>
<!--br-->
<div id="slider-node-fontsize" class="slider-class"></div>
<div class="spin-container">
<!-- added -->
<input type='text' id='spinner-node-fontsize' class='spin-group'>
<!--input type='text' style='width:20px;height:15px' id='spinner-node-fontsize' class='spin-group'-->
</div>
</div>
<!--br-->
</div><!-- ./panel-body-section -->
<!--hr-->
<div class="panel-body-section">
<!-- custom addition -->
<!--span class="glyphicon glyphicon-question-sign" style="float:right;margin-right:5px" onclick="getHelpBox('node_size');"></span-->
<!-- CUSTOM
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="help help-tooltip" onclick="getHelpBox('node_size');">
<img src="cohesive-theme/img/iconic/help-circle.svg" alt="Suggerimento">
</div>
<!--
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="spinner-box spinner-box-no-margin">
<!-- added class -->
<!--span onclick="$('#spinner-nodesize').spinner('value', 100)" class='glyphicon glyphicon-fast-backward'></span-->
<!-- removed element, not needed -->
<!-- label> Node Size (%)</label -->
<!-- cleaned -->
<label>Node Size (%)</label>
<!--br-->
<div id="slider-nodesize" class="slider-class"></div>
<div class="spin-container">
<!-- added -->
<input type='text' id='spinner-nodesize' class='spin-group'>
</div>
</div>
<div class="spinner-box show-tooltip" title="Node size relative to number of strains">
<!-- added spinner-box class -->
<!--span onclick="$('#spinner-relative-nodesize').spinner('value', 100)" class='glyphicon glyphicon-fast-backward'></span-->
<!-- removed -->
<label>Kurtosis (%)</label>
<!--label> Kurtosis (%)</label-->
<!-- cleaned -->
<!--br-->
<div id="slider-relative-nodesize" class="slider-class"></div>
<div class="spin-container">
<!-- added -->
<input type='text' id='spinner-relative-nodesize' class='spin-group'>
</div>
</div>
</div><!-- ./panel-body-section -->
<!--hr-->
<div class="panel-body-section">
<!-- custom addition -->
<label>Highlight Label</label>
<!--br-->
<!--input size="11" id='search-metadata-input'-->
<!-- cleaned -->
<input id='search-metadata-input'>
<!--span id='search-metadata-icon' class='add-data-icon glyphicon glyphicon-search'></span-->
<button id='search-metadata-icon'>Cerca</button>
<!--br-->
<!-- label>
<input id ='show-individual-segments' type="checkbox" /> Show Pie Chart
</label -->
<!--br-->
</div><!-- ./panel-body-section -->
<div class="panel-body-section">
<!-- custom addition -->
<label>
<input id='show-individual-segments' type="checkbox" /> Show Pie Chart
</label>
</div><!-- ./panel-body-section -->
</div>
</div>
<!-- CUSTOM - SUBPANEL EXTRACTION
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<!--div class='panel panel-default sub-panel'-->
<div class='panel panel-default'>
<div class='panel-heading mst-menu-title' id='mst-link-menu'>
<b id>Branch Style</b>
<span id='mst-link-menu-icon' class='glyphicon glyphicon-menu-right'> </span>
</div>
<!-- CUSTOM - SEVERAL CHANGES FROM ORIGINAL PANEL
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="panel-body" id='mst-link-menu-panel'>
<div class="panel-body-section">
<!-- custom addition -->
<!-- CUSTOM
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="help help-tooltip" onclick="getHelpBox('branch_labels');">
<img src="cohesive-theme/img/iconic/help-circle.svg" alt="Suggerimento">
</div>
<!--
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<label>
<input id='show-link-labels' type="checkbox" /> Show Labels
</label>
<!--span class="glyphicon glyphicon-question-sign" style="float:right;margin-right:5px" onclick="getHelpBox('branch_labels');"></span-->
<!--br-->
<div class="spinner-box">
<!-- added -->
<label>Font Size:</label>
<!--br-->
<div id="slider-linkfontsize" class="slider-class"></div>
<!--input type='text' style='width:20px;height:15px' id ='spinner-linkfontsize' class='spin-group'-->
<input type='text' id='spinner-linkfontsize' class='spin-group'>
</div>
<!--br-->
</div>
<div class="panel-body-section">
<!-- custom addition -->
<div class="spinner-box">
<!-- added -->
<!--span onclick="$('#spinner-linklength').spinner('value', 100)" class='glyphicon glyphicon-fast-backward'></span-->
<!-- removed - not needed -->
<!--label> Scaling (%)</label-->
<!-- cleaned -->
<label>Scaling (%)</label>
<!--br-->
<div id="slider-linklength" class="slider-class"></div>
<input type='text' id='spinner-linklength' class='spin-group'>
</div>
<div class="spinner-box show-tooltip" title="Collapse branches below a certain value">
<!-- added class spinner-box -->
<!--span onclick="$('#spinner-collapse-nodes').spinner('value', 0)" class='glyphicon glyphicon-fast-backward'></span-->
<!-- removed - not needed -->
<!--label> Collapse Branches</label-->
<!-- cleaned -->
<label>Collapse Branches</label>
<!--br-->
<div id="slider-collapse-nodes" class="slider-class"></div>
<input type='text' id='spinner-collapse-nodes' class='spin-group'>
</div>
<label>
<input id='link-log-scale' type="checkbox" /> Log Scale
</label>
</div>
<div class="panel-body-section">
<!-- custom addition -->
<!-- CUSTOM
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="help help-tooltip" onclick="getHelpBox('branch_cutoffs');">
<img src="cohesive-theme/img/iconic/help-circle.svg" alt="Suggerimento">
</div>
<!--
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<!--span class="glyphicon glyphicon-question-sign" style="float:right;margin-right:5px" onclick="getHelpBox('branch_cutoffs');"></span-->
<!--label>For branches <br> longer than:<input type='text' id ='spinner-link-length' class='spin-group'></label-->
<!-- cleaned -->
<div class="spinner-box">
<label>For branches longer than:</label>
<input type='text' id='spinner-link-length' class='spin-group'>
</div>
<div class="branches-options">
<!-- used in place of table -->
<label>
<input type="radio" id="handle-long-branch-display" name="handle-long-branch" value="display" checked="" style="opacity: 1;"> Display
</label>
<label>
<input type="radio" id="handle-long-branch-hide" name="handle-long-branch" value="hide" style="opacity: 1;"> Hide
</label>
<label>
<input type="radio" id="handle-long-branch-cap" name="handle-long-branch" value="cap" style="opacity: 1;"> Shorten
</label>
</div>
<!--table><tbody><tr>
<td>
<div style="opacity: 1;"><input type="radio" id="handle-long-branch-display" name="handle-long-branch" value="display" checked="" style="opacity: 1;">Display</div>
</td>
<td style="padding-left:10px">
<div style="opacity: 1;"><input type="radio" id="handle-long-branch-hide" name="handle-long-branch" value="hide" style="opacity: 1;">Hide</div>
</td>
<td style="padding-left:10px">
<div style="opacity: 1;"><input type="radio" id="handle-long-branch-cap" name="handle-long-branch" value="cap" style="opacity: 1;">Shorten</div>
</td>
</tr></tbody></table-->
</div>
</div>
</div>
<div class='panel panel-default'>
<div class='panel-heading mst-menu-title' id='mst-layout-menu'>
<b id>Rendering</b>
<span id='mst-layout-menu-icon' class="glyphicon glyphicon-menu-right"></span>
</div>
<div class="panel-body" id='mst-layout-menu-panel'>
<!-- CUSTOM
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="help help-tooltip" onclick="getHelpBox('rendering');">
<img src="cohesive-theme/img/iconic/help-circle.svg" alt="Suggerimento">
</div>
<!--
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<!--span class="glyphicon glyphicon-question-sign" style="float:right;margin-right:5px" onclick="getHelpBox('rendering');"></span-->
<!--div-->
<div class="rendering-options">
<label>
<input type='radio' name='render-method' class='render-method' value='automatic' /> <b>Dynamic</b>
</label>
<!--/div-->
<!--div style='margin-left:20px;font-size:90%' !-->
<label class="sub-label">
<input id='render-selected-only' type="checkbox" checked /> Selected Only
</label>
<!--/div-->
</div>
<div class="rendering-options">
<!--div style="margin-top:20px"-->
<label>
<input type='radio' name='render-method' class='render-method' value='static' checked /> <b>Static</b>
</label>
<!--/div-->
<!--div style='margin-left:20px;font-size:90%'-->
<label class="sub-label">
<input id='correct_link_length' type="checkbox" checked /> Real Branch Length
</label>
<!--/div-->
</div>
</div>
</div>
<!-- ADDED PANEL TO INTERACT WITH LEGEND -->
<div class='panel panel-default'>
<div class='panel-heading mst-menu-title' id='mst-legend-menu'>
<b>Legend</b>
<span id='mst-legend-menu-icon' class='glyphicon glyphicon-menu-right'> </span>
</div>
<div class="panel-body" id='mst-legend-menu-panel'>
<div class="panel-body-section">
<!--div class="help help-tooltip" onclick="getHelpBox('branch_labels');">
<img src="genpat-theme/img/iconic/help-circle.svg" alt="Suggerimento">
</div-->
<button id="legend-select-all">Select all items</button>
<button id="legend-invert-selection">Invert slection</button>
<button id="legend-clean-selection">Clean selection</button>
</div>
<div class="panel-body-section">
<!-- <button id="legend-highlight-selection">See selected items</a> -->
<button id="legend-reset">Reset</a>
</div>
</div>
</div>
<!-- ADDED PANEL TO INTERACT WITH MAP -->
<div class='panel panel-default'>
<div class='panel-heading mst-menu-title' id='mst-map-menu'>
<b>Map</b>
<span id='mst-map-menu-icon' class='glyphicon glyphicon-menu-right'> </span>
</div>
<div class="panel-body" id='mst-map-menu-panel'>
<div class="panel-body-section">
<!--div class="help help-tooltip" onclick="getHelpBox('branch_labels');">
<img src="cohesive-theme/img/iconic/help-circle.svg" alt="Suggerimento">
</div-->
<div class="aggregation-options">
<label>
<input type="radio" id="handle-aggregate-by-coordinates" name="handle-aggregation-type" value="coordinates" checked="" style="opacity: 1;"> Aggregate by coordinates
</label>
</div>
<select id='map-delta-select' style="opacity: 0.5;" disabled>
</select>
<!--div class="spinner-box">
<input type='text' id='spinner-mapdelta' class='spin-group'>
</div-->
</div>
<div class="panel-body-section">
<div class="aggregation-options">
<label>
<input type="radio" id="handle-aggregate-by-metadata" name="handle-aggregation-type" value="metadata" style="opacity: 1;"> Aggregate by metadata
</label>
</div>
<select id='metadata-map-select' style="opacity: 0.5;" disabled>
<!--option value='nothing'>No category</option-->
</select>
</div>
<div class="panel-body-section">
<div class="spinner-box">
<label>Min marker radius</label>
<input type='text' id='map-point-min-radius' class='spin-group'>
</div>
<div class="spinner-box">
<label>Max marker radius</label>
<input type='text' id='map-point-max-radius' class='spin-group'>
</div>
<button id="reset-map-point-delta-radius">Reset default</a>
</div>
</div>
</div>
<div class='panel panel-default'>
<div class='panel-heading mst-menu-title' id='right-menu'>
<b id>Context Menu</b>
<span id='right-menu-icon' class='glyphicon glyphicon-menu-right'> </span>
</div>
<div class="panel-body" id='right-menu-panel'>
<!-- CUSTOM
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="help help-tooltip" onclick="getHelpBox('context_menu');">
<img src="cohesive-theme/img/iconic/help-circle.svg" alt="Suggerimento">
</div>
<!--
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<!--span class="glyphicon glyphicon-question-sign" style="float:right;margin-right:5px" onclick="getHelpBox('context_menu');"></span-->
<!-- CUSTOM - in place of the 3 divs in comment below
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<ul class="open-context">
<li><a id='mst-svg-x'>GrapeTree</a></li>
<li><a id='myGrid-x'>Metadata</a></li>
<li><a id='legend-svg-x'>Figure Legend</a></li>
</ul>
<!--
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<!--div class='open-context' id='mst-svg-x' style='font-size:110%;margin:10px'>GrapeTree</div>
<div class='open-context' id='myGrid-x' style='font-size:110%;margin:10px'>Metadata</div>
<div class='open-context' id='legend-svg-x' style='font-size:110%;margin:10px'>Figure Legend</div-->
</div>
</div>
</div>
<!-- CUSTOM
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div class="graph-tools">
<div class="graph-tool graph-tool-settings" onclick="toggleAside()">Edit</div>
<div class="graph-tool graph-tool-map" onclick="toggleMap()">Map</div>
<!-- <div class="graph-tool graph-tool-zoom-in" onclick="javascript:the_tree.setScale(1.1,true)">Zoom In</div> -->
<!-- <div class="graph-tool graph-tool-zoom-out" onclick="javascript:the_tree.setScale(0.9,true)">Zoom Out</div> -->
<div class="graph-tool graph-tool-full-screen" onclick="openFullscreen()">Full Screen</div>
<div class="graph-tool graph-tool-close-full-screen" onclick="closeFullscreen()">Close Full Screen</div>
</div>
<!--
–––––––––––––––––––––––––––––––––––––––––––––––––– -->
<div id="graph-div" class="graph-overlay"></div>
<div id="map-div"></div>
<script src="static/js/main/bootstrap.min.js"></script>
<script charset="utf-8" src="static/js/main/d3.min.js"></script>
<script charset="utf-8" src="static/js/main/spin.min.js"></script>
<script charset="utf-8" src="static/js/tree/base_tree.js?version=1"></script>
<script charset="utf-8" src="static/js/tree/d3_m_tree.js?version=1"></script>
<script charset="utf-8" src="static/js/tree/grapetree_fileHandler.js?version=1"></script>
<script src="static/js/tree/tree_extended.js"></script>
<script src="static/js/tree/tree_interceptor.js"></script>
<script src="static/js/tree/legend.js"></script>
<!-- LeafletJS JS -->
<script src="static/js/map/leaflet.js"></script>
<script src="static/js/map/leaflet-canvasicon.js"></script>
<script src="static/js/map/leaflet-piechart.js"></script>
<script src="static/js/map/map.js"></script>
<script>
var tree_id = null
</script>
<!--
{% if tree_id%}
{% include 'ms_tree/enterobase_generic_tree.html' %}
{%endif %}
-->
<script charset="utf-8">
var context_menu = null;
var metadata_grid = null;
var the_tree = null;
// getHelpBox('load_files')
var tree_raw = {};
var current_metadata_file = null;
var waiting_spinner = null;
var metadata_categories = {};
var cannot_connect = false;
var default_control_panel_values = {
max_link_scale: 500,
base_node_size: 10,
max_link_length: "",
size_power: 0.5,
log_link_scale: false,
show_individual_segments: false,
link_font_size: 14,
show_link_labels: false,
show_node_labels: false,
node_font_size: 12,
hide_link_length: "",
node_collapsed_value: 0
};
var changeCounter = 0;
var filtered_nodes = [];
var tooltip_div = d3.select("body")
.append("div")
.attr("class", "tooltip")
.style("opacity", 0)
.style("z-index", 9)
var legend_colour_chooser = $("<input>").spectrum({
//type: "flat",
togglePaletteOnly: "true",
showInput: "true",
showInitial: "true",
allowEmpty: "false",
showAlpha: "false",
change: function(e) {
var cc = $(this);
the_tree.setColour(cc.data("category"),cc.data("value"),cc.val());
the_tree.changeCategory(cc.data("category"));
var is_empty = Object.keys(the_legend.values).length === 0;
if(!is_empty) {
the_legend.legendRetrieveSelection();
}
if(the_legend.is_active) {
the_legend.legendHighlightSelection();
}
}})
.hide();
$("body").append(legend_colour_chooser);
$("#welcome-div").draggable().css({
position: 'relative',
border: '1px solid black',
margin: '10px',
'z-index': 9999
}).hide();
//a map of group to another map of name to label
var metadata_options = {};
// var file_chooser = new MSFileChooser(".nwk");
var file_chooser = new MSFileChooser(".json");
//update all the select options
function addMetadataOptions(options) {
var fields = Object.keys(options).sort(function(m, n) {
return m === 'nothing' ? -1 : n === 'nothing' ? 1 : ((m < n) ? -1 : 1)
});
for (var fld_id in fields) {
var value = fields[fld_id];
var obj = options[value];
var category = null;
var label = ""
if (typeof obj === 'object') {
label = obj['label'];
category = obj['category'];
} else {
label = obj;
}
var append_to_1 = $("#metadata-select");
var append_to_2 = $("#node-label-text")
if (category) {
if (!metadata_categories[category]) {
metadata_categories[category] = true;
append_to_1 = $("<optgroup>").attr("label", category);
append_to_1_map = $("<optgroup>").attr("label", category);
append_to_2 = $("<optgroup>").attr("label", category);
$("#metadata-select").append(append_to_1);
$("#node-label-text").append(append_to_2);
} else {
var to_find = "[label='" + category + "']";
append_to_1 = $("#metadata-select").find(to_find);
append_to_2 = $("#node-label-text").find(to_find);
}
}
append_to_1.append($("<option>").attr("value", value).text(label));
append_to_2.append($("<option>").attr("value", value).text(label));
the_map.metadata_delta_options.push(value);
}
}
function deleteMetadataCategory() {
var category = $("#add-new-values-select").val();
the_tree.removeCategory(category);
$("#metadata-select option[value='" + category + "']").remove();
$("#metadata-map-select option[value='" + category + "']").remove();
$("#node-label-text option[value='" + category + "']").remove();
$("#add-new-values-select option[value='" + category + "']").remove();
delete metadata_options[category];
}
function showToolTip(msg, e) {
if (!e) {
e = d3.event;
}
tooltip_div.transition()
.duration(200)
.style("opacity", .9);
tooltip_div.html(msg)
.style("left", (e.pageX) + "px")
.style("top", (e.pageY - 28) + "px")
.style("height", "auto");
setTimeout(hideToolTip, 2000);
}
function hideToolTip() {
tooltip_div.transition()
.duration(500)
.style("opacity", 0);
}
function treeLoaded(tree) {
//add the extra functionality
metadata_grid = new D3MSMetadataTable(tree);
if (tree_id) {
metadata_grid.setAddColumnFunction(function(name) {
addCustomColumn(name);
})
}
context_menu = new D3MSTreeContextMenu(tree, metadata_grid);
metadata_grid.updateMetadataTable();
//add the ability to show/hide grid,
//update the dropdowns if new options added
tree.addTreeChangedListener(function(type, data) {
if (type === 'metadata_options_altered') {
addMetadataOptions(data);
the_map.setMapControlPanel();
} else if (type === 'nodes_collapased') {
$("#spinner-collapse-nodes").val(data);
$("#spinner-collapse-nodes").spinner('value', data);
var v = parseFloat(data);
$("#slider-collapse-nodes").slider('value', Math.log(v) * 1000);
}
});
tree.addDisplayChangedListener(function(type, data) {
if (type === 'category_changed') {
$("#metadata-select").val(data);
// check if map delta selected is metadata
if (the_map.default_delta_type == "metadata") {
the_map.default_delta = data;
}
// clean legend selction consequences
if (the_legend.is_active) {
var lines = document.querySelectorAll('#vis line');
for (var i = 0; i < lines.length; i++) {
lines[i].setAttribute('style', 'stroke: black; opacity: 1;');
}
}
// assign the legend cat
the_legend.cat = data;
if (changeCounter < 1) {
the_map.definePoints();
} else {
the_map.defineMarkers();
}
changeCounter++;
}
/**
*
* Add tools to legend
*
*/
var svg_legend = document.querySelector('#legend-svg');
var svg_legend_parent = svg_legend.parentElement;
svg_legend_parent.setAttribute('id', 'legend-tools-container');
var legend_tools = document.querySelector('#legend-tools');
if (!legend_tools) {
legend_tools = document.createElement('div');
legend_tools.setAttribute('id', 'legend-tools');
legend_tools.innerHTML = '<div class="no-drag legend-tool legend-tool-settings" onclick="the_legend.toggleLegendSettings()"></div>\
<div class="no-drag legend-tool legend-tool-select-all" onclick="the_legend.legendSelectAll()"></div>\
<div class="no-drag legend-tool legend-tool-invert-selection" onclick="the_legend.legendInvertSelection()"></div>\
<div class="no-drag legend-tool legend-tool-clean-selection" onclick="the_legend.legendCleanSelection()"></div>\
<div class="no-drag legend-tool legend-tool-play-selection" onclick="the_legend.legendPlaySelection(this)"></div>\
<div class="no-drag legend-tool legend-tool-reset" onclick="the_legend.legendReset()"></div>';
svg_legend_parent.appendChild(legend_tools);
}
});
tree.legendItemClicked = function(data){
legend_colour_chooser.spectrum("set", data.colour);
//.css({"left":0,"top":0})
//.val(data.colour)
legend_colour_chooser.data({"value":data.value.split(" [")[0],"category":data.category});
//legend_colour_chooser.spectrum("show");
setTimeout(function(){legend_colour_chooser.spectrum("show");}, 50);
};
/**
*
* Select an item in the legend, function added in base tree (see CHANGE_LOG.md).
*
*/
tree.legendItemTextClicked = function(data) {
if(!$("#legend-tools").hasClass("active")) {
$("#legend-tools").addClass("active");
}
var target = $(data.target);
if (target.attr('class') == 'selected') {
target.attr('class', 'not-selected');
// delete values
delete the_legend.values[data.real];
// remove data.value from items array
the_legend.items = the_legend.items.filter(function(item) {return item !== data.value});
} else {
target.attr('class', 'selected');
the_legend.values[data.real] = data.colour;
the_legend.items.push(data.value);
}
the_legend.cat = data.category;
the_legend.legendHighlightSelection();
};
$("#spinner-link-length").spinner({
min: 0,
max: tree.max_link_distance,
step: Math.max(1e-6, (tree.max_link_distance / 1000.0).toPrecision(1)),
});
$("#spinner-collapse-nodes").data('branches', $.unique(tree.original_links.map(function(d) {
return d.distance
}).sort(function(d1, d2) {
return d1 - d2
})));
$("#spinner-collapse-nodes").spinner({
min: 0,
max: tree.max_link_distance,
value: tree.node_collapsed_value,
step: 1e-6,
});
$("#slider-collapse-nodes").slider({
min: Math.log(1e-7) * 1000,
max: Math.log(tree.max_link_distance + 0.01) * 1000,
value: Math.log(tree.node_collapsed_value) * 1000,
});
tree.centerGraph();
tree.resize();
$(waiting_spinner.el).hide();
$("#waiting-information").text("Complete. Tree has " + tree.force_nodes.length + " nodes");
$("#waiting-image").attr("src", "static/js/img/ms_complete_1.png").show();
// legend_colour_chooser.hide();
$("#information-div").modal("hide");
the_map.initMap();
}
function setControlPanel(data) {
$("#slider-linklength").slider("value", Math.log(data['max_link_scale'] / 5.) * 1000.0);
$("#spinner-linklength").val(data['max_link_scale'] / 5.);
$("#slider-nodesize").slider("value", data['base_node_size'] * 10);
$("#spinner-nodesize").val(data['base_node_size'] * 10);
if (data['max_link_length']) {
$("#spinner-link-length").val(data['max_link_length']);
$("#handle-long-branch-hide").prop("checked", true);
} else if (data['hide_link_length']) {
$("#spinner-link-length").val(data['hide-link-length']);
$("#handle-long-branch-cap").prop("checked", true);
}
if (data['size_power']) {
$("#slider-relative-nodesize").slider("value", data['size_power'] * 200.0);
$("#spinner-relative-nodesize").val(data['size_power'] * 200.0);
}
if (data['log_link_scale']) {
$('#link-log-scale').prop('checked', true);
}
if (data['show_individual_segments']) {
$("#show-individual-segments").prop("checked", true);
}
if (data['link_font_size']) {
$("#slider-linkfontsize").slider("value", data['link_font_size']);
$("#spinner-linkfontsize").spinner("value", data['link_font_size']);
}
var sll = true;
if (data['show_link_labels'] === false) {
sll = false;
}
$("#show-link-labels").prop("checked", sll);
$("#show-node-labels").prop("checked", data['show_node_labels']);
if (data['node_font_size']) {
$("#slider-node-fontsize").slider("value", data['node_font_size']);
$("#spinner-node-fontsize").spinner("value", data['node_font_size']);
}
var col_value = data['node_collapsed_value'] ? data['node_collapsed_value'] : 0;
$("#slider-collapse-nodes").slider("value", Math.log(col_value) * 1000);
$("#spinner-collapse-nodes").val(col_value);
}
function treeLoading(tree, msg) {
if (msg === 'complete') {
treeLoaded(tree);
} else {
$("#waiting-information").text(msg);
}
}
function loadFailed(msg) {
$("#information-div").modal("show");
$(waiting_spinner.el).hide();
$("#waiting-image").attr("src", "static/js/img/ms_failed_1.png").show();
$("#waiting-information").text(msg);
}
function loadMSTree(data) {
// $("#welcome-div").toggle();
metadata_options = {};
if (the_tree) {
the_tree.svg.remove();
the_tree.legend_div[0].remove();
//resetGridColumns();
$("#metadata-select").find("option").remove();
$("#node-label-text").find("option").remove();
$("#metadata-div").remove();
$("#context-menu").remove();
}
$("#waiting-information").text("Loading Data");
the_tree = null;
the_tree = new D3MSTree(
"graph-div", JSON.parse(JSON.stringify(data)),
function(tree, msg) {
treeLoading(tree, msg);
});
// tree_interceptor(the_tree, (groupedNods) => console.log(groupedNods));
tree_interceptor(the_tree, (groupedNods) => the_map.findNodesInMap(groupedNods));
the_tree.addSegmentOverListener(function(d) {
if ($("#show-node-tooltip").prop("checked")){
if (the_tree.display_category === 'nothing') {
var node_ids = the_tree.grouped_nodes[d.data.idx];
var value = $.map(node_ids, function(idx) {return the_tree.metadata[idx].Name ? the_tree.metadata[idx].Name : the_tree.metadata[idx].ID}).join('<br>');
showToolTip(value);
} else {
var display = d.data.type;
showToolTip(display+"("+d.data.value+")");
}
}
});
the_tree.addSegmentOutListener(function(d) {
hideToolTip();
});
the_tree.addLinkOverListener(function(d) {
if ($("#show-node-tooltip").prop("checked")) {
showToolTip("length:" + d.value);
}
});
the_tree.addLinkOutListener(function(d) {
hideToolTip();
});
the_tree.resize();
// commented to avoid a double call for metadata_info
/*if (the_tree.metadata_info) {
addMetadataOptions(the_tree.metadata_info);
}*/
$("#metadata-select").val('nothing');
$("#node-label-text").val('ID');
if (data['initial_category']){
$("#metadata-select").val(data['initial_category']);
}
if (data['layout_data'] && data['layout_data']['nodes_links']) {
setControlPanel(data['layout_data']['nodes_links'])
} else {
setControlPanel(default_control_panel_values);
}
if (current_metadata_file) {
loadMetadataText(current_metadata_file[0], current_metadata_file[1]);
} else {