Class: Feature

Feature

A Feature is a region on the map with a start and stop position.

Action and Events

Action Viewer Method Feature Method Event
Add addFeatures() - features-add
Update updateFeatures() update() features-update
Remove removeFeatures() remove() features-remove
Read features() - -

Attributes

Attribute Type Description
name String Name of feature
type String Feature type (e.g. CDS, rRNA, etc)
legend String|LegendItem Name of legendItem or the legendItem itself
source String Source of the feature
tags String|Array A single string or an array of strings associated with the feature as tags
contig String|Contig Name of contig or the contig itself
startrc Number Start base pair on the contig
stoprc Number Stop base pair on the contig
mapStartic Number Start base pair on the map (converted to contig position)
mapStopic Number Stop base pair on the map (converted to contig position)
strand String Strand the features is on [Default: 1]
score Number Score associated with the feature
favorite Boolean Feature is a favorite [Default: false]
visible Boolean Feature is visible [Default: true]
meta Object Meta data for Feature

rc Required on Feature creation ic Ignored on Record creation

Implementation notes:

  • The feature range is the range on the contig
  • Feature.mapRange is the range on the Sequence.mapContig
  • If there is only one contig in the map, then Feature.mapRange === Feature.range
  • Feature.start/stop are positions on the contig
  • Feature mapStart/mapStop are position on Sequence.mapContig
  • If no contig is provided, the default contig will be Sequence.mapContig
    • Whenever mapContig is updated/regenerated the feature will be moved to the new mapContig
    • Features on the mapContig are able to span contigs
    • If contigs are rearranged, a mapContig feature will stay at the same position (start/stop)

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.

geneticCodeString

Get or set the Genetic code used for translation. If no genetic code is set, the default for the map will be used.

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.

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.

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.

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.

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.

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.

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.

tagstag

Get or set the tags

typetype

Get or set the type

viewerViewer

Get the Viewer

visibleBoolean

Get or Set the visibility of this object.

Methods

inherited deleteFromObjects()

Remove the object from Viewer.objects

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]

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)

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