-
Notifications
You must be signed in to change notification settings - Fork 0
/
dssr.htm
293 lines (254 loc) · 9.03 KB
/
dssr.htm
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<!DOCTYPE html>
<html>
<head>
<title>Jmol/DSSR Demonatration Page</title>
<script type="text/javascript" src="JSmol.min.js"></script>
<script type="text/javascript">
// Bob Hanson 4/22/2014 6:49:57 PM hansonr@stolaf.edu
// BH 9/20/2015 6:46:24 AM upgrade to JSON-based data
var jmolApplet0; // set up in HTML table, below
var stemScript = "select nucleic;set backboneSteps;backbone -0.5;select nucleic and leadAtom;spacefill 1.5;label %[group1];set labelOffset 0 0;color labels yellow";
var _1ehzScript = "reset;center {60.992996 51.431 25.178501}; rotate z -142.9; rotate y 68.91; rotate z 112.36;";
var maxDrop = 5;
var Info = {
width: 600,
height: 600,
color: "white",
addSelectionOptions: false,
disableInitialConsole: true,
serverURL: "http://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php",
use: "HTML5",
jarFile: "JmolAppletSigned0.jar",
isSigned: true,
loadStructCallback: "enableButtons",
script: "background black;set defaultLoadScript '"+ stemScript + ";javascript enableButtons();if (!_M.dssr){calculate structure dssr};display nucleic;if(h2oOn){display add water};if(protOn){display add protein};color grey';load =1ehz/dssr;" + _1ehzScript
}
var hbondsON = false;
function enableButtons(app,fullPath,fileName,modelName,errorMsg,status) {
hbondsON = false;
var data = Jmol.evaluateVar(jmolApplet0, "(_M.dssr ? _M.dssr.counts : {})");
for (var i = dssrBtns.length; --i >= 0;) {
var name = dssrBtns[i];
$("#dssrBtn_"+name).prop("disabled", !data[name]);
}
}
///////// MODEL LIST /////////
Models = []
template = "xid='%1';zap;set echo top left;echo loading...;refresh;load %4;%3;|%2 (%1)"
function addModel(xxxx, load, text, script, selected) {
script || (script = "");
selected || (selected = false);
load || (load = "=%1/dssr 1;");
var t = template.replace(/%4/, load)
.replace(/%1/g, xxxx)
.replace(/%2/, text)
.replace(/%3/, script)
.split("|");
t.push(selected);
Models.push(t)
}
addModel("1ehz", "", "T-RNA", _1ehzScript, true)
addModel("2m5u", "", "P4 Hairpin Loop")
addModel("2m4w", "", "G-Bulge")
addModel("4jab", "", "U/G Wobble Base Pair")
addModel("2mi0", "", "I-V Kissing Loop")
addModel("1msy", "", "GUAA tetraloop E. Coli 23 S rRNA")
addModel("4c40", "", "L7Ae kink turn")
addModel("2mhi", "", "telomerase CR4/5 domain")
addModel("4lvv", "", "THF Riboswitch", "rotate Y -90")
addModel("4mgn", "", "glyQS T box riboswitch+tRNA")
function jmolCheckbox(script1, script0,text,ischecked) {Jmol.jmolCheckbox(jmolApplet0,script1, script0, text, ischecked)}
function jmolButton(script, text) {Jmol.jmolButton(jmolApplet0, "select *;" + (script || text), (text || script))}
function jmolHtml(s) { document.write(s) };
function jmolBr() { jmolHtml("<br>") }
function jmolMenu(a) {Jmol.jmolMenu(jmolApplet0, a)}
function jmolScript(script) {
$("#jmolCmd0").val(script);
Jmol.script(jmolApplet0, script);
}
///////// SPECIALIZED BUTTONS /////////
var dssrBtns = []
function dssrBtn(key, name) {
if (name == null)
name = key;
else
dssrBtns.push(name);
Jmol.jmolButton("jmolApplet0", [showDSSR, key, name],key, "dssrBtn_"+name);
}
function showDSSR(btn, data) {
var dssrType = data[1].replace(/ /g,"");
var dssrWhat = data[2]
var dssrPlural = dssrType.toLowerCase();
var s = "";
var n = 0;
$("#menudiv").css('visibility', 'hidden');
if (btn) {
if (dssrWhat == "counts") {
alert(Jmol.scriptEcho(jmolApplet0, "print _M.dssr.counts"));
return;
}
if (dssrWhat == "hbonds") {
if ((hbondsON = !hbondsON)) {
jmolScript("select off *;wireframe only;calculate hbonds structure;hbonds 0.2");
} else {
jmolScript("select off *;hbonds off;" + stemScript);
}
return;
}
if (dssrWhat == "hbondsOff") {
jmolScript("select off *;hbonds off");
return;
}
jmolScript("select off *;color gray;");
if (dssrWhat == null) // "highlights off"
return;
var data = Jmol.evaluateVar(jmolApplet0, "_M.dssr."+dssrWhat);
var n = data.length;
var s = "<select id='dssr' style='width:140px' size='"+Math.min(n+1, maxDrop)+"'>"
if (n > 1)
s += "<option value='' selected>" + (n == 2 ? "both" : "all " + n) + " " + dssrPlural + "</option>"
for (var i = 0; i < n; i++)
s += "<option value="+(i+1)+">"+ dssrWhat + ".."+ (i + 1)+"</option>";
s += "</select>"
$("#menudiv").html(s).css('visibility', (n == 0 ? 'hidden' : 'visible'));
var f = function(a,e){selectOn(dssrWhat, $(e || this).val())};
$("#dssr").change(f).keyup(function() {var me = this;setTimeout(function(){f(0, me)}, 50)});
selectOn(dssrWhat, 0);
}
}
function selectOn(dssrWhat, n) {
jmolScript("select *;color grey;select " + dssrWhat+"; color " + (n ? "translucent " : "") + "red");
if (n) {
jmolScript("select @{_M.dssr."+dssrWhat+".." + n + "}; color red");
}
}
function calculateDSSR() {
if (Jmol.evaluateVar(jmolApplet0,"_M.dssr.type != 'hash'"))
jmolScript("calculate structure DSSR;javascript enableButtons()");
else
alert("The DSSR analysis for this structure has already been carried out; push this button if you load your structure yourself or drag-drop a structure into the JSmol frame.")
}
function openAnalysis(isText) {
jmolScript("console");
setTimeout(function(){jmolScript("console clear;print _M.dssr")}, 2000);
}
$(document).ready(function() {
$("#menudiv").css("visibility","hidden");
$("#btnform")[0].reset();
});
</script>
</head>
<body>
<center>
<table><tr>
<td valign=top style="width:300px" rowspan=2>
This page demonstrates capabilities in Jmol
that involve RNA and DNA secondary structure
using real-time DSSR analysis provided by <a href=http://goo.gl/ap12xJ>3DNA</a>.
<br>
<br>
The commands being issued by the buttons are displayed in the
box under the applet.
<br>
<br>
<script type="text/javascript">
Jmol.setButtonCss(null,"style='width:140px'")
dssrBtn('bulges', 'bulges');
dssrBtn('coaxial stacks', 'coaxStacks');
jmolBr();
dssrBtn('hairpins', 'hairpins');
dssrBtn('helices', 'helices');
jmolBr();
dssrBtn('internal loops', 'iloops');
dssrBtn('isocanonical pairs', 'isoCanonPairs');
jmolBr();
dssrBtn('junctions', 'junctions');
dssrBtn('kissing loops', 'kissingLoops');
jmolBr();
dssrBtn('stacks', 'stacks');
dssrBtn('stems', 'stems');
jmolBr();
jmolBr();
dssrBtn('all nucleotides', 'nts');
dssrBtn('toggle hydr. bonds', 'hbonds');
jmolBr();
jmolBr();
dssrBtn("pairs", "pairs");
dssrBtn('multiplets', 'multiplets');
jmolBr();
dssrBtn('nonstacked bases', 'nonStack');
dssrBtn('single-stranded', 'ssSegments');
jmolBr();
jmolBr();
dssrBtn("highlight off");
dssrBtn("counts");
jmolBr();
jmolBr();
</script>
<div id="menudiv" style="visiblity:hidden"><select><option></option></select></div>
</td>
<td valign=top align=center>
<script type="text/javascript">
jmolApplet0 = Jmol.getApplet("jmolApplet0", Info)
</script>
</td><td valign=top >
<form id="btnform"><!-- (FORM tag is important to automatically set checkbox off when page reloads) -->
<script type="text/javascript">
Jmol.setButtonCss(null,"style='width:160px'")
Jmol.setMenuCss(null,"style='width:160px'")
jmolButton("if (!xid) { xid = '1ehz'};var x = prompt('Enter a four-digit PDB ID',xid);if (!x || x == 'null') { quit }; xid = x; load @{'=' + x + '/dssr'} 1;set echo top center;echo @x","Load PDB by ID")
jmolBr()
Jmol.jmolButton("jmolApplet0", [function(){Jmol.loadFileFromDialog(jmolApplet0)}],"Open CIF or DSSR File")
jmolBr()
Jmol.jmolButton("jmolApplet0", [enableButtons],"Refresh DSSR Buttons")
jmolBr()
jmolCheckbox("set pdbAddHydrogens TRUE","set pdbAddHydrogens FALSE","with hydrogens",false)
jmolBr()
jmolCheckbox("h2oOn=true;display add water","h2oOn=false;display remove water","display water",false)
jmolBr()
jmolCheckbox("protOn=true;display add protein","protOn=false;display remove protein","display protein",false)
jmolBr()
jmolHtml("Examples:")
jmolBr()
jmolMenu(Models)
jmolBr()
jmolBr()
jmolButton("load ? 1;calculate structure dssr","Load File")
jmolBr()
//no longer needed is part of the defaultLoadScript
//Jmol.jmolButton("jmolApplet0",[calculateDSSR], "Calculate DSSR");
//jmolBr()
jmolBr()
Jmol.jmolButton("jmolApplet0",[openAnalysis, true], "View Analysis");
jmolBr()
jmolBr()
jmolButton("write FILE ?","Save FILE")
jmolBr()
jmolButton("write IMAGE ?.png","Save PNG")
jmolBr()
jmolButton("write PNGJ ?.png","Save PNG+Jmol")
</script>
</form>
</td></tr>
<tr>
<td align=center>
<script type="text/javascript">
jmolBr()
Jmol.setButtonCss(null,"style='width:120px'")
jmolButton("color cpk")
jmolButton("color group")
jmolButton("color chain")
jmolButton("color structure")
jmolBr()
jmolButton(stemScript,"stem diag")
jmolButton("cartoon only")
jmolButton("backbone -0.3")
jmolButton("spacefill only;spacefill 23%;wireframe 0.15","ball&stick")
jmolBr()
Jmol.setButtonCss(null,"style='width:100px'")
jmolButton("console")
Jmol.jmolCommandInput(jmolApplet0, "execute", "100px", null, null, "help dssr")
</script>
</td></tr></table>
</body>
</html>