Skip to content

Commit

Permalink
Add unprocessed transcript code
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Oct 26, 2018
1 parent 6c6e555 commit ec638ea
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/JBrowse/View/FeatureGlyph/Gene.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ define([
'dojo/_base/lang',
'dojo/_base/array',
'JBrowse/View/FeatureGlyph/Box',
'JBrowse/View/FeatureGlyph/UnprocessedTranscript',
'JBrowse/View/FeatureGlyph/ProcessedTranscript'
],
function(
declare,
lang,
array,
BoxGlyph,
UnprocessedTranscript,
ProcessedTranscriptGlyph
) {

Expand All @@ -20,6 +22,7 @@ _defaultConfig: function() {
this.inherited(arguments),
{
transcriptType: 'mRNA',
noncodingType: ['ncRNA','transcript', 'lnc_RNA', 'lncRNA'],
style: {
transcriptLabelFont: 'normal 10px Univers,Helvetica,Arial,sans-serif',
transcriptLabelColor: 'black',
Expand All @@ -33,6 +36,9 @@ _defaultConfig: function() {
_boxGlyph: function() {
return this.__boxGlyph || ( this.__boxGlyph = new BoxGlyph({ track: this.track, browser: this.browser, config: this.config }) );
},
_ntGlyph: function() {
return this.__ntGlyph || ( this.__ntGlyph = new UnprocessedTranscript({ track: this.track, browser: this.browser, config: this.config }) );
},
_ptGlyph: function() {
return this.__ptGlyph || ( this.__ptGlyph = new ProcessedTranscriptGlyph({ track: this.track, browser: this.browser, config: this.config }) );
},
Expand Down Expand Up @@ -67,10 +73,11 @@ _getFeatureRectangle( viewArgs, feature ) {
fRect.r = -Infinity;

var transcriptType = this.getConfForFeature( 'transcriptType', feature );
var noncodingType = this.getConfForFeature( 'noncodingType', feature );
for( var i = 0; i < subfeatures.length; i++ ) {
var subRect = ( subfeatures[i].get('type') == transcriptType
? this._ptGlyph()
: this._boxGlyph()
: (noncodingType.includes(subfeatures[i].get('type')) ? this._ntGlyph() : this._boxGlyph())
)._getFeatureRectangle( subArgs, subfeatures[i] );

padding = i == subfeatures.length-1 ? 0 : 1;
Expand Down
30 changes: 30 additions & 0 deletions src/JBrowse/View/FeatureGlyph/UnprocessedTranscript.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
define([
'dojo/_base/declare',
'dojo/_base/Color',
'JBrowse/View/FeatureGlyph/Segments'
],
function(
declare,
Color,
Segments
) {

return declare( Segments, {
_defaultConfig: function() {
return this._mergeConfigs(this.inherited(arguments), {
style: {
unprocessedTranscriptColor: 'red'
}
});
},
renderBox: function( context, viewInfo, feature, top, overallHeight, parentFeature, style ) {
style = style || lang.hitch( this, 'getStyle' );
return this.inherited(arguments, [context, viewInfo, feature, top, overallHeight, parentFeature, function(feat, attr) {
if(attr == 'color')
return style(parentFeature, 'unprocessedTranscriptColor')
return style(feat, attr)
}])
}

});
});

0 comments on commit ec638ea

Please sign in to comment.