-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
163 lines (136 loc) · 5.1 KB
/
index.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
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF8">
<script src="http://cdnjs.cloudflare.com/ajax/libs/zepto/1.1.6/zepto.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.3.3/d3.js"></script>
<script type="text/javascript" src="vendor/svgexp.js"></script>
<script type="text/javascript" src="vendor/colorbrewer.js"></script>
<!-- not needed in CLMS-UI -->
<script type="text/javascript" src="vendor/download.js"></script>
<!-- not needed in CLMS-UI -->
<script type="text/javascript" src="src/model.js"></script>
<script type="text/javascript" src="src/SpectrumView2.js"></script>
<script type="text/javascript" src="src/FragmentationKeyView.js"></script>
<script type="text/javascript" src="src/FragmentationKey.js"></script>
<script type="text/javascript" src="src/FragKey/KeyFragment.js"></script>
<script type="text/javascript" src="src/graph/Graph.js"></script>
<script type="text/javascript" src="src/graph/Peak.js"></script>
<script type="text/javascript" src="src/graph/Fragment.js"></script>
<!-- <script type="text/javascript" src="src/graph/IsotopeCluster.js"></script> -->
<style type="text/css">
html, body{
background-color: white;
height:100%;
width:100%;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: -moz-none;
-o-user-select: none;
user-select: none;
}
*{
margin:0px;
padding:0px;
}
#spectrumDiv {
height:100%;
width:100%;
}
#spectrumPanelWrapper {
height: 90%;
}
#measureTooltip {
position: absolute;
/*max-width: 8em;*/
text-align:center;
pointer-events:none; /*let mouse events pass through*/
/*transition: opacity 0.3s;*/
}
</style>
<script>
var SpectrumModel = new AnnotatedSpectrumModel();
$(function() {
//selects everything in input field on click
$("input[type='text']").on("click", function () {
console.log("test");
$(this).val("");
});
//Restrict input to mzrange fields
$(".mzrange").keydown(function (e) {
// Allow: backspace, delete, tab, escape, enter and .
if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
// Allow: Ctrl+A
(e.keyCode == 65 && e.ctrlKey === true) ||
// Allow: Ctrl+C
(e.keyCode == 67 && e.ctrlKey === true) ||
// Allow: Ctrl+X
(e.keyCode == 88 && e.ctrlKey === true) ||
// Allow: home, end, left, right
(e.keyCode >= 35 && e.keyCode <= 39)) {
// let it happen, don't do anything
return;
}
// Ensure that it is a number and stop the keypress
if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
e.preventDefault();
}
});
_.extend(window, Backbone.Events);
window.onresize = function() { window.trigger('resize') };
var Spectrum = new SpectrumView({model: SpectrumModel, el:"#spectrumDiv"});
var FragmentationKey = new FragmentationKeyView({model: SpectrumModel, el:"#spectrumDiv"});
/* d3.text("test.csv", function(csv) {
SpectrumModel.set({annotatedPeaksCSV: csv});
});*/
/* $.getJSON("json/example_XL.json", function(json) {
console.log("json:" + json);
SpectrumModel.set({JSONdata: json});
});*/
d3.json("http://129.215.14.63/xiAnnotator/annotate/3421/85160-94827-96653-69142/210313888/?peptide=TVTAMDVVYALK&peptide=YKAAFTECcmCcmQAADK&link=21&link=1&custom=fragment:BLikeDoubleFragmentation", function(json) {
//~ alert("yo");
console.log("json:" + json);
SpectrumModel.set({JSONdata: json});
});
});
</script>
</head>
<body>
<div id="spectrumPanelWrapper">
<div id='spectrumDiv'>
<label>lossy labels
<input id="lossyChkBx" type="checkbox">
</label>
<button class="btn btn-1 btn-1a downloadButton" id="reset">reset zoom</button>
<button class="btn btn-1 btn-1a downloadButton" id="clearHighlights">clear highlights</button>
<button class="btn btn-1 btn-1a downloadButton" id="downloadSVG">Download SVG</button>
<label>measure
<input id="measuringTool" type="checkbox">
</label>
<label>move labels
<input id="moveLabels" type="checkbox">
</label>
</br>
<label for="colorSelector">Change color scheme:</label>
<select id="colorSelector">
<option value="RdBu">Red&Blue</option>
<option value="BrBG">Brown&Teal</option>
<option value="PiYG">Pink&Green</option>
<option value="PRGn">Purple&Green</option>
<option value="PuOr">Orange&Purple</option>
</select>
<form id="setrange">
m/z Range:
<input type="text" class="mzrange" id="xleft" size="5">
<input type="text" class="mzrange" id="xright" size="5">
<input type="submit" value="set range">
<span id="range-error"></span>
</form>
<svg id="spectrumSVG" style="width:100%; height:100%"></svg>
<div id="measureTooltip"></div>
</div>
</div>
</body>
</html>