phyloio 2.1.0 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/Examples/Website/phyloio.html +73 -71
  2. package/Examples/Website/src_worker_bcn_js.phylo.js +8093 -0
  3. package/Examples/Website/src_worker_distance_js.phylo.js +6257 -0
  4. package/README.md +16 -2
  5. package/dist/phylo.js +7 -7
  6. package/dist/src_worker_bcn_js.phylo.js +2 -2
  7. package/dist/src_worker_distance_js.phylo.js +1 -1
  8. package/{src_phylo_compare → dist-jest}/phylo.js +68 -132
  9. package/{src_phylo_compare → dist-jest}/src_utils_js.phylo.js +1 -1
  10. package/dist-jest/src_worker_bcn_js.phylo.js +350 -0
  11. package/dist-jest/src_worker_distance_js.phylo.js +219 -0
  12. package/{src_phylo_compare/vendors-node_modules_biojs-io-newick_src_index_js-node_modules_minhashjs_index_js.phylo.js → dist-jest/vendors-node_modules_biojs-io-newick_src_index_js-node_modules_minhashjs_index_js-node_module-7b40e5.phylo.js} +25 -15
  13. package/package-lock.json +19607 -0
  14. package/package.json +1 -1
  15. package/rerooting.test.js +297 -0
  16. package/src/api.js +19 -9
  17. package/src/container.js +408 -64
  18. package/src/interface.css +6 -0
  19. package/src/interface.js +371 -207
  20. package/src/model.js +19 -20
  21. package/src/tmp +12 -0
  22. package/src/utils.js +31 -1
  23. package/src/viewer.js +177 -88
  24. package/src_phylo_compare/fonts/fa-brands-400.eot +0 -0
  25. package/src_phylo_compare/fonts/fa-brands-400.svg +0 -3717
  26. package/src_phylo_compare/fonts/fa-brands-400.ttf +0 -0
  27. package/src_phylo_compare/fonts/fa-brands-400.woff +0 -0
  28. package/src_phylo_compare/fonts/fa-brands-400.woff2 +0 -0
  29. package/src_phylo_compare/fonts/fa-regular-400.eot +0 -0
  30. package/src_phylo_compare/fonts/fa-regular-400.svg +0 -801
  31. package/src_phylo_compare/fonts/fa-regular-400.ttf +0 -0
  32. package/src_phylo_compare/fonts/fa-regular-400.woff +0 -0
  33. package/src_phylo_compare/fonts/fa-regular-400.woff2 +0 -0
  34. package/src_phylo_compare/fonts/fa-solid-900.eot +0 -0
  35. package/src_phylo_compare/fonts/fa-solid-900.svg +0 -5034
  36. package/src_phylo_compare/fonts/fa-solid-900.ttf +0 -0
  37. package/src_phylo_compare/fonts/fa-solid-900.woff +0 -0
  38. package/src_phylo_compare/fonts/fa-solid-900.woff2 +0 -0
  39. package/src_phylo_compare/fonts/fa-v4compatibility.ttf +0 -0
  40. package/src_phylo_compare/fonts/fa-v4compatibility.woff2 +0 -0
  41. package/src_phylo_compare/src_worker_bcn_js.phylo.js +0 -341
  42. package/src_phylo_compare/src_worker_distance_js.phylo.js +0 -227
  43. package/src_phylo_compare.zip +0 -0
  44. /package/{src_phylo_compare → dist-jest}/vendors-node_modules_d3_index_js-node_modules_file-saver_dist_FileSaver_min_js.phylo.js +0 -0
package/src/model.js CHANGED
@@ -30,6 +30,7 @@ export default class Model {
30
30
  'use_branch_lenght' : true,
31
31
  'show_tooltips' : false,
32
32
  'subsample_label' : true,
33
+ 'use_internal_node_name_for_triangles' : true,
33
34
  'display_internal_label' : false,
34
35
  'display_internal_label_left_top' : false,
35
36
  'display_internal_label_left_bottom' : false,
@@ -80,6 +81,8 @@ export default class Model {
80
81
  },
81
82
  'sync_coloring': false,
82
83
  'selected_triangle_coloring': 'None',
84
+ 'selected_collapse_uncolored': 'Leaves',
85
+ 'selected_collapse_monocolored': 'Leaves',
83
86
  'colorScale': {'leaf' : null, 'node':null, 'circle': {}},
84
87
  'intercolor': {'leaf' : null, 'node': null, 'circle': {}}
85
88
  }
