Skip to content

Commit

Permalink
add whether the e hash store is lowercasing its keys to the store met…
Browse files Browse the repository at this point in the history
…adata
  • Loading branch information
rbuels committed Jan 17, 2013
1 parent 566fc3c commit b470e21
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bin/generate-names.pl
Expand Up @@ -205,6 +205,8 @@ =head1 OPTIONS

# store the list of tracks that have names
$nameStore->{meta}{track_names} = \@tracksWithNames;
# record the fact that all the keys are lowercased
$nameStore->{meta}{lowercase_keys} = 1;


# set up the name store in the trackList.json
Expand Down
9 changes: 9 additions & 0 deletions src/JBrowse/Store/Names/Hash.js
Expand Up @@ -112,6 +112,11 @@ return declare( HashStore,
// remove trailing asterisks from query.name
var thisB = this;
var name = ( query.name || '' ).toString();

// lowercase the name if the store is all-lowercase
if( this.meta.lowercase_keys )
name = name.toLowerCase();

var trailingStar = /\*$/;
if( trailingStar.test( name ) ) {
name = name.replace( trailingStar, '' );
Expand All @@ -130,6 +135,10 @@ return declare( HashStore,
},

get: function( id ) {
// lowercase the id if the store is all-lowercase
if( this.meta.lowercase_keys )
id = id.toLowerCase();

return this._getEntry( id )
.then( function( bucket ) {
var nameRec = (bucket.exact||[])[0];
Expand Down

0 comments on commit b470e21

Please sign in to comment.