|
13 | 13 | }, |
14 | 14 | { |
15 | 15 | "cell_type": "code", |
16 | | - "execution_count": 1, |
| 16 | + "execution_count": null, |
17 | 17 | "metadata": {}, |
18 | | - "outputs": [ |
19 | | - { |
20 | | - "name": "stdout", |
21 | | - "output_type": "stream", |
22 | | - "text": [ |
23 | | - "Reading molecules from '['data/dioxin.pdb']'\n", |
24 | | - "Rendering the molecules...\n" |
25 | | - ] |
26 | | - }, |
27 | | - { |
28 | | - "data": { |
29 | | - "application/vnd.jupyter.widget-view+json": { |
30 | | - "model_id": "2a2a4c80371943f1bafce90266bde24b", |
31 | | - "version_major": 2, |
32 | | - "version_minor": 0 |
33 | | - }, |
34 | | - "text/html": [ |
35 | | - "<p>Failed to display Jupyter Widget of type <code>NGLWidget</code>.</p>\n", |
36 | | - "<p>\n", |
37 | | - " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", |
38 | | - " that the widgets JavaScript is still loading. If this message persists, it\n", |
39 | | - " likely means that the widgets JavaScript library is either not installed or\n", |
40 | | - " not enabled. See the <a href=\"https://ipywidgets.readthedocs.io/en/stable/user_install.html\">Jupyter\n", |
41 | | - " Widgets Documentation</a> for setup instructions.\n", |
42 | | - "</p>\n", |
43 | | - "<p>\n", |
44 | | - " If you're reading this message in another frontend (for example, a static\n", |
45 | | - " rendering on GitHub or <a href=\"https://nbviewer.jupyter.org/\">NBViewer</a>),\n", |
46 | | - " it may mean that your frontend doesn't currently support widgets.\n", |
47 | | - "</p>\n" |
48 | | - ], |
49 | | - "text/plain": [ |
50 | | - "NGLWidget()" |
51 | | - ] |
52 | | - }, |
53 | | - "metadata": {}, |
54 | | - "output_type": "display_data" |
55 | | - }, |
56 | | - { |
57 | | - "data": { |
58 | | - "application/vnd.jupyter.widget-view+json": { |
59 | | - "model_id": "8d5d831b83504fbe88ac85e8261fd23c", |
60 | | - "version_major": 2, |
61 | | - "version_minor": 0 |
62 | | - }, |
63 | | - "text/html": [ |
64 | | - "<p>Failed to display Jupyter Widget of type <code>Tab</code>.</p>\n", |
65 | | - "<p>\n", |
66 | | - " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", |
67 | | - " that the widgets JavaScript is still loading. If this message persists, it\n", |
68 | | - " likely means that the widgets JavaScript library is either not installed or\n", |
69 | | - " not enabled. See the <a href=\"https://ipywidgets.readthedocs.io/en/stable/user_install.html\">Jupyter\n", |
70 | | - " Widgets Documentation</a> for setup instructions.\n", |
71 | | - "</p>\n", |
72 | | - "<p>\n", |
73 | | - " If you're reading this message in another frontend (for example, a static\n", |
74 | | - " rendering on GitHub or <a href=\"https://nbviewer.jupyter.org/\">NBViewer</a>),\n", |
75 | | - " it may mean that your frontend doesn't currently support widgets.\n", |
76 | | - "</p>\n" |
77 | | - ], |
78 | | - "text/plain": [ |
79 | | - "Tab(children=(Box(children=(Box(children=(Box(children=(Label(value='step'), IntSlider(value=1, min=-100)), layout=Layout(display='flex', flex_flow='row', justify_content='space-between')), Box(children=(Label(value='delay'), IntSlider(value=100, max=1000, min=10)), layout=Layout(display='flex', flex_flow='row', justify_content='space-between')), Box(children=(Label(value='background'), ColorPicker(value='white')), layout=Layout(display='flex', flex_flow='row', justify_content='space-between')), Box(children=(Label(value='camera'), Dropdown(options=('perspective', 'orthographic'), value='perspective')), layout=Layout(display='flex', flex_flow='row', justify_content='space-between')), Box(children=(Label(value=''), HBox(children=(ToggleButton(value=False, description='Smoothing', tooltip='smoothing trajectory'), Button(description=' Center', icon='bullseye', style=ButtonStyle()), Button(description=' Screenshot', icon='camera', style=ButtonStyle()), Button(description='qtconsole', style=ButtonStyle(), tooltip='pop up qtconsole')), layout=Layout(flex='1 1 auto', width='auto'))), layout=Layout(display='flex', flex_flow='row', justify_content='space-between'))), layout=Layout(align_items='stretch', display='flex', flex_flow='column', width='100%')),)), Box(), Box(), Box(), Box(), Box()), layout=Layout(align_items='stretch', align_self='center'), _titles={'1': 'Representation', '4': 'Extra', '2': 'Preference', '0': 'General', '3': 'Theme', '5': 'Help'})" |
80 | | - ] |
81 | | - }, |
82 | | - "metadata": {}, |
83 | | - "output_type": "display_data" |
84 | | - } |
85 | | - ], |
| 18 | + "outputs": [], |
86 | 19 | "source": [ |
87 | 20 | "from BioSimSpace import viewMolecules\n", |
88 | 21 | "v = viewMolecules(\"data/dioxin.pdb\")" |
|
129 | 62 | }, |
130 | 63 | { |
131 | 64 | "cell_type": "code", |
132 | | - "execution_count": 2, |
| 65 | + "execution_count": null, |
133 | 66 | "metadata": { |
134 | 67 | "scrolled": false |
135 | 68 | }, |
136 | | - "outputs": [ |
137 | | - { |
138 | | - "data": { |
139 | | - "application/vnd.jupyter.widget-view+json": { |
140 | | - "model_id": "bca9a1ff1d504af399483f14453f88ca", |
141 | | - "version_major": 2, |
142 | | - "version_minor": 0 |
143 | | - }, |
144 | | - "text/html": [ |
145 | | - "<p>Failed to display Jupyter Widget of type <code>NGLWidget</code>.</p>\n", |
146 | | - "<p>\n", |
147 | | - " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", |
148 | | - " that the widgets JavaScript is still loading. If this message persists, it\n", |
149 | | - " likely means that the widgets JavaScript library is either not installed or\n", |
150 | | - " not enabled. See the <a href=\"https://ipywidgets.readthedocs.io/en/stable/user_install.html\">Jupyter\n", |
151 | | - " Widgets Documentation</a> for setup instructions.\n", |
152 | | - "</p>\n", |
153 | | - "<p>\n", |
154 | | - " If you're reading this message in another frontend (for example, a static\n", |
155 | | - " rendering on GitHub or <a href=\"https://nbviewer.jupyter.org/\">NBViewer</a>),\n", |
156 | | - " it may mean that your frontend doesn't currently support widgets.\n", |
157 | | - "</p>\n" |
158 | | - ], |
159 | | - "text/plain": [ |
160 | | - "NGLWidget()" |
161 | | - ] |
162 | | - }, |
163 | | - "metadata": {}, |
164 | | - "output_type": "display_data" |
165 | | - }, |
166 | | - { |
167 | | - "data": { |
168 | | - "application/vnd.jupyter.widget-view+json": { |
169 | | - "model_id": "1d52d259bb8840d29869d3826024b162", |
170 | | - "version_major": 2, |
171 | | - "version_minor": 0 |
172 | | - }, |
173 | | - "text/html": [ |
174 | | - "<p>Failed to display Jupyter Widget of type <code>Tab</code>.</p>\n", |
175 | | - "<p>\n", |
176 | | - " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", |
177 | | - " that the widgets JavaScript is still loading. If this message persists, it\n", |
178 | | - " likely means that the widgets JavaScript library is either not installed or\n", |
179 | | - " not enabled. See the <a href=\"https://ipywidgets.readthedocs.io/en/stable/user_install.html\">Jupyter\n", |
180 | | - " Widgets Documentation</a> for setup instructions.\n", |
181 | | - "</p>\n", |
182 | | - "<p>\n", |
183 | | - " If you're reading this message in another frontend (for example, a static\n", |
184 | | - " rendering on GitHub or <a href=\"https://nbviewer.jupyter.org/\">NBViewer</a>),\n", |
185 | | - " it may mean that your frontend doesn't currently support widgets.\n", |
186 | | - "</p>\n" |
187 | | - ], |
188 | | - "text/plain": [ |
189 | | - "Tab(children=(Box(children=(Box(children=(Box(children=(Label(value='step'), IntSlider(value=1, min=-100)), layout=Layout(display='flex', flex_flow='row', justify_content='space-between')), Box(children=(Label(value='delay'), IntSlider(value=100, max=1000, min=10)), layout=Layout(display='flex', flex_flow='row', justify_content='space-between')), Box(children=(Label(value='background'), ColorPicker(value='white')), layout=Layout(display='flex', flex_flow='row', justify_content='space-between')), Box(children=(Label(value='camera'), Dropdown(options=('perspective', 'orthographic'), value='perspective')), layout=Layout(display='flex', flex_flow='row', justify_content='space-between')), Box(children=(Label(value=''), HBox(children=(ToggleButton(value=False, description='Smoothing', tooltip='smoothing trajectory'), Button(description=' Center', icon='bullseye', style=ButtonStyle()), Button(description=' Screenshot', icon='camera', style=ButtonStyle()), Button(description='qtconsole', style=ButtonStyle(), tooltip='pop up qtconsole')), layout=Layout(flex='1 1 auto', width='auto'))), layout=Layout(display='flex', flex_flow='row', justify_content='space-between'))), layout=Layout(align_items='stretch', display='flex', flex_flow='column', width='100%')),)), Box(), Box(), Box(), Box(), Box()), layout=Layout(align_items='stretch', align_self='center'), _titles={'1': 'Representation', '4': 'Extra', '2': 'Preference', '0': 'General', '3': 'Theme', '5': 'Help'})" |
190 | | - ] |
191 | | - }, |
192 | | - "metadata": {}, |
193 | | - "output_type": "display_data" |
194 | | - } |
195 | | - ], |
| 69 | + "outputs": [], |
196 | 70 | "source": [ |
197 | 71 | "v.system()" |
198 | 72 | ] |
|
219 | 93 | }, |
220 | 94 | { |
221 | 95 | "cell_type": "code", |
222 | | - "execution_count": 3, |
| 96 | + "execution_count": null, |
223 | 97 | "metadata": { |
224 | 98 | "scrolled": false |
225 | 99 | }, |
226 | | - "outputs": [ |
227 | | - { |
228 | | - "name": "stdout", |
229 | | - "output_type": "stream", |
230 | | - "text": [ |
231 | | - "Reading molecules from '['data/complex.pdb']'\n", |
232 | | - "Rendering the molecules...\n" |
233 | | - ] |
234 | | - }, |
235 | | - { |
236 | | - "data": { |
237 | | - "application/vnd.jupyter.widget-view+json": { |
238 | | - "model_id": "40ce5f04f4c24f418d4bcb5fce83c6dc", |
239 | | - "version_major": 2, |
240 | | - "version_minor": 0 |
241 | | - }, |
242 | | - "text/html": [ |
243 | | - "<p>Failed to display Jupyter Widget of type <code>NGLWidget</code>.</p>\n", |
244 | | - "<p>\n", |
245 | | - " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", |
246 | | - " that the widgets JavaScript is still loading. If this message persists, it\n", |
247 | | - " likely means that the widgets JavaScript library is either not installed or\n", |
248 | | - " not enabled. See the <a href=\"https://ipywidgets.readthedocs.io/en/stable/user_install.html\">Jupyter\n", |
249 | | - " Widgets Documentation</a> for setup instructions.\n", |
250 | | - "</p>\n", |
251 | | - "<p>\n", |
252 | | - " If you're reading this message in another frontend (for example, a static\n", |
253 | | - " rendering on GitHub or <a href=\"https://nbviewer.jupyter.org/\">NBViewer</a>),\n", |
254 | | - " it may mean that your frontend doesn't currently support widgets.\n", |
255 | | - "</p>\n" |
256 | | - ], |
257 | | - "text/plain": [ |
258 | | - "NGLWidget()" |
259 | | - ] |
260 | | - }, |
261 | | - "metadata": {}, |
262 | | - "output_type": "display_data" |
263 | | - }, |
264 | | - { |
265 | | - "data": { |
266 | | - "application/vnd.jupyter.widget-view+json": { |
267 | | - "model_id": "0a324a2d0f9f4c01bb18119aa0c91f12", |
268 | | - "version_major": 2, |
269 | | - "version_minor": 0 |
270 | | - }, |
271 | | - "text/html": [ |
272 | | - "<p>Failed to display Jupyter Widget of type <code>Tab</code>.</p>\n", |
273 | | - "<p>\n", |
274 | | - " If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n", |
275 | | - " that the widgets JavaScript is still loading. If this message persists, it\n", |
276 | | - " likely means that the widgets JavaScript library is either not installed or\n", |
277 | | - " not enabled. See the <a href=\"https://ipywidgets.readthedocs.io/en/stable/user_install.html\">Jupyter\n", |
278 | | - " Widgets Documentation</a> for setup instructions.\n", |
279 | | - "</p>\n", |
280 | | - "<p>\n", |
281 | | - " If you're reading this message in another frontend (for example, a static\n", |
282 | | - " rendering on GitHub or <a href=\"https://nbviewer.jupyter.org/\">NBViewer</a>),\n", |
283 | | - " it may mean that your frontend doesn't currently support widgets.\n", |
284 | | - "</p>\n" |
285 | | - ], |
286 | | - "text/plain": [ |
287 | | - "Tab(children=(Box(children=(Box(children=(Box(children=(Label(value='step'), IntSlider(value=1, min=-100)), layout=Layout(display='flex', flex_flow='row', justify_content='space-between')), Box(children=(Label(value='delay'), IntSlider(value=100, max=1000, min=10)), layout=Layout(display='flex', flex_flow='row', justify_content='space-between')), Box(children=(Label(value='background'), ColorPicker(value='white')), layout=Layout(display='flex', flex_flow='row', justify_content='space-between')), Box(children=(Label(value='camera'), Dropdown(options=('perspective', 'orthographic'), value='perspective')), layout=Layout(display='flex', flex_flow='row', justify_content='space-between')), Box(children=(Label(value=''), HBox(children=(ToggleButton(value=False, description='Smoothing', tooltip='smoothing trajectory'), Button(description=' Center', icon='bullseye', style=ButtonStyle()), Button(description=' Screenshot', icon='camera', style=ButtonStyle()), Button(description='qtconsole', style=ButtonStyle(), tooltip='pop up qtconsole')), layout=Layout(flex='1 1 auto', width='auto'))), layout=Layout(display='flex', flex_flow='row', justify_content='space-between'))), layout=Layout(align_items='stretch', display='flex', flex_flow='column', width='100%')),)), Box(), Box(), Box(), Box(), Box()), layout=Layout(align_items='stretch', align_self='center'), _titles={'1': 'Representation', '4': 'Extra', '2': 'Preference', '0': 'General', '3': 'Theme', '5': 'Help'})" |
288 | | - ] |
289 | | - }, |
290 | | - "metadata": {}, |
291 | | - "output_type": "display_data" |
292 | | - } |
293 | | - ], |
| 100 | + "outputs": [], |
294 | 101 | "source": [ |
295 | 102 | "v = viewMolecules(\"data/complex.pdb\")" |
296 | 103 | ] |
|
311 | 118 | "\n", |
312 | 119 | "\n", |
313 | 120 | "\n", |
314 | | - "The selection box can be used to select proteins (\"protein\"), everything (\"*\") or residues by name (e.g. \"LIG\") or number (e.g. \"35\"). Play around creating different selections and representations. For example, create a \"tube\" representation of the protein and a \"licorice\" representation of all alanine residues. Note - you can control the opacity (level of transparency) of a representation by selecting the representation in the drop down box and changing the \"opacity\" slider in the \"Parameters\" tab - see below.\n", |
| 121 | + "The selection box can be used to select proteins (\"protein\"), water (\"water\"), everything (\"*\") or residues by name (e.g. \"LIG\") or number (e.g. \"35\"). Play around creating different selections and representations. For example, create a \"point\" representation for water, a \"tube\" representation of the protein and a \"licorice\" representation of all alanine residues. Note - you can control the opacity (level of transparency) of a representation by selecting the representation in the drop down box and changing the \"opacity\" slider in the \"Parameters\" tab - see below. You can also change things like the colour scheme of the representation in this \"Parameters\" tab\n", |
315 | 122 | "\n", |
316 | 123 | "" |
317 | 124 | ] |
318 | 125 | }, |
| 126 | + { |
| 127 | + "cell_type": "markdown", |
| 128 | + "metadata": {}, |
| 129 | + "source": [ |
| 130 | + "# Viewing individual molecules\n", |
| 131 | + "\n", |
| 132 | + "The view object returned by BioSimSpace can be used to view specific molecules from the file. To do this, use the `molecules` function. This takes a list of indicies of the molecules you want to view. For example, to view the first molecule (molecule at index 0) type;" |
| 133 | + ] |
| 134 | + }, |
319 | 135 | { |
320 | 136 | "cell_type": "code", |
321 | 137 | "execution_count": null, |
322 | 138 | "metadata": {}, |
323 | 139 | "outputs": [], |
324 | | - "source": [] |
| 140 | + "source": [ |
| 141 | + "v.molecules([0])" |
| 142 | + ] |
| 143 | + }, |
| 144 | + { |
| 145 | + "cell_type": "markdown", |
| 146 | + "metadata": {}, |
| 147 | + "source": [ |
| 148 | + "while to view molecules 100-1000 use the below code (noting that you may need to add a \"ball and stick\" represntation in case nglview automatically hides the water molecules)." |
| 149 | + ] |
| 150 | + }, |
| 151 | + { |
| 152 | + "cell_type": "code", |
| 153 | + "execution_count": null, |
| 154 | + "metadata": {}, |
| 155 | + "outputs": [], |
| 156 | + "source": [ |
| 157 | + "v.molecules( range(100,1000) )" |
| 158 | + ] |
| 159 | + }, |
| 160 | + { |
| 161 | + "cell_type": "markdown", |
| 162 | + "metadata": {}, |
| 163 | + "source": [ |
| 164 | + "# Loading more complex files\n", |
| 165 | + "\n", |
| 166 | + "BioSimSpace provides reader and writers for a variety of molecular file formats. Some of these split the molecular data over multiple files, e.g. a topology and coordinate file. To view these, pass all of the necessary files to `viewMolecules` in a list, e.g." |
| 167 | + ] |
| 168 | + }, |
| 169 | + { |
| 170 | + "cell_type": "code", |
| 171 | + "execution_count": null, |
| 172 | + "metadata": {}, |
| 173 | + "outputs": [], |
| 174 | + "source": [ |
| 175 | + "v = viewMolecules([\"data/ala.top\",\"data/ala.crd\"])" |
| 176 | + ] |
| 177 | + }, |
| 178 | + { |
| 179 | + "cell_type": "markdown", |
| 180 | + "metadata": {}, |
| 181 | + "source": [ |
| 182 | + "This can be combined with molecule selection, e.g. to load and view only molecules 0-4 in the file pass the indicies of the molecules you want to view as a second argument to `viewMolecule`, e.g." |
| 183 | + ] |
| 184 | + }, |
| 185 | + { |
| 186 | + "cell_type": "code", |
| 187 | + "execution_count": null, |
| 188 | + "metadata": {}, |
| 189 | + "outputs": [], |
| 190 | + "source": [ |
| 191 | + "v = viewMolecules([\"data/ala.top\",\"data/ala.crd\"], [0,1,2,3,4])" |
| 192 | + ] |
| 193 | + }, |
| 194 | + { |
| 195 | + "cell_type": "markdown", |
| 196 | + "metadata": {}, |
| 197 | + "source": [ |
| 198 | + "(in reality, all molecules are loaded, but only molecules specified by the indicies are viewed. You can still use `v.system()` to view all molecules)" |
| 199 | + ] |
| 200 | + }, |
| 201 | + { |
| 202 | + "cell_type": "code", |
| 203 | + "execution_count": null, |
| 204 | + "metadata": {}, |
| 205 | + "outputs": [], |
| 206 | + "source": [ |
| 207 | + "v.system()" |
| 208 | + ] |
325 | 209 | } |
326 | 210 | ], |
327 | 211 | "metadata": { |
|
0 commit comments