Skip to content

Commit

Permalink
Add read cloud function to paired reads track
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Oct 31, 2018
1 parent 5561cf5 commit 007718e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 8 deletions.
23 changes: 22 additions & 1 deletion src/JBrowse/View/FeatureGlyph/PairedAlignment.js
Expand Up @@ -45,7 +45,7 @@ renderConnector( context, fRect ) {
}
},

_defaultConfig: function() {
_defaultConfig() {
return this._mergeConfigs(
dojo.clone( this.inherited(arguments) ),
{
Expand Down Expand Up @@ -128,6 +128,27 @@ _defaultConfig: function() {
}
}
);
},
layoutFeature(viewArgs, layout, feature) {
var rect = this.inherited(arguments);
if (!rect) {
return rect;
}
if(this.config.readCloud) {
if(feature.pairedFeature()) {
var tlen = feature.f1.get('template_length')
var t = Math.abs(tlen)

// need to set the top of the inner rect
rect.rect.t = t / (this.config.scaleFactor||1);
rect.t = t / (this.config.scaleFactor||1);
} else {
rect.t = 0
rect.rect.t = 0
}
}

return rect;
}

});
Expand Down
29 changes: 22 additions & 7 deletions src/JBrowse/View/Track/PairedReads.js
Expand Up @@ -12,14 +12,29 @@ define( [
) {

return declare(CanvasFeatures, {
_defaultConfig: function() {
return Util.deepUpdate(lang.clone(this.inherited(arguments)), {
glyph: 'JBrowse/View/FeatureGlyph/PairedAlignment',
maxFeatureScreenDensity: 60,
style: {
_defaultConfig: function() {
return Util.deepUpdate(lang.clone(this.inherited(arguments)), {
glyph: 'JBrowse/View/FeatureGlyph/PairedAlignment',
maxFeatureScreenDensity: 60,
readCloud: false,
style: {
showLabels: false
}
});
}
});
},
// override getLayout to access addRect method
_getLayout: function() {
var layout = this.inherited(arguments);
if(this.config.readCloud) {
layout = declare.safeMixin(layout, {
addRect: function() {
this.pTotalHeight = this.maxHeight;
return 0;
}
});
}
return layout;
}

});
});

0 comments on commit 007718e

Please sign in to comment.