-
Notifications
You must be signed in to change notification settings - Fork 2
/
epiviz-guide-track.html
241 lines (203 loc) · 11.2 KB
/
epiviz-guide-track.html
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<!-- Polymer dependency -->
<link rel="import" href="bower_components/polymer/polymer-element.html">
<!-- Epiviz imports dependency -->
<!-- <link rel="import" href="bower_components/epiviz-imports/epiviz-common-js.html"> -->
<!-- Epiviz Polymer Behaviors dependency -->
<link rel="import" href="chart-behavior.html">
<link rel="import" href="chart-settings.html">
<link rel="import" href="chart-colors.html">
<link rel="import" href="chart-remove.html">
<link rel="import" href="chart-grid-behavior.html">
<!-- Epiviz Shared css -->
<link rel="import" type="css" href="chart-shared-css.html">
<!--
<h2> Chart Component </h2>
epiviz-chart components are a collection of reusable and extensible visualization components for
genomic data.
An epiviz-chart component requires two attributes to render a visualization on the page
<ul>
<li>data attribute, </li>
<li>dimensions (or columns) from the data attribute to visualize.</li>
</ul>
`<epiviz-guide-track>` Creates a block track chart with genomic location on the x-axis.
Commonly used to visualize annotated regions on the genome. eg. CpG islands, hyper/hypo methylated regions etc.
Element attributes are defined in <a href="#epiviz.ChartBehavior">`<epiviz.ChartBehavior>`</a> element.
To create a guide track on a HTML page, add
<epiviz-guide-track></epiviz-guide-track>
@demo demo/index-guide-track.html Example page showing a guide track
-->
<dom-module id="epiviz-guide-track">
<template>
<style include="shared-settings"></style>
<style include="chart-shared-css"></style>
<style>
:host {
width: 100%;
height: 100%;
display: inline-block;
border: 1px solid black;
border-radius: 5px;
resize: vertical;
overflow: auto;
transition: width 0.01s, height 0.01s;
position: relative;
}
</style>
<!-- local DOM goes here -->
<paper-spinner-lite active class="green"></paper-spinner-lite>
<div id="chart" on-mouseover="hostHovered" on-mouseout="hostUnhovered">
<slot name="dragHandle"></slot>
<div id="{{plotId}}"></div>
</div>
</template>
<script>
// Extend Polymer.Element base class
class EpivizGuideTrack extends EpivizChartGridBehavior(EpivizChartRemoveBehavior(EpivizChartColorsBehavior(EpivizChartSettingsBehavior(EpivizChartBehavior(Polymer.Element))))) {
static get is() { return 'epiviz-guide-track'; }
static get properties() {
return {
/**
* Default chart properties for guide track.
*
* @type {Object}
*/
configSrc: {
type: Object,
value: function () {
epiviz.Config.SETTINGS = {
dataProviders: [
["epiviz.data.WebServerDataProvider", "umd", "http://epiviz-dev.cbcb.umd.edu/api/"]
],
workspacesDataProvider: sprintf('epiviz.data.EmptyResponseDataProvider', 'empty', ''),
useCache: true,
chartSettings: {
default: {
colors: 'd3-category10',
decorations: [
'epiviz.ui.charts.decoration.RemoveChartButton',
'epiviz.ui.charts.decoration.SaveChartButton',
'epiviz.ui.charts.decoration.CustomSettingsButton',
'epiviz.ui.charts.decoration.EditCodeButton',
'epiviz.ui.charts.decoration.ChartColorsButton',
'epiviz.ui.charts.decoration.ChartLoaderAnimation',
'epiviz.ui.charts.decoration.ChartResize'
]
},
plot: {
width: 400,
height: 400,
margins: new epiviz.ui.charts.Margins(15, 30, 30, 15),
decorations: [
'epiviz.ui.charts.decoration.ToggleTooltipButton',
'epiviz.ui.charts.decoration.ChartTooltip',
'epiviz.ui.charts.decoration.ChartFilterCodeButton'
]
},
track: {
width: 900,
height: 90,
margins: new epiviz.ui.charts.Margins(25, 40, 23, 10),
decorations: [
'epiviz.ui.charts.decoration.ToggleTooltipButton',
'epiviz.ui.charts.decoration.ChartTooltip',
'epiviz.ui.charts.decoration.ChartFilterCodeButton'
]
},
'epiviz.plugins.charts.GuideBBTrack': {
height: 200,
colors: 'genes-default'
},
},
chartCustomSettings: {
'epiviz.plugins.charts.GuideBBTrack': {
}
},
colorPalettes: [
new epiviz.ui.charts.ColorPalette(
['#025167', '#e7003e', '#ffcd00', '#057d9f', '#970026', '#ffe373', '#ff8100'],
'Epiviz v1.0 Colors', 'epiviz-v1'),
new epiviz.ui.charts.ColorPalette(
['#1859a9', '#ed2d2e', '#008c47', '#010101', '#f37d22', '#662c91', '#a11d20', '#b33893'],
'Epiviz v2.0 Bright', 'epiviz-v2-bright'),
new epiviz.ui.charts.ColorPalette(
['#b8d2eb', '#f2aeac', '#d8e4aa', '#cccccc', '#f2d1b0', '#d4b2d3', '#ddb8a9', '#ebbfd9'],
'Epiviz v2.0 Light', 'epiviz-v2-light'),
new epiviz.ui.charts.ColorPalette(
['#599ad3', '#f1595f', '#79c36a', '#727272', '#f9a65a', '#9e66ab', '#cd7058', '#d77fb3'],
'Epiviz v2.0 Medium', 'epiviz-v2-medium'),
new epiviz.ui.charts.ColorPalette(
["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "#8c564b", "#e377c2", "#7f7f7f", "#bcbd22", "#17becf"],
'D3 Category 10', 'd3-category10'),
new epiviz.ui.charts.ColorPalette(
["#1f77b4", "#aec7e8", "#ff7f0e", "#ffbb78", "#2ca02c", "#98df8a", "#d62728", "#ff9896", "#9467bd", "#c5b0d5", "#8c564b", "#c49c94", "#e377c2", "#f7b6d2", "#7f7f7f", "#c7c7c7", "#bcbd22", "#dbdb8d", "#17becf", "#9edae5"],
'D3 Category 20', 'd3-category20'),
new epiviz.ui.charts.ColorPalette(
["#393b79", "#5254a3", "#6b6ecf", "#9c9ede", "#637939", "#8ca252", "#b5cf6b", "#cedb9c", "#8c6d31", "#bd9e39", "#e7ba52", "#e7cb94", "#843c39", "#ad494a", "#d6616b", "#e7969c", "#7b4173", "#a55194", "#ce6dbd", "#de9ed6"],
'D3 Category 20b', 'd3-category20b'),
new epiviz.ui.charts.ColorPalette(
["#3182bd", "#6baed6", "#9ecae1", "#c6dbef", "#e6550d", "#fd8d3c", "#fdae6b", "#fdd0a2", "#31a354", "#74c476", "#a1d99b", "#c7e9c0", "#756bb1", "#9e9ac8", "#bcbddc", "#dadaeb", "#636363", "#969696", "#bdbdbd", "#d9d9d9"],
'D3 Category 20c', 'd3-category20c'),
new epiviz.ui.charts.ColorPalette(
['#f9a65a', '#599ad3', '#79c36a', '#f1595f', '#727272', '#cd7058', '#d77fb3'],
'Genes Default', 'genes-default'),
new epiviz.ui.charts.ColorPalette(
['#1859a9', '#ed2d2e', '#008c47', '#010101', '#f37d22', '#662c91', '#a11d20', '#b33893'],
'Heatmap Default', 'heatmap-default')
]
};
return epiviz.Config.SETTINGS;
}
}
}
}
static get observers() {
return [
/* observer array just like 1.x */
]
}
constructor() {
super();
}
connectedCallback() {
super.connectedCallback();
var self = this;
self._initializeGrid();
self._measurementsChanged();
}
disconnectedCallback() {
super.connectedCallback();
}
ready() {
super.ready();
this.plotId = self.plotId || this._generatePlotId();
// this.scopeSubtree(this.$.chart, true);
this.config = new epiviz.Config(this.configSrc);
this.style = "min-height:" + (150) + "px;"
}
/**
* Draws the chart.
*
* @param {Object<epiviz.datatypes.GenomicRange>} range genomic range.
* @param {Object<epiviz.datatypes.MapGenomicData>} data to plot
*/
_draw() {
// if (this.canvas) {
// this.chart.drawCanvas(this.range, this.data);
// }
// else {
this.chart.draw(this.range, this.data);
// }
this.shadowRoot.querySelector("paper-spinner-lite").active = false;
}
/**
* Creates an instance of the blocks track chart.
*
* @return {epiviz.plugins.charts.GuideBBTrackType} BlocksTrack chart object
*/
_createChart() {
return new epiviz.plugins.charts.GuideBBTrackType(new epiviz.Config(this.configSrc));
}
};
customElements.define(EpivizGuideTrack.is, EpivizGuideTrack);
</script>
</dom-module>