File tree 2 files changed +16
-3
lines changed
2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,14 @@ function create_clusterH(obj, obj_2) {
52
52
. raise ( ) ;
53
53
}
54
54
55
+ /**
56
+ * Returns true if the string is an accession number
57
+ */
58
+ function is_accn ( string ) {
59
+ const accn_pat = / ^ E P I _ I S L _ [ 0 - 9 ] + $ / i; // case-insensitive
60
+ return accn_pat . test ( string ) ;
61
+ }
62
+
55
63
/**
56
64
* Rectangular layout of tree, update nodes in place with x,y coordinates
57
65
* @param {object } root
@@ -275,6 +283,11 @@ function draw_clusters(tips) {
275
283
d3 . selectAll ( "rect.clickedH" ) . remove ( ) ;
276
284
277
285
beadplot ( d . cluster_idx ) ;
286
+
287
+ if ( is_accn ( $ ( '#search-input' ) . val ( ) ) ) {
288
+ $ ( '#search-input' ) . val ( '' ) ;
289
+ }
290
+
278
291
search ( beaddata ) ;
279
292
280
293
// reset all rectangles to high transparency
Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ function select_bead_by_accession(accn, reset_clusters_tree = true) {
151
151
if ( reset_clusters_tree === true ) {
152
152
d3 . selectAll ( "#svg-timetree > svg > g > rect:not(.clickedH)" ) . attr ( "class" , "not_SelectedCluster" ) ;
153
153
}
154
-
154
+
155
155
var rect = d3 . selectAll ( "#svg-timetree > svg > g > rect:not(.clickedH)" )
156
156
. filter ( function ( d ) { return ( d . cluster_idx === cid ) ; } )
157
157
. attr ( "class" , "clicked" ) ;
@@ -237,12 +237,12 @@ function get_autocomplete_source_fn(accn_to_cid) {
237
237
238
238
function search ( beaddata ) {
239
239
var query = $ ( '#search-input' ) . val ( ) ;
240
- const accn_pat = / ^ E P I _ I S L _ [ 0 - 9 ] + $ / i ; // case-insensitive
240
+
241
241
// FIX ME: Accn search returning 0 beads
242
242
const points = find_beads_points ( beaddata )
243
243
. filter ( point => point . labels . some ( label => label . includes ( query ) ) ) ;
244
244
// TODO: Make select_bead_by_* use find_beads_points result
245
- accn_pat . test ( query ) ? select_bead_by_accession ( query ) : select_beads_by_substring ( query ) ;
245
+ is_accn ( query ) ? select_bead_by_accession ( query ) : select_beads_by_substring ( query ) ;
246
246
const stats = search_stats . update ( {
247
247
query,
248
248
current_point : 1 ,
You can’t perform that action at this time.
0 commit comments