-
Notifications
You must be signed in to change notification settings - Fork 1
Features
In Genoverse, a "feature" is anything to be drawn by a track - genes, variants, etc.
By default, features are drawn as rectangles, but custom Genoverse.Track.View extensions can change this.
A feature is represented by a JavaScript object with the following properties:
The genomic position for the start of the feature
The genomic position for the end of the feature
The chromosome for the feature. If missing, the current value of
genoverse.chrwill be used.
A unique string or number identifying the feature. If missing, one will be generated as a hash of
JSON.stringify(feature).
A string which will be displayed along (depending on track setting) with the feature, depending on the track's
labelssetting. New line (\n) characters in the string will be respected when the track is drawn.
A string which will be displayed in a
legend, if the track'slegendsetting is enabled.
An HTML color code to be used when drawing the feature, using
CanvasRenderingContext2D.fillRect(). Defaults totrack.color.If
false,fillRectwill not be used to draw the feature.
An HTML color code to be used when drawing the feature's border, using
CanvasRenderingContext2D.strokeRect()By default, features do not have borders.
If
true,CanvasRenderingContext2D.clearRect()is used while drawing features, betweenfillRect()andstrokeRect()
An HTML color code to be used when drawing the feature's label. Defaults to the first truthy value of
track.fontColor,feature.color, ortrack.color.
A number of pixels for the height of the feature's rectangle. Defaults to
track.featureHeight
A number of pixels to be left as space between the top of the feature and bottom of the vertical alignment above that feature. Defaults to
track.featureMargin.top.For example, if a track has bumping enabled, and all its features have
heightof 10 andmarginTopof 5, features will be drawn with y positions starting at 5, 20 ((bump level 1 = 5 + 10) + 5), 35 ((bump level 2 = 2 * (5 + 10)) + 5), etc.
Can be used to fix the vertical position of a feature within a track.
0means the feature will be drawn at the top of the track's image.1means the feature will be drawn atfeature.height+track.featureMargin.bottomaway from the top of the track's image.2means the feature will be drawn at 2 * (feature.height+track.featureMargin.bottom)away from the top of the track's image, etc.If this property is used, it is recommended that
track.bumpis set tofalse, that every feature for the track has ayproperty, and that every feature for the track is the same height. If any of these things is not true, it is highly likely that the features will be drawn poorly, e.g. overlapping each other or with big unnecessary vertical gaps.
A feature can be split into sub features, for example exons in a transcript. If this is the case,
feature.subFeaturesshould be an array of feature-like objects (i.e. using the properties documented on this page) whosestartandendare within the bounds of thefeature'sstartandend.Sub features should not have a
heightgreater than their feature'sheight, but can have one which is smaller.Sub features are joined together according to the
track.subFeatureJoinStylesetting.
An HTML color code to be used when drawing the feature's sub feature joins, if it has
subFeatures, andtrack.subFeatureJoinStyleis notfalse. Defaults totrack.color.
Affects the way
track.subFeatureJoinStyledraws joins.If a track is
stranded, features ofstrand = -1andstrand = 1will be split into two separate tracks.
If truthy, track.view.decorateFeature() is called for the feature.