Skip to content

Commit

Permalink
WIP, but the region highlighting needs a more sophisticated event fra…
Browse files Browse the repository at this point in the history
…mework in jbrowse to start working
  • Loading branch information
rbuels committed Mar 8, 2012
1 parent 236dd1c commit 32f8c80
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
defaultTracks: "DNA,gene,mRNA,noncodingRNA",
queryParams: queryParams,
location: queryParams.loc,
highlight: queryParams.highlight,
tracks: queryParams.tracks,
show_nav: queryParams.nav,
show_tracklist: queryParams.tracklist,
Expand Down
9 changes: 8 additions & 1 deletion js/Browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,14 @@ Browser.prototype.initialize = function() {
this.origTracklist = this.params.defaultTracks;
}

// load our ref seqs
var brwsr = this;
Util.maybeLoad(this.params.refSeqs.url, this.params.refSeqs,
function(o) {
brwsr.addRefseqs(o);
});

// load our tracks
for (var i = 0; i < this.params.tracklists.length; i++) {
(function(tracklist) {
Util.maybeLoad(tracklist.url,
Expand All @@ -106,6 +108,11 @@ Browser.prototype.initialize = function() {
});
})(this.params.tracklists[i]);
}

// set a highlighted region, if any was passed
if( this.params.highlight ) {
this.highlightRegion( this.params.highlight );
}
};

/**
Expand Down Expand Up @@ -496,7 +503,7 @@ Browser.prototype.highlightRegion = function(loc) {

// Capture location for highlighting DNA sequence.
// Tracks are initialized by one of the deferred functions!
loc = Util.parseLocString(loc);
loc = Util.parseLocString(loc );
if( !loc || !loc.ref || loc.start === undefined || loc.start === undefined )
return;

Expand Down
3 changes: 1 addition & 2 deletions js/SequenceTrack.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ function SequenceTrack(trackMeta, refSeq, browserParams) {
this.url = Util.resolveUrl(trackMeta.sourceUrl,
Util.fillTemplate(trackMeta.config.urlTemplate,
{'refseq': refSeq.name}) );
this.hilightLoc = {ref: null, start:-1, end:-1};

}

Expand Down Expand Up @@ -114,7 +113,7 @@ SequenceTrack.prototype.complement = (function() {

SequenceTrack.prototype.highlightSeq = function ( start, end, seq ) {
var container = document.createElement("div"),
hloc = this.hilightLoc;
hloc = this.hilightLoc;

if( hloc && hloc.ref == this.refSeq.name && hloc.start < end && hloc.end > start ) {
// start, end coords are interbase (half-open intervals)
Expand Down

0 comments on commit 32f8c80

Please sign in to comment.