forked from 3dbionotes-community/pdbe-molstar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
197 lines (164 loc) · 7.39 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<title>PDBe Molstar</title>
<!-- Molstar CSS & JS -->
<link rel="stylesheet" type="text/css" href="build/pdbe-molstar-3.1.0.css">
<script type="text/javascript" src="build/pdbe-molstar-plugin-3.1.0.js"></script>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.msp-plugin ::-webkit-scrollbar-thumb {
background-color: #474748 !important;
}
.viewerSection {
padding-top: 40px;
}
.controlsSection {
width: 300px;
float: left;
padding: 40px 0 0 40px;
margin-right: 30px;
}
.controlBox {
border: 1px solid lightgray;
padding: 10px;
margin-bottom: 20px;
}
#myViewer{
float:left;
width:450px;
height: 450px;
position:relative;
}
</style>
</head>
<body>
<div class="controlsSection">
<h3>Canvas/ layout methods</h3>
<div class="controlBox">
<strong>Set Background</strong><br>
<button onclick="viewerInstance.canvas.setBgColor({r:255, g:255, b:255})">White</button>
<button onclick="viewerInstance.canvas.setBgColor({r:0, g:0, b:0})">Black</button><br><br>
<strong>Toggle controls menu</strong><br>
<button onclick="viewerInstance.canvas.toggleControls(false)">Hide</button>
<button onclick="viewerInstance.canvas.toggleControls(true)">Show</button>
<button onclick="viewerInstance.canvas.toggleControls()">Toggle</button><br><br>
<strong>Toggle Fullscreen</strong><br>
<button onclick="viewerInstance.canvas.toggleExpanded(true)">Show Fullscreen</button><br>
</div>
<h3>Visual Methods</h3>
<div class="controlBox">
<strong>Change representation visibility</strong><br>
<button onclick="viewerInstance.visual.visibility({water:false})">Hide Water Visual</button>
<button onclick="viewerInstance.visual.visibility({water:true})">Show Water Visual</button><br><br>
<strong>Toggle Spin</strong><br>
<button onclick="viewerInstance.visual.toggleSpin(true)">Rotate</button>
<button onclick="viewerInstance.visual.toggleSpin(false)">Stop</button>
<button onclick="viewerInstance.visual.toggleSpin()">Toggle</button><br><br>
<strong>Focus</strong><br>
<button onclick="viewerInstance.visual.focus([{struct_asym_id: 'A', start_residue_number: 14, end_residue_number: 18}])">Focus on Chain A:14-18</button><br><br>
<strong>Highlight</strong><br>
<button onclick="viewerInstance.visual.highlight({ data: [{ struct_asym_id: 'A', start_residue_number: 14, end_residue_number: 18 }], color:{r:255,g:255,b:0} })">Highlight Chain A:14-18</button>
<button onclick="viewerInstance.visual.clearHighlight()">Clear Highlight</button><br><br>
<strong>Selection</strong><br>
<button onclick="viewerInstance.visual.select({ data: [{ struct_asym_id: 'B', start_residue_number: 1, end_residue_number: 6, color:{r:255,g:255,b:0}, focus: true }]})">Select & Focus on Chain B:1-6</button><br><br>
<button onclick="
var selectSections = [
// {
// struct_asym_id: 'B',
// unp_accession: 'P00742',
// unp_res_num_start: 235,
// unp_res_num_end: 488,
// color:{r:255,g:0,b:255},
// // sideChain: true
// },
{
struct_asym_id: 'C',
unp_accession: 'P00742',
unp_res_num_start: 127,
unp_res_num_end: 132,
color:{r:255,g:0,b:255},
// sideChain: true
}
]
viewerInstance.visual.select({ data: selectSections, nonSelectedColor: {r:255,g:255,b:255}})">Select Uniport</button><br><br>
<button onclick="viewerInstance.visual.select({ data: [{struct_asym_id: 'A', color:{r:255,g:255,b:0}}], nonSelectedColor: {r:255,g:255,b:255} })">Select & Focus on Chain A</button><br><br>
<button onclick="viewerInstance.visual.clearSelection()">Clear Selection</button><br><br>
<strong>Set highlight / selection colour</strong><br>
<button onclick="viewerInstance.visual.setColor({ highlight: {r:255,g:255,b:0} })">Yellow highlight</button>
<button onclick="viewerInstance.visual.reset({ highlightColor: true })">Reset</button><br><br>
<button onclick="viewerInstance.visual.setColor({ select: {r:255,g:0,b:0} })">Red selection</button>
<button onclick="viewerInstance.visual.reset({ selectColor: true })">Reset</button><br><br>
<strong>Reset Visual</strong><br>
<button onclick="viewerInstance.visual.reset({ camera: true })">Camera</button>
<button onclick="viewerInstance.visual.reset({ theme: true })">Theme</button>
<button onclick="viewerInstance.visual.reset({ camera: true, theme: true })">Camera & Theme</button><br><br>
<strong>Update data</strong><br>
<button onclick="viewerInstance.visual.update({moleculeId: '1cbs'}, false)">Update data to create new visual</button><br>
</div>
</div>
<div class="viewerSection">
<h4>PDBe Mol* JS Plugin Demo</h4>
<!-- Molstar container -->
<div id="myViewer"></div>
</div>
<script>
//Create plugin instance
var viewerInstance = new PDBeMolstarPlugin();
//Set options (Checkout available options list in the documentation)
var options = {
moleculeId: '1cbs',
// expanded: true,
// loadMaps: true,
// bgColor: {r:255, g:255, b:255},
// hideControls: true,
// domainAnnotation: true,
// validationAnnotation: true,
// subscribeEvents: true
}
//Ligand view
// var options = {
// moleculeId: '1cbs',
// ligandView: {label_comp_id: "REA"},
// loadMaps: true,
// expanded: false,
// hideControls: true,
// bgColor: {r:255, g:255, b:255},
// }
//Superposition options (P08083, Q14676, Q5VSL9, P54646)
// var options = {
// moleculeId: 'P06213',
// superposition: true,
// expanded: true,
// // hideControls: true,
// bgColor: {r:255, g:255, b:255},
// superpositionParams: { matrixAccession: 'P06213', segment:1 }
// }
// // AF
// var options = {
// customData: {
// url: 'https://alphafold.ebi.ac.uk/files/AF-O15552-F1-model_v1.cif',
// format: 'cif'
// },
// bgColor: {r:255, g:255, b:255},
// // hideControls: true,
// alphafoldView: true,
// hideCanvasControls: ['selection', 'animation', 'controlToggle', 'controlInfo']
// }
//Get element from HTML/Template to place the viewer
var viewerContainer = document.getElementById('myViewer');
//Call render method to display the 3D view
viewerInstance.render(viewerContainer, options);
// document.addEventListener('PDB.molstar.mouseover', (e) => {
// //do something on event
// console.log(e)
// });
</script>
</body>
</html>