forked from Genentech/pviz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample-custom-display-css.html
78 lines (65 loc) · 2.46 KB
/
example-custom-display-css.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
<html>
<head>
<title>pViz cuslivingstone display example</title>
<link rel="stylesheet" type="text/css" href="deps/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="deps/sib-pviz-core.css">
<script src="deps/sib-pviz-bundle.js"></script>
<!-- just a few lines of javscript to decorate the page -->
<script src="examples-utils.js"></script>
<style type="text/css" media="screen" class="example">
g.feature.psms.stanley rect.feature {
fill: red;
fill-opacity: 0.8;
}
g.feature.psms.stanley:hover rect.feature {
fill: black;
fill-opacity: 0.8;
}
g.feature.psms.stanley text {
font-weight: bold;
fill: yellow;
}
g.feature.psms.livingstone rect.feature {
fill: green;
fill-opacity: 0.2;
}
g.feature.psms rect.feature-block-end {
display: none;
}
</style>
</head>
<body class="container">
<div class="row">
<h2>pViz custom display with css example</h2>
</div>
<div id="main" class="row"></div>
<div class="row">
<h3>Comments</h3>
Instead of displaying features as basic, we can use css to custom the svg rectangle.
<br/>
Both category and feature type can be captured at the css level.
<br/>Mouse over the red features.
</div>
<script class="example">
var pviz = this.pviz;
var seq = 'MELAALCRWGLLLALLPPGAASTQVCTGTDMKLR';
var seqEntry = new pviz.SeqEntry({
sequence : seq
});
new pviz.SeqEntryAnnotInteractiveView({
model : seqEntry,
el : '#main'
}).render();
var fts = [[1, 5, 'livingstone'], [1, 7, 'livingstone'], [6, 8, 'livingstone'], [12, 23, 'livingstone'], [7, 15, 'livingstone'], [1, 30, 'stanley'], [5, 7, 'stanley'], [9, 12, 'stanley']];
seqEntry.addFeatures(fts.map(function(ft) {
return {
category : 'psms',
type : ft[2],
start : ft[0],
end : ft[1],
text : ft[0] + '-' + ft[1] + '/' + ft[2]
}
}))
</script>
</body>
</html>