Skip to content

Commit

Permalink
display gene subfeatures even if topLevelFeatures is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
abretaud committed Mar 18, 2019
1 parent 573321f commit 551c648
Showing 1 changed file with 34 additions and 7 deletions.
41 changes: 34 additions & 7 deletions src/JBrowse/View/Track/HTMLFeatures.js
Expand Up @@ -702,14 +702,36 @@ define( [
*/
addFeatureToBlock: function( feature, uniqueId, block, scale, labelScale, descriptionScale,
containerStart, containerEnd ) {
var featDiv = this.renderFeature( feature, uniqueId, block, scale, labelScale, descriptionScale,
containerStart, containerEnd );
if( ! featDiv )
return null;
var thisB = this;
if( feature.get('type') == 'gene') {
var d = dojo.create('div');
var feats = feature.get('subfeatures');
if(!feats) {
return null;
}
feats.forEach(function( feat ) {
if (!thisB._featureIsRendered(uniqueId + '_' + feat.get('id'))) {
featDiv = thisB.renderFeature(feat, uniqueId + '_' + feat.get('id'), block, scale, labelScale, descriptionScale, containerStart, containerEnd);
d.appendChild( featDiv );
}
});
block.domNode.appendChild( d );
if( this.config.style.centerChildrenVertically ) {
d.childNodes.forEach(function( featDiv ) {
thisB._centerChildrenVertically( featDiv );
});
}
return d;
} else {
var featDiv = this.renderFeature( feature, uniqueId, block, scale, labelScale, descriptionScale,
containerStart, containerEnd );
if( ! featDiv )
return null;

block.domNode.appendChild( featDiv );
if( this.config.style.centerChildrenVertically )
this._centerChildrenVertically( featDiv );
block.domNode.appendChild( featDiv );
if( this.config.style.centerChildrenVertically )
this._centerChildrenVertically( featDiv );
}
return featDiv;
},

Expand Down Expand Up @@ -1173,6 +1195,11 @@ define( [
this.renderSubfeature( feature, featDiv,
subfeatures[i],
displayStart, displayEnd, block );
var subfeature = subfeatures[i];
var subtype = subfeature.get('type');
if(subtype == 'mRNA'){
this.handleSubFeatures(subfeature,featDiv,displayStart,displayEnd,block);
}
}
}
},
Expand Down

0 comments on commit 551c648

Please sign in to comment.