Skip to content

Genoverse configuration

Simon Brent edited this page Mar 8, 2022 · 1 revision

Genoverse has a large number of configurable properties, in order to allow customization. A basic example with two tracks (a scalebar and some genes) and no plugins would be

const genoverse = new Genoverse({
  genome : 'grch38',
  tracks : [ Genoverse.Track.Scalebar, Genoverse.Track.Gene ]
});

The following properties can be provided to the constructor for Genoverse:

DOM element

container (default undefined)

A DOM node, jQuery selector, or string to create a jQuery selector (e.g. "#genoverse") inside which the instance of Genoverse will be created. If undefined, a <div> element will be appended to document.body.

width (default 1000)

The width that the container DOM element will be

Genomic coordinates

chr (default 1)

A string or number defining the initial chromosome to display

start (default 1)

A string or number defining the initial start position

end (default 1000000)

A string or number defining the initial end position

assembly (default undefined)

A string defining the assembly, which can be used by track URL templates

genome (default undefined)

The genome to be used. Can be:

  • an object with keys of the number/letter/name of the chromosomes, and values in the form { "size": 10000 }. Additionally an array of bands can be supplied for each chromosome for drawing purposes - see src/js/genomes/grch38.js for an example. These files can be created for species present in Ensembl by modifying the example node script utils/createGenome.js for the species required.
  • a string (e.g. "grch38") which will be used to obtain a javascript file from the src/js/genomes directory
  • undefined, in which case chromosomeSize MUST be set (see below)

chromosomeSize (default undefined)

If genome not is provided, chromosomeSize MUST be set to the length of the chromosome.

If genome is provided, chromosomeSize will be set to the chromosome's size property, as defined by the genome object.

What is displayed

tracks (default [])

An array of Genoverse.Track definitions to be displayed. The items in this array can be in any of the following forms:

  • String, e.g. 'Gene', for a Genoverse.Track.Gene
  • Array, e.g. [ 'Gene', { ... some config ... }], for a Genoverse.Track.Gene.extend({ ... some config })
  • Array without configuration, e.g. [ 'Gene' ], for a Genoverse.Track.Gene
  • Object of configuration, e.g. { ... some config ... } for a Genoverse.Track.extend({ ... some config })
  • Only if Genoverse.configure() has been called first:
    • Genoverse.Track.Gene
    • Genoverse.Track.Gene.extend({ ... some config ... })
    • Genoverse.Track.extend({ ... some config ... })

highlights (default [])

An array of regions to highlight, in the form

{ start: 100, end, 200, label: 'My highlight', removable: false }

label defaults to "start-end" (e.g. "100-200") if not provided.

If removable === false, the highlight cannot be removed.

plugins (default [])

An array of Genoverse.Plugins to be used (from the src/js/plugins directory), e.g.

[ 'controlPanel', 'trackControls' ]

The strings in this array correspond to the namespace of each plugin, which are the same as their file names.

Some plugins are configurable (see the plugins documentation for more details), e.g.

[ 'controlPanel', [ 'karyotype', { showAssembly: true }] ]

Interaction with the URL

urlParamTemplate (default "r=__CHR__:__START__-__END__")

The template used to alter the web browser's URL. Should contain placeholders for chr, start and end.

If false or empty string, no changes will be made to the URL when navigation occurs.

useHash (default undefined)

Determines how the browser's URL gets updated on navigation. Can be:

  • true - use window.location.hash
  • false - use window.history.pushState
  • undefined - use window.history.pushState if present in the browser, else use window.location.hash

baseURL (default undefined)

If multiple instances of Genoverse exist on a page at once, specifying different baseURL values allows some/all to ignore external URL changes.

If set to a string, the instance will ignore change to the urlParamTemplate part of the URL unless window.location.href matches the string.

If falsy, the instance will never ignore change to the urlParamTemplate.

User actions

dragAction (default "scroll")

The action performed when a mouse drag happens on the genome browser. Can be:

  • "scroll" - Move the browser left or right
  • "select" - Select the region
  • "off" - Do nothing

wheelAction (default "off")

The action performed when a mouse wheel zoom happens on the genome browser. Can be:

  • "zoom" - Zoom in or out
  • "off" - Do nothing

isStatic (default false)

If true, will stop drag, select and zoom actions occurring

Saving user configurations

saveable (default false)

If true, track configuration and ordering will be saved in window.sessionStorage/window.localStorage (defined by storageType, below) so that users will see the same display when they refresh the page

storageType (default "sessionStorage")

The storage object used to save track configuration. Set to "localStorage" for permanence.

See Mozilla's sessionStorage and localStorage documentation for further details.

saveKey (default empty string)

The default key used in configuration storage is "genoverse". saveKey will be appended to this to allow different configurations for different instances of Genoverse.

Default track display settings

autoHideMessages (default true)

Determines whether to collapse track messages (toggleable pop-outs on the left side of a track's image) by default when the user interacts with the genome browser

trackAutoHeight (default false)

Determines whether to automatically resize tracks to show all their features (can be overridden by track.autoHeight)

hideEmptyTracks (default true)

Determines whether to hide an automatically resized tracks if it has no features, or to show it empty (can be overridden by track.hideEmpty)

Debugging

debug (default undefined)

If true, all calls to Genoverse functions will be logged to the console by name, i.e. console.log('Genoverse.addTracks').

If 'time', all calls to Genoverse functions will have their execution time logged to the console by name, i.e. console.time('time: Genoverse.addTracks').

If an object whose keys are Genoverse function names and whose values are truthy, calls to those functions will have their execution time logged to the console by name, e.g. { addTracks: true, setConfig: true } will only log for addTracks and setConfig.

Clone this wiki locally