Skip to content

Commit

Permalink
update notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
hainm committed Nov 28, 2024
1 parent addc8ea commit 0ae26f3
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 47 deletions.
62 changes: 37 additions & 25 deletions examples/notebooks/export_image.ipynb

Large diffs are not rendered by default.

37 changes: 25 additions & 12 deletions examples/notebooks/multiple_ligand_view.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,22 @@
"cells": [
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 1,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "0f5e3dc3cacc4876b00d08657b55e16f",
"version_major": 2,
"version_minor": 0
},
"text/plain": []
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import nglview as nv\n",
"import parmed as pmd\n",
Expand All @@ -13,7 +26,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand All @@ -22,7 +35,7 @@
"text": [
" % Total % Received % Xferd Average Speed Time Time Time Current\n",
" Dload Upload Total Spent Left Speed\n",
"100 9810 100 9810 0 0 68409 0 --:--:-- --:--:-- --:--:-- 68601\n",
"100 9810 100 9810 0 0 38981 0 --:--:-- --:--:-- --:--:-- 39083\n",
"curl: (6) Could not resolve host: 5ht3ligs.sdf\n"
]
},
Expand All @@ -35,7 +48,7 @@
" <Structure 26 atoms; 1 residues; 29 bonds; NOT parameterized>]"
]
},
"execution_count": 10,
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -48,21 +61,21 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "74b824240097468d9ee5abd7add17658",
"model_id": "a46aed66f3a3465dbcccd21b90a9c872",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(NGLWidget(), IntSlider(value=0, max=3)))"
]
},
"execution_count": 11,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -75,15 +88,15 @@
"def show_one_ligand(change):\n",
" val = change['new']\n",
" view.show_only([val])\n",
" \n",
"\n",
"slider.observe(show_one_ligand, 'value')\n",
"\n",
"VBox([view, slider])"
]
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -95,7 +108,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand All @@ -109,7 +122,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.14"
"version": "3.12.7"
}
},
"nbformat": 4,
Expand Down
30 changes: 20 additions & 10 deletions examples/notebooks/xray.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@
"cells": [
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"xray_fn: ../../../ngl/data//JMJD2DA-x336_event2.ccp4.gz\n",
"pdb_fn: ../../../ngl/data//JMJD2DA-x336_event2.pdb\n"
]
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "f0deeaadf3f24712a5d957adf407b6a6",
"version_major": "2",
"version_minor": "0"
"model_id": "4563540fbcc24d34ba0a2f75d28a7456",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"A Jupyter Widget"
"NGLWidget(background='black')"
]
},
"metadata": {},
Expand All @@ -24,9 +32,11 @@
"import nglview\n",
"\n",
"view = nglview.NGLWidget()\n",
"data_dir = '../ngl/data/'\n",
"data_dir = '../../../ngl/data/'\n",
"pdb_fn = data_dir + '/JMJD2DA-x336_event2.pdb'\n",
"xray_fn = data_dir + '/JMJD2DA-x336_event2.ccp4.gz'\n",
"print('xray_fn:', xray_fn)\n",
"print('pdb_fn:', pdb_fn)\n",
"view.add_component(xray_fn)\n",
"view.add_component(pdb_fn)\n",
"view.background = 'black'\n",
Expand All @@ -37,7 +47,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 7,
"metadata": {
"collapsed": true
},
Expand All @@ -48,7 +58,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 8,
"metadata": {
"collapsed": true
},
Expand All @@ -68,7 +78,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "base",
"language": "python",
"name": "python3"
},
Expand All @@ -82,7 +92,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
"version": "3.12.7"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 0ae26f3

Please sign in to comment.