Skip to content

Commit

Permalink
make js hash store keep metadata in this.meta
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuels committed Jan 17, 2013
1 parent 6f924fb commit 5b2e69e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/JBrowse/Store/Hash.js
Expand Up @@ -24,6 +24,8 @@ return declare( null, {
target: url
});

this.meta = {};

// this.ready is a Deferred that will be resolved when we have
// read the meta.json file with the params of this hashstore
this.ready = this._readMeta();
Expand All @@ -33,8 +35,8 @@ return declare( null, {
var thisB = this;
return this.bucketStore.get( 'meta.json' )
.then( function( meta ) {
dojo.mixin( thisB, meta || {} );
thisB.hash_hex_characters = Math.ceil( thisB.hash_bits / 4 );
dojo.mixin( thisB.meta, meta || {} );
thisB.meta.hash_hex_characters = Math.ceil( thisB.meta.hash_bits / 4 );
});
},

Expand Down Expand Up @@ -68,7 +70,7 @@ return declare( null, {
// zero-pad the hex string to be 8 chars if necessary
while( hex.length < 8 )
hex = '0'+hex;
hex = hex.substr( 8-this.hash_hex_characters );
hex = hex.substr( 8-this.meta.hash_hex_characters );
var dirpath = [];
for( var i = 0; i < hex.length; i += 3 ) {
dirpath.push( hex.substring( i, i+3 ) );
Expand Down
2 changes: 1 addition & 1 deletion src/JBrowse/Store/Names/Hash.js
Expand Up @@ -53,7 +53,7 @@ return declare( HashStore,
ref: nameRecord[3],
start: parseInt( nameRecord[4] ),
end: parseInt( nameRecord[5] ),
tracks: [ (this.track_names||{})[ nameRecord[1] ] ]
tracks: [ ((this.meta||{}).track_names||{})[ nameRecord[1] ] ]
});
} else {
item.name = nameRecord;
Expand Down

0 comments on commit 5b2e69e

Please sign in to comment.