-
Notifications
You must be signed in to change notification settings - Fork 44
Features
In Genoverse, a "feature" is anything to be drawn by a track - genes, variants, etc.
By default, features are drawn as rectangles, but the use of subFeatures
or 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.chr
will 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
labels
setting. 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'slegend
setting is enabled.
An HTML color code to be used when drawing the feature, using
CanvasRenderingContext2D.fillRect()
. Defaults totrack.color
.If
false
,fillRect
will 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
height
of 10 andmarginTop
of 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.
0
means the feature will be drawn at the top of the track's image.1
means the feature will be drawn atfeature.height
+track.featureMargin.bottom
away from the top of the track's image.2
means 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.bump
is set tofalse
, that every feature for the track has ay
property, 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.subFeatures
should be an array of feature-like objects (i.e. using the properties documented on this page) whosestart
andend
are within the bounds of thefeature
'sstart
andend
.feature.subFeatures
gets sorted from lowest to higheststart
.Sub features should not have a
height
greater than their feature'sheight
, but can have one which is smaller.Sub features are drawn within the bounds of the
feature
, vertically-aligned on its midpoint (i.e. iffeature.height
= 10 andsubFeature.height
= 6, the sub feature will be drawn from 2px below the top of the feature to 2px above its bottom: the middle 6px), and are visually are joined together according to thetrack.subFeatureJoinStyle
setting.Note that sub features do not get bumped within a feature.
An HTML color code to be used when drawing the feature's sub feature joins, if it has
subFeatures
, andtrack.subFeatureJoinStyle
is notfalse
. Defaults totrack.color
.
Affects the way
track.subFeatureJoinStyle
draws joins.If a track is
stranded
, features ofstrand = -1
andstrand = 1
will be split into two separate tracks.
If truthy, track.view.decorateFeature() is called for the feature.