Skip to content

Commit

Permalink
get name searches to show the relevant track if necessary again
Browse files Browse the repository at this point in the history
  • Loading branch information
rbuels committed Jan 16, 2013
1 parent e56d13d commit 9726c76
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion bin/generate-names.pl
Expand Up @@ -211,7 +211,7 @@ =head1 OPTIONS
}

# store the list of tracks that have names
$nameStore->set( 'JBROWSE_TRACKS_WITH_NAMES', \@tracksWithNames );
$nameStore->{meta}{track_names} = \@tracksWithNames;

# set up the name store in the trackList.json
$gdb->modifyTrackList( sub {
Expand Down
14 changes: 8 additions & 6 deletions src/JBrowse/Browser.js
Expand Up @@ -1290,6 +1290,11 @@ Browser.prototype.showRegion = function( location ) {
start: location.start - flank,
end: location.end + flank
});

// if the location has a track associated with it, show it
if( location.tracks ) {
this.showTracks( location.tracks );
}
};

/**
Expand Down Expand Up @@ -1398,7 +1403,7 @@ Browser.prototype.navigateToLocation = function( location ) {
* view location to any that match.
*/
Browser.prototype.searchNames = function( /**String*/ loc ) {
var brwsr = this;
var thisB = this;
this.nameStore.query({ name: loc })
.then( function( nameMatches ) {

Expand Down Expand Up @@ -1435,16 +1440,13 @@ Browser.prototype.searchNames = function( /**String*/ loc ) {
if( goingTo.location ) {

//go to location, with some flanking region
brwsr.showRegion( goingTo.location );

// var tracks = (brwsr.names.extra||{})[goingTo][ post1_4 ? 1 : 0 ]];
// brwsr.showTracks(brwsr.names.extra[goingTo][ post1_4 ? 1 : 0 ]]);
thisB.showRegion( goingTo.location );
}
// otherwise, pop up a dialog with a list of the locations to choose from
else if( goingTo.multipleLocations ) {
new LocationChoiceDialog(
{
browser: brwsr,
browser: thisB,
locationChoices: goingTo.multipleLocations,
title: 'Choose '+goingTo.name+' location',
prompt: '"'+goingTo.name+'" is found in multiple locations. Please choose a location to view.'
Expand Down
1 change: 1 addition & 0 deletions src/JBrowse/Model/Location.js
Expand Up @@ -13,6 +13,7 @@ return Util.fastDeclare(
this.start = args.start;
this.end = args.end;
this.strand = args.strand;
this.tracks = args.tracks;
}
},
toString: function() {
Expand Down
3 changes: 2 additions & 1 deletion src/JBrowse/Store/Names/Hash.js
Expand Up @@ -52,7 +52,8 @@ return declare( HashStore,
item.location = new Location({
ref: nameRecord[3],
start: parseInt( nameRecord[4] ),
end: parseInt( nameRecord[5] )
end: parseInt( nameRecord[5] ),
tracks: [ (this.track_names||{})[ nameRecord[1] ] ]
});
} else {
item.name = nameRecord;
Expand Down
3 changes: 2 additions & 1 deletion src/perl5/Bio/JBrowse/HashStore.pm
Expand Up @@ -76,7 +76,8 @@ sub DESTROY {
CORE::open my $out, '>', $meta_path or die "$! writing $meta_path";
$out->print( JSON::to_json(
{
hash_bits => $self->{hash_bits}
hash_bits => $self->{hash_bits},
%{ $self->{meta} || {} }
}
)) or die "$! writing $meta_path";
}
Expand Down

0 comments on commit 9726c76

Please sign in to comment.