Skip to content

Commit

Permalink
Add toggle to SNPCoverage
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Oct 24, 2018
1 parent 78b84ad commit 7ccdf15
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 2 deletions.
24 changes: 24 additions & 0 deletions src/JBrowse/View/FeatureGlyph.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,35 @@ return declare( Component, {
},

mouseoverFeature: function( context, fRect ) {
var feature = fRect.f;
this.renderFeature( context, fRect );

// highlight the feature rectangle if we're moused over
context.fillStyle = this.getStyle( fRect.f, 'mouseovercolor' );

context.fillRect( fRect.rect.l, fRect.t, fRect.rect.w, fRect.rect.h );
if(this.config.style.strandInlay) {
var arrowWidth = 3;
var top = fRect.t;
var height = fRect.rect.h;
var left = fRect.rect.l;
var width = fRect.rect.w;
if(feature.get('strand') === 1) {
context.beginPath();
context.moveTo(left+width, top)
context.lineTo(left+width+arrowWidth, top+height/2)
context.lineTo(left+width, top+height)
context.closePath()
context.fill()
} else if(feature.get('strand') === -1) {
context.beginPath();
context.moveTo(left, top)
context.lineTo(left-arrowWidth, top+height/2)
context.lineTo(left, top+height)
context.closePath()
context.fill()
}
}
},

/**
Expand Down
2 changes: 1 addition & 1 deletion src/JBrowse/View/FeatureGlyph/Box.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ return declare([ FeatureGlyph, FeatureLabelMixin], {
context.fillStyle = bgcolor;
context.fillRect( left, top, Math.max(1,width), height );
if(this.config.style.strandInlay && width > 1) {
var arrowWidth = 8
var arrowWidth = 3
if(feature.get('strand') === 1) {
context.beginPath();
context.moveTo(left+width, top)
Expand Down
9 changes: 9 additions & 0 deletions src/JBrowse/View/Track/Alignments2.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,15 @@ return declare( [ CanvasFeatureTrack, AlignmentsMixin ], {
}


displayOptions.push({
label: 'View coverage',
type: 'dijit/RadioMenuItem',
group: 'g2',
onClick: function(event) {
thisB.config.type = 'JBrowse/View/Track/SNPCoverage'
thisB.browser.publish('/jbrowse/v1/v/tracks/replace', [thisB.config]);
}
});
displayOptions.push({
label: 'View normal',
type: 'dijit/RadioMenuItem',
Expand Down
16 changes: 15 additions & 1 deletion src/JBrowse/View/Track/SNPCoverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,21 @@ return declare( [WiggleXY, AlignmentsMixin],
},

_trackMenuOptions: function() {
return all([ this.inherited(arguments), this._alignmentsFilterTrackMenuOptions() ])
var thisB = this;
var displayOptions = [];


displayOptions.push({
label: 'View alignments',
type: 'dijit/RadioMenuItem',
group: 'g2',
onClick: function(event) {
thisB.config.type = 'JBrowse/View/Track/Alignments2'
thisB.browser.publish('/jbrowse/v1/v/tracks/replace', [thisB.config]);
}
});

return all([ this.inherited(arguments), this._alignmentsFilterTrackMenuOptions(), displayOptions ])
.then( function( options ) {
var o = options.shift();
options.unshift({ type: 'dijit/MenuSeparator' } );
Expand Down

0 comments on commit 7ccdf15

Please sign in to comment.