@@ -728,7 +728,7 @@ var hivtrace_cluster_network_graph = function (
728
728
}
729
729
730
730
cluster_options [ "today" ] = self . today ;
731
-
731
+ cluster_options [ "auto_expand_single_cluster" ] = true ;
732
732
cluster_view = hivtrace_cluster_network_graph (
733
733
filtered_json ,
734
734
"#" + random_content_id ,
@@ -763,7 +763,7 @@ var hivtrace_cluster_network_graph = function (
763
763
cluster_view . handle_attribute_opacity ( self . colorizer [ "opacity_id" ] ) ;
764
764
}
765
765
766
- cluster_view . expand_cluster_handler ( cluster_view . clusters [ 0 ] , true ) ;
766
+ // cluster_view.expand_cluster_handler(cluster_view.clusters[0], true);
767
767
} else {
768
768
return new_tab_content . attr ( "id" ) ;
769
769
}
@@ -3334,6 +3334,19 @@ var hivtrace_cluster_network_graph = function (
3334
3334
} ) ;
3335
3335
//self.clusters
3336
3336
3337
+ if (
3338
+ network . check_network_option (
3339
+ options ,
3340
+ "auto_expand_single_cluster" ,
3341
+ false ,
3342
+ true
3343
+ )
3344
+ ) {
3345
+ if ( self . clusters . length == 1 ) {
3346
+ self . clusters [ 0 ] . collapsed = false ;
3347
+ }
3348
+ }
3349
+
3337
3350
self . update ( ) ;
3338
3351
}
3339
3352
@@ -4807,6 +4820,55 @@ var hivtrace_cluster_network_graph = function (
4807
4820
offset += 18 ;
4808
4821
}
4809
4822
4823
+ if (
4824
+ self . legend_multiple_sequences &&
4825
+ self . rendered_object_counts &&
4826
+ self . rendered_object_counts [ "nodes" ] > 0
4827
+ ) {
4828
+ self . legend_svg
4829
+ . append ( "g" )
4830
+ . classed ( "hiv-trace-legend multi_sequence" , true )
4831
+ . attr ( "transform" , "translate(0," + offset + ")" )
4832
+ . append ( "circle" )
4833
+ . attr ( "cx" , "8" )
4834
+ . attr ( "cy" , "-4" )
4835
+ . attr ( "r" , "8" )
4836
+ . style ( "fill" , "none" ) ;
4837
+ self . legend_svg
4838
+ . append ( "g" )
4839
+ . classed ( "hiv-trace-legend" , true )
4840
+ . attr ( "transform" , "translate(20," + offset + ")" )
4841
+ . append ( "text" )
4842
+ . text ( "Represents >1 sequence" ) ;
4843
+ offset += 24 ;
4844
+ }
4845
+
4846
+ if (
4847
+ self . rendered_object_counts &&
4848
+ self . rendered_object_counts . has_hatching
4849
+ ) {
4850
+ self . legend_svg
4851
+ . append ( "g" )
4852
+ . classed ( "hiv-trace-legend" , true )
4853
+ . attr ( "transform" , "translate(0," + offset + ")" )
4854
+ . append ( "circle" )
4855
+ . attr ( "cx" , "8" )
4856
+ . attr ( "cy" , "-4" )
4857
+ . attr ( "r" , "8" )
4858
+ . classed ( "legend" , true )
4859
+ . style (
4860
+ "fill" ,
4861
+ "url(#" + self . generate_cross_hatch_pattern ( "#ccc" ) + ")"
4862
+ ) ;
4863
+ self . legend_svg
4864
+ . append ( "g" )
4865
+ . classed ( "hiv-trace-legend" , true )
4866
+ . attr ( "transform" , "translate(20," + offset + ")" )
4867
+ . append ( "text" )
4868
+ . text ( "Contains sequences in >1 cluster/subcluster" ) ;
4869
+ offset += 24 ;
4870
+ }
4871
+
4810
4872
if ( self . edge_legend ) {
4811
4873
self . legend_svg
4812
4874
. append ( "g" )
@@ -5982,8 +6044,17 @@ var hivtrace_cluster_network_graph = function (
5982
6044
update_network_string ( rendered_nodes . size ( ) , link . size ( ) ) ;
5983
6045
}
5984
6046
6047
+ self . rendered_object_counts = {
6048
+ nodes : rendered_nodes . size ( ) ,
6049
+ edges : link . size ( ) ,
6050
+ clusters : rendered_clusters . size ( ) ,
6051
+ has_hatching : false ,
6052
+ } ;
6053
+
5985
6054
rendered_nodes . each ( function ( d ) {
5986
6055
draw_a_node ( this , d ) ;
6056
+ self . rendered_object_counts . has_hatching =
6057
+ self . rendered_object_counts . has_hatching || node_multiple_membership ( d ) ;
5987
6058
} ) ;
5988
6059
5989
6060
rendered_clusters . each ( function ( d ) {
@@ -6144,9 +6215,13 @@ var hivtrace_cluster_network_graph = function (
6144
6215
return 4 * r * r ;
6145
6216
}
6146
6217
6218
+ function node_multiple_membership ( n ) {
6219
+ return n [ "multiple_membership" ] ;
6220
+ }
6221
+
6147
6222
function node_color ( d ) {
6148
6223
var hms = ( d , c ) => {
6149
- if ( d [ "multiple_membership" ] ) {
6224
+ if ( node_multiple_membership ( d ) ) {
6150
6225
return "url(#" + self . generate_cross_hatch_pattern ( c ) + ")" ;
6151
6226
}
6152
6227
return c ;
0 commit comments