Class: Bookmark

Bookmark

Bookmarks are saved map locations. Bookmarks store the base pair (bp), the zoomFactor (zoom) and map format (e.g. linear or circular). By default the map backbone at the provided bp will be centered in the middle of the canvas. The bbOffset attribute can be used to move the map backbone away from the center. Bookmarks can have shortcut key associated with them. If the key is typed, while not in a input field, the map will move to the bookmark position.

Action and Events

Action Viewer Method Bookmark Method Event
Add addBookmarks() - bookmarks-add
Update updateBookmarks() update() bookmarks-update
Remove removeBookmarks() remove() bookmarks-remove
Read bookmarks() - -

Attributes

Attribute Type Description
name String Name of bookmark [Default: "Bookmark-N" where N is the number of the bookmark]
bp Number Base pair to center the map position [Default: Current bp]
zoom Number Zoom factor [Default: Current zoomFactor]
format String Map format [Default: Current map format]
bbOffset Number Distance from the backbone to the center of the canvas [Default: 0]
shortcut Character Single character shortcut that when pressed moves the map to this position [Default: N (see name) up to 9]
favorite Boolean Bookmark is a favorite [Default: false]
meta Object Meta data for Bookmark

Examples

// Create a new bookmark for the current map postion
let bookmark = cgv.addBookmarks();
// => Bookmark {name: 'Bookmark-1', bp: 1, zoom: 1, format: 'linear', bbOffset: 0, shortcut: 1}
cgv.bookmarks().length;
// => 1

// Edit the bookmark
bookmark.update({name: 'my gene'});
// => Bookmark {name: 'my gene', bp: 1, zoom: 1, format: 'linear', bbOffset: 0, shortcut: 1}

// Move to the bookmark position
bookmark.moveTo()

// Remove the bookmark
bookmark.remove();
cgv.bookmarks().length;
// => 0

new Bookmark(viewer, options, meta)

Create a new bookmark.

Name Type Description
viewer Viewer

The viewer

options Object

Attributes used to create the bookmark

meta Object optional

User-defined Meta data to add to the bookmark.

Extends

Members

bpNumber

Get or set the basepair position for the bookmark.

canvasCanvas

Get the canvas.

favoriteBoolean

Get or set the favorite

formatString

Get or set the format

layoutLayout

Get the layout.

metaBoolean

Get or Set the meta data of this object. See the meta data tutorial for details.

nameString

Get or set the name

sequenceSequence

Get the sequence.

shortcutCharacter

Get or set the shortcut

viewerViewer

Get the Viewer

visibleBoolean

Get or Set the visibility of this object.

zoomNumber

Get or set the zoom

Methods

inherited deleteFromObjects()

Remove the object from Viewer.objects

moveTo(duration)

Move and zoom the map to this Bookmarks position.

Name Type Default Description
duration Number 1000

length of time for the animation

remove()

Remove bookmark. See removing records for details.

toJSON()

Returns JSON representing the object

toString(){String}

Return the class name as a string.

Returns:
Type Description
String 'Bookmark'

update(attributes)

Update bookmark attributes. See updating records for details.

Name Type Description
attributes Object

Object describing the properties to change