new Feature(viewer, options, meta)
Create a new feature.
Name | Type | Description |
---|---|---|
viewer |
Viewer |
The viewer |
options |
Object |
Attributes used to create the feature |
meta |
Object |
optional
User-defined Meta data to add to the feature. |
Extends
Members
-
canvasCanvas
-
Get the canvas.
-
codonStartString
-
Get or set the Codon start (Default: 1)
-
colorString
-
Get or set the color. TODO: reference COLOR class
-
contigContig
-
Get or set the Contig. The Contig can be set with a Contig object or with the name of a Contig.
-
decorationString
-
Get the decoration.
-
extractedFromSequenceBoolean
-
Get or set the extractedFromSequence. If true, this feature was generated directly from the sequence and will not be saved when exporting to JSON.
-
favoriteString
-
Get or set the feature as a favorite.
-
fullLengthNumber
-
Get the length of the feature in basepair (bp) using only the start and stop positions. This is the same as the range length. To get the length of the feature based on sub locations, use length.
-
fullSeqNumber
-
Get the sequence of the feature using only the start and stop positions (ignores locations). To get sequence of the feature based on sub locations, use seq.
-
geneticCodeString
-
Get or set the Genetic code used for translation. If no genetic code is set, the default for the map will be used.
-
hasLocationsNumber
-
Return true if the feature has multiple locations (i.e more than one).
-
labelString
-
Get or set the feature label.
-
layoutLayout
-
Get the layout.
-
legendLegendItem
-
Alias for legendItem.
-
legendItemLegendItem
-
Get or set the LegendItem. The LegendItem can be set with a LegendItem object or with the name of a legenedItem.
-
lengthNumber
-
Get the length of the feature in basepair (bp). If the feature has locations, the length is calculated as the sum of the length of each location. Otherwise, the length is the same as the range (i.e. stop - start + 1). To get the full length of the feature on the map, use fullLength.
-
locationsNumber
-
Get or set the locations of the feature in basepair (bp). An array of arrays where each sub-array contains the start and stop positions (e.g. [[1, 100], [200, 300]]). All start and stop positions are assumed to be going in a clockwise direction. Locations shouldn't overlap the origin but can overlap each other (e.g. due to ribosomal slippage). Locations are ignored unless there is more than one location. Validations:
- that each array has 2 numbers
- start must be less than stop TODO:
- order of locations should be checked?
-
mapRangeRange
-
Get or set the range of the feature with respect to its contig. All ranges are assumed to be going in a clockwise direction.
-
mapStartNumber
-
Get or set the start position of the feature in basepair (bp). All start and stop positions are assumed to be going in a clockwise direction. Setting the mapStart position does not work if the feature has multiple locations.
-
mapStopNumber
-
Get or set the stop position of the feature in basepair (bp). All start and stop positions are assumed to be going in a clockwise direction. Setting the mapStop position does not work if the feature has multiple locations.
-
metaBoolean
-
Get or Set the meta data of this object. See the meta data tutorial for details.
-
nameString
-
Get or set the name via the Label.
-
qualifiersqualifiers
-
Get or set the qualifiers
-
rangeRange
-
Get or set the range of the feature. All ranges are assumed to be going in a clockwise direction.
-
scoreNumber
-
Get the Score
-
seq
-
Returns the DNA sequence for the feature. If the feature has multiple locations, the sequence will be concatenated. In some cases (e.g. ribosomal slippage) the locations may overlap. Example: [[1, 100], [100, 200]] will return a sequence of 201 bp. To get the sequence of the feature's fullLenth ignoring sub locations, use fullSeq.
-
sequenceSequence
-
Get the sequence.
-
startNumber
-
Get or set the start position of the feature in basepair (bp). All start and stop positions are assumed to be going in a clockwise direction. This position is relative to the contig the feature is on. If there is only one contig, this value will be the same as mapStart. Setting the start position does not work if the feature has multiple locations (use locations instead).
-
stopNumber
-
Get or set the stop position of the feature in basepair (bp). All start and stop positions are assumed to be going in a clockwise direction. This position is relative to the contig the feature is on. If there is only one contig, this value will be the same as mapStop. Setting the stop position does not work if the feature has multiple locations (use locations instead).
-
tagstag
-
Get or set the tags
-
translationqualifiers
-
Get or set the translation. If set, this translation will be used by translate() instead of translating the sequence
-
typetype
-
Get or set the type
-
viewerViewer
-
Get the Viewer
-
visibleBoolean
-
Get or Set the visibility of this object.
Methods
-
inherited addPluginOptions(id, options)
-
Add a plugin to the object.
Name Type Description id
String The id of the plugin
options
Object The plugin options
-
inherited deleteFromObjects()
-
Remove the object from Viewer.objects
-
inherited hasPlugin(pluginID){Boolean}
-
Does this object have a particular plugin?
Name Type Description pluginID
String The ID of the plugin
Returns:
Type Description Boolean - Whether the object has the plugin
-
highlight(slot)
-
Highlights the feature on every slot it is visible. An optional slot can be provided, in which case the feature will only be highlighted on the slot.
Name Type Description slot
Slot Only highlight the feature on this slot.
-
moveTo(duration, ease)
-
Zoom and pan map to show the feature
Name Type Description duration
Number Length of animation
ease
Object The d3 animation ease [Default: d3.easeCubic]
-
inherited optionsForPlugin(pluginName){Object}
-
Get the options for a particular plugin.
Name Type Description pluginName
String The name of the plugin
Returns:
Type Description Object - The options for the plugin or undefined if the plugin is not found
-
remove()
-
Remove the feature from the viewer, tracks and slots
-
slots()
-
Return an array of the slots that contain this feature
-
toString(){String}
-
Return the class name as a string.
Returns:
Type Description String - 'Feature'
-
tracks()
-
Return an array of the tracks that contain this feature FIXME: this will not return the tracks for features on tracks with 'from' = 'sequence' - is this a problem??
-
translate(geneticCode){String}
-
Translate the sequence of this feature.
The source of the genetic code used for translation uses the following precedence: geneticCode (provided to translate method) > geneticCode (of Feature) > geneticCode (of Viewer)
Note: if the feature has a translation property, it will be used instead of translating the sequence.
- This can be overriden by providing a genetic code to the translate method. This forces the sequence to be translated.
Name Type Description geneticCode
Number Number indicating the genetic code to use for the translation. This will override the any genetic code set for the feature or Viewer.
Returns:
Type Description String - Amino acid sequence
-
update(attributes)
-
Update feature attributes. See updating records for details.
Name Type Description attributes
Object Object describing the properties to change
-
inherited updatePluginOptions(id, options)
-
Update plugin options. Merge the new options with the old options.
Name Type Description id
String The id of the plugin
options
Object The plugin options