@@ -791,10 +794,6 @@ export default class Model {
791
794
  parent.branch_length = old_distance /2
792
795
  parent.extended_informations['Length'] = old_distance/2
793
796
 
794
-
795
-
796
- // ((C,D)1,(A,(B,X)3)2,E); to test
797
-
798
797
  // Until we reach the old root reverse child/parent order
799
798
  var child = root
800
799
  var stack = []
@@ -809,29 +808,26 @@ export default class Model {
809
808
  parent.values_before_reverse = {}
810
809
  parent.branch_length_before_reverse = parent.branch_length
811
810
 
812
- for (var key of this.settings.edge_related_data) {
813
-
814
- var value = key;
811
+ for (var value of this.settings.edge_related_data) {
815
812
 
816
813
  parent.values_before_reverse[value] = parent.extended_informations[value]
817
814
 
815
+ if (value=== 'Length'){
816
+ parent.branch_length = child.branch_length_before_reverse || child.branch_length;
817
+ parent.extended_informations['Length'] = parent.branch_length;
818
818
 
819
- if (value=== 'Length'){
820
- parent.branch_length = child.branch_length_before_reverse || child.branch_length;
821
- parent.extended_informations['Length'] = parent.branch_length;
822
-
819
+ }
820
+ else{
821
+ if ( child.values_before_reverse && value in child.values_before_reverse){
822
+ parent.extended_informations[value] = child.values_before_reverse[value]
823
823
  }
824
824
  else{
825
- if ( child.values_before_reverse && value in child.values_before_reverse){
826
- parent.extended_informations[value] = child.values_before_reverse[value]
827
- }
828
- else{
829
- parent.extended_informations[value] = child.extended_informations[value]
830
- child.extended_informations[value] = null
831
- }
832
-
825
+ parent.extended_informations[value] = child.extended_informations[value]
826
+ child.extended_informations[value] = null
833
827
  }
834
828
 
829
+ }
830
+
835
831
 
836
832
 
837
833
  }
@@ -887,7 +883,6 @@ export default class Model {
887
883
 
888
884
  for (var childy of root.children) {
889
885
 
890
- console.log(childy, childy.extended_informations[key], root.extended_informations[key] )
891
886
  childy.extended_informations[key] = root.extended_informations[key]
892
887
 
893
888
  }
@@ -906,6 +901,8 @@ export default class Model {
906
901
 
907
902
  this.traverse(root, function(n,c){
908
903
  n.leaves = this.get_leaves(n)
904
+ n.values_before_reverse = {}
905
+ n.branch_length_before_reverse = undefined
909
906
  })
910
907
 
911
908
 
@@ -1175,6 +1172,8 @@ export default class Model {
1175
1172
  // headers: column_name -> type
1176
1173
 
1177
1174
  Object.keys(headers).forEach(item => {
1175
+
1176
+
1178
1177
  if (item != reference || item != 'Length' ) {
1179
1178
 
1180
1179
  this.settings.extended_data_type[item] = headers[item]
package/src/tmp ADDED
@@ -0,0 +1,12 @@
1
+ 578 ./api.js
2
+ 40 ./color_mapper.js
3
+ 916 ./container.js
4
+ 40 ./index.js
5
+ 4149 ./interface.js
6
+ 70 ./keyboardManager.js
7
+ 1349 ./model.js
8
+ 1484 ./phyloxml.js
9
+ 987 ./utils.js
10
+ 2703 ./viewer.js
11
+ 144 ./worker_bcn.js
12
+ 10 ./worker_distance.js
package/src/utils.js CHANGED
@@ -969,6 +969,36 @@ function prepare_and_run_distance(m1,m2){
969
969
  return distance
970
970
  }
971
971
 
972
- module.exports = {prepare_and_run_distance, build_table, reroot_hierarchy, screen_shot, parse_nhx, save_file_as, compute_RF_Euc, get_intersection_leaves, filter_leaves_hierarchy, remove_duplicated_and_unnamed_leaves_hierarchy};
972
+ function check_if_color(query){
973
+ var accepted_spelling = ['color', 'colour'];
974
+
975
+ if (accepted_spelling.includes(query.toLowerCase())){
976
+ return true;
977
+ }
978
+ else {
979
+ return false;
980
+ }
981
+ }
982
+
983
+ function hexToRgb(hex) {
984
+ const bigint = parseInt(hex.slice(1), 16);
985
+ const r = (bigint >> 16) & 255;
986
+ const g = (bigint >> 8) & 255;
987
+ const b = bigint & 255;
988
+ return { r, g, b };
989
+ }
990
+
991
+ function colorDifference(hex1, hex2) {
992
+ const color1 = hexToRgb(hex1);
993
+ const color2 = hexToRgb(hex2);
994
+ const rDiff = color1.r - color2.r;
995
+ const gDiff = color1.g - color2.g;
996
+ const bDiff = color1.b - color2.b;
997
+ const distance = Math.sqrt(rDiff * rDiff + gDiff * gDiff + bDiff * bDiff);
998
+ const maxDistance = Math.sqrt(255 * 255 * 3);
999
+ return (distance / maxDistance) * 100;
1000
+ }
1001
+
1002
+ module.exports = {colorDifference, check_if_color, prepare_and_run_distance, build_table, reroot_hierarchy, screen_shot, parse_nhx, save_file_as, compute_RF_Euc, get_intersection_leaves, filter_leaves_hierarchy, remove_duplicated_and_unnamed_leaves_hierarchy};
973
1003
 
974
1004
 
package/src/viewer.js CHANGED
@@ -42,6 +42,7 @@ export default class Viewer {
42
42
  this.container_d3.style('font-family', 'monospace !important' )
43
43
 
44
44
  this.interface;
45
+ this.blinking=0;
45
46
 
46
47
  // Settings
47
48
  this.settings = {
@@ -301,6 +302,7 @@ export default class Viewer {
301
302
  this.maximise_zoom()
302
303
  this.svg.call(this.zoom.scaleBy, 0.5)
303
304
  this.container_object.history_actions = []
305
+ this.container_object.undone_actions = []
304
306
 
305
307
  }
306
308
 
@@ -400,6 +402,7 @@ export default class Viewer {
400
402
  var show_duplications = this.model.settings.display_duplication
401
403
  var mirror_factor = this.model.settings.mirror ? -1 : 1
402
404
  var deepest_tip = 0;
405
+ var k = this.d3.zoomTransform(d3.select("#master_g" + this.uid).node()).k
403
406
 
404
407
  // update x pos with branch length
405
408
  this.nodes.forEach(d => {
@@ -535,7 +538,7 @@ export default class Viewer {
535
538
  this.nodeUpdate.select('circle.node')
536
539
  .attr('r', d => d._children || (!this.model.rooted && d.data.root ) ? 1e-6 : real_node_radius )
537
540
  .style("fill", (d) => {
538
- if ( d.data.duplication && show_duplications){
541
+ if ( (d.data.duplication && show_duplications)){
539
542
  return 'red'
540
543
  }
541
544
 
@@ -570,6 +573,31 @@ export default class Viewer {
570
573
  })
571
574
  .attr('cursor', 'pointer');
572
575
 
576
+ if (this.blinking > 0) {
577
+
578
+ var BCN_nodes = node.select('circle.node').filter(d => d.data._show_BCN);
579
+
580
+ BCN_nodes.style('stroke', 'red')
581
+ .style('stroke-width', (d) => { return (2/k) + 'px'})
582
+
583
+ // Blinking effect
584
+ let isVisible = true;
585
+ const interval = setInterval(() => {
586
+ isVisible = !isVisible;
587
+ BCN_nodes.style("stroke-opacity", isVisible ? 1 : 0);
588
+ this.blinking -= 1;
589
+
590
+
591
+ if (this.blinking <= 0) {
592
+ clearInterval(interval); // Stop the interval when blinking reaches 0
593
+ BCN_nodes.style("stroke-opacity", 0); // Ensure stroke is visible after stopping
594
+ }
595
+
596
+ }, 750); // Blink every 500ms
597
+
598
+
599
+ }
600
+
573
601
  this.node_face_update(this.nodeUpdate)
574
602
 
575
603
  // Remove any exiting nodes
@@ -638,87 +666,93 @@ export default class Viewer {
638
666
  })
639
667
 
640
668
  // align to tip
669
+ this.G.selectAll("line.dashed_line").remove()
670
+ if (this.model.settings.align_tip) {
671
+
672
+ var update_dashed = (d) => {
673
+
674
+ this.G.append("line")
675
+ .attr("class", "dashed_line")
676
+ .attr("x1", mirror_factor * d.y)
677
+ .attr("y1", d.x)
678
+ .attr("x2", mirror_factor * (d.y + d.off_set_to_tip))
679
+ .attr("y2", d.x)
680
+ .style("stroke", "white")
681
+ .style("stroke-dasharray", this.compute_edge_width() + ', ' + this.compute_edge_width())
682
+ }
683
+
641
684
 
642
- if (this.model.settings.align_tip){
643
685
 
644
686
  if (this.model.settings.has_branch_lenght && this.model.settings.use_branch_lenght) {
645
687
 
646
688
  // update y pos with branch length
647
689
  this.nodes.forEach(d => {
648
690
 
649
- var distance_root_to_tip = this.scale_branch_length(d.data.distance_to_root) + (d.data.triangle_width ? d.data.triangle_width : 0)
691
+ var distance_root_to_tip = this.scale_branch_length(d.data.distance_to_root) + (d.data.triangle_width ? d.data.triangle_width : 0);
650
692
 
651
- if (deepest_tip <distance_root_to_tip ){
652
- deepest_tip = distance_root_to_tip
693
+ if (deepest_tip < distance_root_to_tip) {
694
+ deepest_tip = distance_root_to_tip;
653
695
  }
654
- })
696
+ });
655
697
 
656
698
  // Transition to the proper position for the node
657
699
  this.nodeUpdate.transition()
658
700
  .duration(duration)
659
- .attr("transform", (d) => {
701
+ .attr("transform", (d) => {
660
702
 
661
- if (d.children ){
662
- d.off_set_to_tip = 0
663
- return "translate(" + (mirror_factor*d.y) + "," + d.x + ")";
664
- }
665
-
666
- else if (d._children) {
667
- d.off_set_to_tip = deepest_tip - this.scale_branch_length(d.data.distance_to_root) - d.data.triangle_width
668
- return "translate(" + (mirror_factor*(d.y + d.off_set_to_tip)) + "," + d.x + ")";
669
- }
670
-
671
- else {
672
- d.off_set_to_tip = deepest_tip - this.scale_branch_length(d.data.distance_to_root)
673
- return "translate(" + (mirror_factor* (d.y + d.off_set_to_tip)) + "," + d.x + ")";
674
- }
703
+ if (d.children) {
704
+ d.off_set_to_tip = 0;
705
+ return "translate(" + (mirror_factor * d.y) + "," + d.x + ")";
706
+ } else if (d._children) {
707
+ d.off_set_to_tip = deepest_tip - this.scale_branch_length(d.data.distance_to_root) - d.data.triangle_width;
675
708
 
709
+ update_dashed(d)
676
710
 
711
+ return "translate(" + (mirror_factor * (d.y + d.off_set_to_tip)) + "," + d.x + ")";
712
+ } else {
713
+ d.off_set_to_tip = deepest_tip - this.scale_branch_length(d.data.distance_to_root);
677
714
 
715
+ update_dashed(d)
678
716
 
717
+ return "translate(" + (mirror_factor * (d.y + d.off_set_to_tip)) + "," + d.x + ")";
718
+ }
679
719
  });
680
720
  }
681
- else{
721
+ else {
682
722
 
683
723
  // update y pos with branch length
684
724
  this.nodes.forEach(d => {
685
725
 
686
- var distance_root_to_tip = this.scale_branch_depth(d.data.depth) + (d.data.triangle_width ? d.data.triangle_width : 0)
726
+ var distance_root_to_tip = this.scale_branch_depth(d.data.depth) + (d.data.triangle_width ? d.data.triangle_width : 0);
687
727
 
688
- if (deepest_tip <distance_root_to_tip ){
689
- deepest_tip = distance_root_to_tip
728
+ if (deepest_tip < distance_root_to_tip) {
729
+ deepest_tip = distance_root_to_tip;
690
730
  }
691
- })
731
+ });
692
732
 
693
733
  // Transition to the proper position for the node
694
734
  this.nodeUpdate.transition()
695
735
  .duration(duration)
696
- .attr("transform", (d) => {
736
+ .attr("transform", (d) => {
697
737
 
698
- if (d.children ){
699
- d.off_set_to_tip = 0
700
- return "translate(" + (mirror_factor*d.y) + "," + d.x + ")";
701
- }
702
-
703
- else if (d._children) {
704
- d.off_set_to_tip = deepest_tip - this.scale_branch_depth(d.data.depth) - d.data.triangle_width
705
- return "translate(" + (mirror_factor*(d.y + d.off_set_to_tip)) + "," + d.x + ")";
706
- }
707
-
708
- else {
709
- d.off_set_to_tip = deepest_tip - this.scale_branch_depth(d.data.depth)
710
- return "translate(" + (mirror_factor* (d.y + d.off_set_to_tip)) + "," + d.x + ")";
711
- }
738
+ if (d.children) {
739
+ d.off_set_to_tip = 0;
740
+ return "translate(" + (mirror_factor * d.y) + "," + d.x + ")";
741
+ } else if (d._children) {
742
+ d.off_set_to_tip = deepest_tip - this.scale_branch_depth(d.data.depth) - d.data.triangle_width;
712
743
 
744
+ update_dashed(d)
713
745
 
746
+ return "translate(" + (mirror_factor * (d.y + d.off_set_to_tip)) + "," + d.x + ")";
747
+ } else {
748
+ d.off_set_to_tip = deepest_tip - this.scale_branch_depth(d.data.depth);
714
749
 
750
+ update_dashed(d)
715
751
 
752
+ return "translate(" + (mirror_factor * (d.y + d.off_set_to_tip)) + "," + d.x + ")";
753
+ }
716
754
  });
717
755
  }
718
-
719
-
720
-
721
-
722
756
  }
723
757
 
724
758
 
@@ -881,6 +915,9 @@ export default class Viewer {
881
915
  .attr('d', d => this.square_edges({x: source.x, y: source.y}, {x: source.x, y: source.y}))
882
916
  .remove();
883
917
 
918
+ var real_edges_width = this.compute_edge_width()
919
+ this.G.selectAll('.dashed_line').style('stroke-width', real_edges_width + 'px')
920
+
884
921
  }
885
922
 
886
923
  get_compared_model(){
@@ -928,11 +965,17 @@ export default class Viewer {
928
965
 
929
966
  var v = edge.data.extended_informations[acc];
930
967
 
931
- if (typeof v == "undefined" ) {return "#555"}
968
+
969
+
970
+ // check if v is undefined or empty
971
+ if (typeof v == "undefined" || !v ) {return "#555"}
932
972
  else {
933
973
  if (this.model.settings.extended_data_type[acc] == 'cat') {
934
974
  return this.model.settings.colorScale['node'].get_color(v)
935
975
  }
976
+ else if (this.model.settings.extended_data_type[acc] == 'color') {
977
+ return v
978
+ }
936
979
  else {
937
980
  return this.model.settings.colorScale['node'](v)
938
981
  }
@@ -1018,10 +1061,11 @@ export default class Viewer {
1018
1061
 
1019
1062
  var real_edges_width = this.compute_edge_width()
1020
1063
  this.G.selectAll('path.link').style('stroke-width', real_edges_width + 'px')
1064
+ this.G.selectAll('.dashed_line').style('stroke-width', real_edges_width + 'px')
1021
1065
 
1022
- }
1023
1066
 
1024
1067
 
1068
+ }
1025
1069
 
1026
1070
  this.model.store_zoomTransform(transform)
1027
1071
 
@@ -1124,6 +1168,15 @@ export default class Viewer {
1124
1168
  ]
1125
1169
  }
1126
1170
 
1171
+ if (this.container_object.api.settings.compareMode && this.container_object.api.bound_container.includes(this.container_object)){
1172
+
1173
+ menu.push({
1174
+ title: 'Highlight BCN' ,
1175
+ action: () => {this.container_object.trigger_("BCN", node.data, node)}
1176
+ })
1177
+
1178
+ }
1179
+
1127
1180
  if (this.container_object.api.settings.phylostratigraphy){
1128
1181
 
1129
1182
  menu.push({
@@ -1137,6 +1190,8 @@ export default class Viewer {
1137
1190
  }
1138
1191
 
1139
1192
 
1193
+
1194
+
1140
1195
  menu.push({
1141
1196
  title: 'Close' ,
1142
1197
  action: () => {
@@ -1451,7 +1506,9 @@ export default class Viewer {
1451
1506
  maximise_zoom(){
1452
1507
 
1453
1508
  var old_zoom = this.d3.zoomTransform(d3.select("#master_g" + this.uid).node())
1454
- this.container_object.add_action('Stretch tree', this, this.render_with_settings, [old_zoom.k, old_zoom.x,old_zoom.y,this.model.settings.tree.node_horizontal_size, []] )
1509
+
1510
+
1511
+
1455
1512
  // Adjust Zoom-y to fit height
1456
1513
  var r = this.get_height_hierarchy()
1457
1514
  var vh = this.height - this.settings.style.offset_top_fit
@@ -1489,6 +1546,11 @@ export default class Viewer {
1489
1546
 
1490
1547
  var real_edges_width = this.compute_edge_width()
1491
1548
  this.G.selectAll('path.link').style('stroke-width', real_edges_width + 'px')
1549
+ this.G.selectAll('.dashed_line').style('stroke-width', real_edges_width + 'px')
1550
+
1551
+ var undo = {'name': 'Revert Zoom', 'fonction_obj': this, 'fonct': this.render_with_settings, 'argu': [old_zoom.k, old_zoom.x,old_zoom.y,this.model.settings.tree.node_horizontal_size, []]}
1552
+ var redo = {'name': 'Stretch tree', 'fonction_obj': this, 'fonct': this.render_with_settings, 'argu': [h_scale, x_tr, y_tr,ns, []] }
1553
+ this.container_object.add_action(undo, redo, true)
1492
1554
 
1493
1555
  }
1494
1556
 
@@ -1496,7 +1558,9 @@ export default class Viewer {
1496
1558
 
1497
1559
  var collapsed = this.model.get_all_collapse(this.model.data)
1498
1560
  var old_zoom = this.d3.zoomTransform(d3.select("#master_g" + this.uid).node())
1499
- this.container_object.add_action('Compact tree', this, this.render_with_settings, [old_zoom.k, old_zoom.x,old_zoom.y,this.model.settings.tree.node_horizontal_size, collapsed] )
1561
+
1562
+
1563
+
1500
1564
 
1501
1565
  // Increment Collapsed Depth until "Visible leaf" > "Max visible leaves"
1502
1566
  var depth;
@@ -1557,6 +1621,11 @@ export default class Viewer {
1557
1621
 
1558
1622
  var real_edges_width = this.compute_edge_width()
1559
1623
  this.G.selectAll('path.link').style('stroke-width', real_edges_width + 'px')
1624
+ this.G.selectAll('.dashed_line').style('stroke-width', real_edges_width + 'px')
1625
+
1626
+ var undo = {'name': 'Uncompact tree', 'fonction_obj': this, 'fonct': this.render_with_settings, 'argu': [old_zoom.k, old_zoom.x,old_zoom.y,this.model.settings.tree.node_horizontal_size, collapsed]}
1627
+ var redo = {'name': 'Compact tree', 'fonction_obj': this, 'fonct': this.fit_to_viewer_height, 'argu': [] }
1628
+ this.container_object.add_action(undo, redo, true)
1560
1629
 
1561
1630
 
1562
1631
 
@@ -1582,6 +1651,7 @@ export default class Viewer {
1582
1651
 
1583
1652
  var real_edges_width = this.compute_edge_width()
1584
1653
  this.G.selectAll('path.link').style('stroke-width', real_edges_width + 'px')
1654
+ this.G.selectAll('.dashed_line').style('stroke-width', real_edges_width + 'px')
1585
1655
 
1586
1656
  }
1587
1657
 
@@ -1628,8 +1698,8 @@ export default class Viewer {
1628
1698
 
1629
1699
  toggle_align_tip(){
1630
1700
  this.model.settings.align_tip = !this.model.settings.align_tip
1631
-
1632
1701
  this.render(this.hierarchy)
1702
+
1633
1703
  }
1634
1704
 
1635
1705
  toggle_mirror(){
@@ -1676,6 +1746,14 @@ export default class Viewer {
1676
1746
 
1677
1747
  }
1678
1748
 
1749
+ toggle_triangle_name(){
1750
+ this.model.settings.use_internal_node_name_for_triangles = !this.model.settings.use_internal_node_name_for_triangles
1751
+ this.render(this.hierarchy)
1752
+
1753
+ }
1754
+
1755
+
1756
+
1679
1757
  toggle_subsample(){
1680
1758
  this.model.settings.subsample_label = !this.model.settings.subsample_label
1681
1759
  var k = this.d3.zoomTransform(d3.select("#master_g" + this.uid).node()).k
@@ -2379,6 +2457,48 @@ export default class Viewer {
2379
2457
  })
2380
2458
  }
2381
2459
 
2460
+ get_color_label(d){
2461
+
2462
+ var acc = this.model.settings.style.color_accessor['leaf']
2463
+ var type_acc = this.model.settings.extended_data_type[acc]
2464
+
2465
+
2466
+ if (type_acc === 'color'){
2467
+
2468
+ var g = d.data.extended_informations[acc];
2469
+
2470
+ if (typeof g !== "undefined" ) {
2471
+ return g
2472
+ }
2473
+
2474
+
2475
+ }
2476
+
2477
+ else if (acc !== null){
2478
+
2479
+ var v = d.data.extended_informations[acc];
2480
+
2481
+ if (typeof v !== "undefined" ) {
2482
+
2483
+ if (type_acc == 'cat'){
2484
+
2485
+ var cs = this.container_object.api.get_color_scale(acc)
2486
+ return cs.get_color(v)
2487
+
2488
+ }
2489
+
2490
+ else{
2491
+ return this.model.settings.colorScale['leaf'](v)
2492
+ }
2493
+
2494
+
2495
+ }
2496
+
2497
+
2498
+ }
2499
+
2500
+ }
2501
+
2382
2502
  node_face_update(nodes){
2383
2503
 
2384
2504
  var on_screen_text_size = this.compute_node_font_size()
@@ -2409,6 +2529,10 @@ export default class Viewer {
2409
2529
  return d.data.name
2410
2530
  }
2411
2531
 
2532
+ if (this.model.settings.use_internal_node_name_for_triangles && d.data.name != ''){
2533
+ return d.data.name
2534
+ }
2535
+
2412
2536
  let l = d.data.leaves
2413
2537
 
2414
2538
  if (l.length <= 0){
@@ -2447,44 +2571,7 @@ export default class Viewer {
2447
2571
 
2448
2572
  if (!(d.children || d._children)){
2449
2573
 
2450
-
2451
- var acc = this.model.settings.style.color_accessor['leaf']
2452
- var type_acc = this.model.settings.extended_data_type[acc]
2453
-
2454
-
2455
- if (type_acc === 'color'){
2456
-
2457
- var g = d.data.extended_informations[acc];
2458
-
2459
- if (typeof g !== "undefined" ) {
2460
- return g
2461
- }
2462
-
2463
-
2464
- }
2465
-
2466
- else if (acc !== null){
2467
-
2468
- var v = d.data.extended_informations[acc];
2469
-
2470
- if (typeof v !== "undefined" ) {
2471
-
2472
- if (type_acc == 'cat'){
2473
-
2474
- var cs = this.container_object.api.get_color_scale(acc)
2475
- return cs.get_color(v)
2476
-
2477
- }
2478
-
2479
- else{
2480
- return this.model.settings.colorScale['leaf'](v)
2481
- }
2482
-
2483
-
2484
- }
2485
-
2486
-
2487
- }
2574
+ return this.get_color_label(d)
2488
2575
 
2489
2576
  }
2490
2577
 
@@ -2637,6 +2724,8 @@ export default class Viewer {
2637
2724
  .style('fill-opacity', 1e-6);
2638
2725
  }
2639
2726
 
2727
+
2728
+
2640
2729
  };
2641
2730
 
2642
2731