-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
70 lines (65 loc) · 2.11 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
define([
'dojo/_base/declare',
'JBrowse/Plugin',
'dijit/form/Button',
'dijit/registry',
'MotifDensityPlugin/View/Dialog/MotifDensityDialog'
],
function (
declare,
JBrowsePlugin,
dijitButton,
dijitRegistry,
MotifDensDialog
) {
return declare(JBrowsePlugin, {
constructor: function (args) {
var browser = args.browser;
var thisB = this;
// do anything you need to initialize your plugin here
this.config.version = '2.2.2';
console.log("MotifDensityPlugin plugin starting - v" + this.config.version);
this.config.dialog = false;
if (args.dialogMode !== undefined)
this.config.dialog = args.dialogMode;
this.config.dialogColors = args.dialogColors || 'random';
this.config.dialogMotifs = args.dialogMotifs || ["CG", "CHG", "CHH", "AT"];
// register track type
browser.registerTrackType({
label: 'MotifDensity',
type: 'MotifDensityPlugin/View/Track/MotifDensity'
});
if(this.config.dialog){
var button;
browser.afterMilestone('initView', function () {
// create screenshot button (possibly tools menu)
var menuBar = browser.menuBar;
function showMotifDialog() {
new MotifDensDialog({
setCallback: function (ws, wd, minsc, maxsc, m, clr) {},
windowSize: 100,
windowDelta: 10,
minScore: 0,
maxScore: 1,
motifs: thisB.config.dialogMotifs,
colors: thisB.config.dialogColors
}).show();
}
button = new dijitButton({
innerHTML: 'M',
id: 'motif-button',
onClick: showMotifDialog
});
menuBar.appendChild(button.domNode);
});
browser.afterMilestone('completely initialized', function () {
if (browser.view.tracks.length < 1) {
setTimeout(function () {
button.onClick();
}, 700)
}
});
} // end if config.dialog
}
});
});