Skip to content

Commit

Permalink
added masking function to getFeatures
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmirob committed Mar 1, 2013
1 parent 5fefdc2 commit a254111
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/JBrowse/View/Track/WiggleBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ return declare( [CanvasTrack,ExportMixin], {
end: rightBase+1
},
function(f) { features.push(f); },
dojo.hitch( this, function() {
dojo.hitch( this, function( args ) {

// if the block has been freed in the meantime,
// don't try to render
Expand All @@ -222,6 +222,9 @@ return declare( [CanvasTrack,ExportMixin], {

this._preDraw( scale, leftBase, rightBase, block, c, features, featureRects, dataScale );
this._drawFeatures( scale, leftBase, rightBase, block, c, pixels, dataScale );
if ( args && args.spans ) {
this._maskBySpans( scale, leftBase, rightBase, block, c, pixels, dataScale, args.spans );
}
this._postDraw( scale, leftBase, rightBase, block, c, features, featureRects, dataScale );

this._makeScoreDisplay( scale, leftBase, rightBase, block, c, features, featureRects, pixels );
Expand Down Expand Up @@ -289,6 +292,10 @@ return declare( [CanvasTrack,ExportMixin], {
_drawFeatures: function( scale, leftBase, rightBase, block, canvas, features, featureRects ) {
},

// If we are making a boolean track, this will be called. Overwrite.
_maskBySpans: function( scale, leftBase, canvas, spans, pixels ) {
},

_postDraw: function() {
},

Expand All @@ -302,6 +309,8 @@ return declare( [CanvasTrack,ExportMixin], {
var score = f.get('score');
for( var j = Math.round(fRect.l); j < jEnd; j++ ) {
if ( pixelValues[j] && pixelValues[j]['lastUsedStore'] == store ) {
/* Note: if the feature is from a different store, the condition should fail,
* and we will add to the value, rather than adjusting for overlap */
pixelValues[j]['score'] = Math.max( pixelValues[j]['score'], score );
}
else if ( pixelValues[j] ) {
Expand Down

0 comments on commit a254111

Please sign in to comment.