@@ -140,37 +140,40 @@ function select_by_points(points){
140
140
/**
141
141
* Highlight and jump to node in beadplot by sample accession number.
142
142
* @param {string } accn: accession number to search for
143
+ * @param {Boolean } reset_clusters_tree: when false, the cluster tree remain unchanged
143
144
*/
144
- function select_bead_by_accession ( accn ) {
145
+ function select_bead_by_accession ( accn , reset_clusters_tree = true ) {
145
146
// switch to cluster beadplot
146
147
var cid = accn_to_cid [ accn ] ;
147
148
148
149
if ( cid !== undefined ) {
149
- // if (d3.selectAll('.clicked').empty()) {
150
150
151
- d3 . selectAll ( "#svg-timetree > svg > g > rect:not(.clickedH)" ) . attr ( "class" , "not_SelectedCluster" ) ;
152
- var rect = d3 . selectAll ( "#svg-timetree > svg > g > rect:not(.clickedH)" )
153
- . filter ( function ( d ) { return ( d . cluster_idx === cid ) ; } )
154
- . attr ( "class" , "clicked" ) ;
151
+ if ( reset_clusters_tree === true ) {
152
+ d3 . selectAll ( "#svg-timetree > svg > g > rect:not(.clickedH)" ) . attr ( "class" , "not_SelectedCluster" ) ;
153
+ }
154
+
155
+ var rect = d3 . selectAll ( "#svg-timetree > svg > g > rect:not(.clickedH)" )
156
+ . filter ( function ( d ) { return ( d . cluster_idx === cid ) ; } )
157
+ . attr ( "class" , "clicked" ) ;
155
158
156
- d3 . select ( rect . nodes ( ) . pop ( ) ) . each ( function ( d ) {
157
- create_clusterH ( d , this ) ;
158
- } ) ;
159
+ d3 . select ( rect . nodes ( ) . pop ( ) ) . each ( function ( d ) {
160
+ create_clusterH ( d , this ) ;
161
+ } ) ;
159
162
160
- beadplot ( cid ) ;
163
+ beadplot ( cid ) ;
161
164
162
- var bead = d3 . selectAll ( "circle" ) . filter ( function ( d ) {
163
- return d . accessions . includes ( accn ) ;
164
- } ) ;
165
+ var bead = d3 . selectAll ( "circle" ) . filter ( function ( d ) {
166
+ return d . accessions . includes ( accn ) ;
167
+ } ) ;
165
168
166
- create_selection ( bead ) ;
167
- bead . node ( ) . scrollIntoView ( { block : "center" } ) ;
169
+ create_selection ( bead ) ;
170
+ bead . node ( ) . scrollIntoView ( { block : "center" } ) ;
168
171
169
- // Update information panel
170
- const datum = bead . datum ( ) ;
171
- gentable ( datum ) ;
172
- draw_region_distribution ( table ( datum . region ) ) ;
173
- gen_details_table ( datum ) ;
172
+ // Update information panel
173
+ const datum = bead . datum ( ) ;
174
+ gentable ( datum ) ;
175
+ draw_region_distribution ( table ( datum . region ) ) ;
176
+ gen_details_table ( datum ) ;
174
177
175
178
}
176
179
}
0 commit comments