-
Notifications
You must be signed in to change notification settings - Fork 44
Genoverse configuration
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:
A DOM node, jQuery selector, or string to create a jQuery selector (e.g.
"#genoverse"
) inside which the instance of Genoverse will be created. Ifundefined
, a<div>
element will be appended todocument.body
.
The width that the
container
DOM element will be
A string or number defining the initial chromosome to display
A string or number defining the initial start position
A string or number defining the initial end position
A string defining the assembly, which can be used by track URL templates
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 directoryundefined
, in which casechromosomeSize
MUST be set (see below)
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'ssize
property, as defined by the genome object.
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 aGenoverse.Track.Gene
- Array, e.g.
[ 'Gene', { ... some config ... }]
, for aGenoverse.Track.Gene.extend({ ... some config })
- Array without configuration, e.g.
[ 'Gene' ]
, for aGenoverse.Track.Gene
- Object of configuration, e.g.
{ ... some config ... }
for aGenoverse.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 ... })
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.
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 }] ]
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.
Determines how the browser's URL gets updated on navigation. Can be:
true
- usewindow.location.hash
false
- usewindow.history.pushState
undefined
- usewindow.history.pushState
if present in the browser, else usewindow.location.hash
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 unlesswindow.location.href
matches the string.If falsy, the instance will never ignore change to the
urlParamTemplate
.
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
The action performed when a mouse wheel zoom happens on the genome browser. Can be:
"zoom"
- Zoom in or out"off"
- Do nothing
If
true
, will stop drag, select and zoom actions occurring
If
true
, track configuration and ordering will be saved inwindow.sessionStorage
/window.localStorage
(defined bystorageType
, below) so that users will see the same display when they refresh the page
The storage object used to save track configuration. Set to
"localStorage"
for permanence.See Mozilla's sessionStorage and localStorage documentation for further details.
The default key used in configuration storage is
"genoverse"
.saveKey
will be appended to this to allow different configurations for different instances of Genoverse.
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
Determines whether to automatically resize tracks to show all their features (can be overridden by
track.autoHeight
)
Determines whether to hide an automatically resized tracks if it has no features, or to show it empty (can be overridden by
track.hideEmpty
)
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 foraddTracks
andsetConfig
.