|
4 | 4 | "cell_type": "markdown", |
5 | 5 | "metadata": {}, |
6 | 6 | "source": [ |
7 | | - "# Dynophore notebook\n", |
| 7 | + "# Dynophore notebook" |
| 8 | + ] |
| 9 | + }, |
| 10 | + { |
| 11 | + "cell_type": "markdown", |
| 12 | + "metadata": {}, |
| 13 | + "source": [ |
| 14 | + "## Introduction" |
| 15 | + ] |
| 16 | + }, |
| 17 | + { |
| 18 | + "cell_type": "markdown", |
| 19 | + "metadata": {}, |
| 20 | + "source": [ |
| 21 | + "### What is a dynophore?\n", |
8 | 22 | "\n", |
9 | | - "This notebook contains the following dynophore analyses:\n", |
| 23 | + "* A **dynophore** is a collection of so-called superfeatures. \n", |
| 24 | + "* A **superfeature** is defined as a pharmacophore feature on the ligand side — defined by a feature type and one or more ligand atoms — that occurs at least once during an MD simulation. Example: HBA[4618] (feature type, ligand atom numbers)\n", |
| 25 | + "* A superfeature has a **point cloud**, where each point corresponds to the centroid of feature during one frame of the trajectory.\n", |
| 26 | + "* A superfeature can have one or more interaction partner(s) on the macromolecule side. These interaction partners are called **environmental partners**. Example: GLN-131-A[2057] (residue name, residue number, chain, atom serial numbers)." |
| 27 | + ] |
| 28 | + }, |
| 29 | + { |
| 30 | + "cell_type": "markdown", |
| 31 | + "metadata": {}, |
| 32 | + "source": [ |
| 33 | + "### How to work with a dynophore?\n", |
10 | 34 | "\n", |
11 | | - "- __2D view__ of the dynophore's superfeatures mapped onto the structure-bound ligand using `rdkit`.\n", |
12 | | - "- __3D view__ of the dynophore's point clouds (one cloud per superfeature) using `nglview` allows easy visual inspection of the dynamic macromolecule-ligand interactions. Point clouds are rendered alongside the topology and (optionally) the trajectory underlying the dynophore.\n", |
13 | | - "- __Statistics__ cover the occurrence of superfeatures and their environmental partners as well as distances between them.\n", |
14 | | - "- __Dynophore data__ can be further analyzed conveniently right here in this notebook by working with the `Dynophore` class." |
| 35 | + "* **Dynophore raw data** can be analyzed conveniently right here in this notebook by working with the `Dynophore` class.\n", |
| 36 | + "* **Dynophore 2D view** shows all superfeatures on a 2D view of the structure-bound ligand using `rdkit`.\n", |
| 37 | + "* **Dynophore 3D view** maps each superfeature's point cloud in 3D using `nglview`, allowing for an easy visual inspection of the dynamic macromolecule-ligand interactions. Point clouds are rendered alongside the complex structure's topology and (optionally) the trajectory underlying the dynophore.\n", |
| 38 | + "* **Dynophore statistics** cover the occurrence of superfeatures and their environmental partners as well as distances between them." |
15 | 39 | ] |
16 | 40 | }, |
17 | 41 | { |
|
44 | 68 | "import nglview as nv\n", |
45 | 69 | "\n", |
46 | 70 | "# Import Dynophore class - contains all dynophore data\n", |
47 | | - "from dynophores import Dynophore\n", |
48 | | - "\n", |
49 | | - "# Load modules for 3D viewing and plotting\n", |
50 | | - "from dynophores import view2d, view3d, plot" |
| 71 | + "import dynophores as dyno" |
51 | 72 | ] |
52 | 73 | }, |
53 | 74 | { |
54 | 75 | "cell_type": "markdown", |
55 | 76 | "metadata": {}, |
56 | 77 | "source": [ |
57 | | - "## Set paths" |
| 78 | + "## Set data paths" |
58 | 79 | ] |
59 | 80 | }, |
60 | 81 | { |
|
79 | 100 | "cell_type": "markdown", |
80 | 101 | "metadata": {}, |
81 | 102 | "source": [ |
82 | | - "## Load data as `Dynophore` object" |
| 103 | + "## Load data as `Dynophore` object\n", |
| 104 | + "\n", |
| 105 | + "You can load the dynophore data as `Dynophore` object. We will need this object below for visualization purposes but you can also use the raw data for your own customized analyses.\n", |
| 106 | + "\n", |
| 107 | + "__Note__: Check out [this tutorial](https://dynophores.readthedocs.io/en/latest/tutorials/explore_data.html) on the dynophore's data structure." |
83 | 108 | ] |
84 | 109 | }, |
85 | 110 | { |
|
88 | 113 | "metadata": {}, |
89 | 114 | "outputs": [], |
90 | 115 | "source": [ |
91 | | - "dynophore = Dynophore.from_dir(dyno_path)" |
| 116 | + "dynophore = dyno.Dynophore.from_dir(dyno_path)" |
92 | 117 | ] |
93 | 118 | }, |
94 | 119 | { |
95 | 120 | "cell_type": "markdown", |
96 | 121 | "metadata": {}, |
97 | 122 | "source": [ |
98 | | - "__Note__: Check out [this tutorial](https://dynophores.readthedocs.io/en/latest/tutorials/explore_data.html) on the dynophore's data structure." |
99 | | - ] |
100 | | - }, |
101 | | - { |
102 | | - "cell_type": "markdown", |
103 | | - "metadata": {}, |
104 | | - "source": [ |
105 | | - "## 2D view" |
| 123 | + "## 2D view\n", |
| 124 | + "\n", |
| 125 | + "Investigate the dynophore's superfeatures in 2D; display the atom serial numbers (those will show up in the superfeatures' identifiers in the plots below)." |
106 | 126 | ] |
107 | 127 | }, |
108 | 128 | { |
|
111 | 131 | "metadata": {}, |
112 | 132 | "outputs": [], |
113 | 133 | "source": [ |
114 | | - "view2d.interactive.show(dynophore)" |
| 134 | + "dyno.view2d.interactive.show(dynophore)" |
115 | 135 | ] |
116 | 136 | }, |
117 | 137 | { |
118 | 138 | "cell_type": "markdown", |
119 | 139 | "metadata": {}, |
120 | 140 | "source": [ |
121 | | - "## 3D view" |
| 141 | + "## 3D view\n", |
| 142 | + "\n", |
| 143 | + "Investigate the dynophore in 3D - you have different options that you can change in the method signature below:\n", |
| 144 | + "\n", |
| 145 | + "* `pdb_path` and `dcd_path` have been defined at the beginning of this notebook; these are the file paths to your complex structure's topology and trajectory (if you do not want to load the trajectory, set `dcd_path=None`).\n", |
| 146 | + "* `visualization_type`: `spheres` or `points`\n", |
| 147 | + " * [Default] Show each frames features as small spheres with `visualization_type=spheres`.\n", |
| 148 | + " * [Work-In-Progress] Render the dynophore cloud as more burred and connected points using `visualization_type=points` (still has some NGL rendering issues that we cannot fix on our end, see [NGL GitHub issue](https://github.com/nglviewer/ngl/issues/868))\n", |
| 149 | + "* `color_cloud_by_frame`: `False` or `True`\n", |
| 150 | + " * [Default] Color cloud by superfeature type. Example: The points belonging to a HBA-based superfeature will all be colored red.\n", |
| 151 | + " * Color cloud by superfeature type *and* frame index. Example: The points belonging to a HBA-based superfeauture will be colored from red (first frame) to light red (last frame).\n", |
| 152 | + "* `macromolecule_color`: Set a color for the macromolecule; defaults to blue.\n", |
| 153 | + "* `frame_range`: Show a selected frame range only, e.g. `frame_range=[100, 1000]`. By default, all frames are shown with `frame_range=None`.\n", |
| 154 | + "\n", |
| 155 | + "Interact directly with the 3D visualization using the NGL GUI:\n", |
| 156 | + "\n", |
| 157 | + "* Toogle on/off macromolecule > *cartoon*\n", |
| 158 | + "* Toogle on/off ligand > *hyperball*\n", |
| 159 | + "* Toogle on/off pocket residue side chains > *licorice*\n", |
| 160 | + "* Toogle on/off superfeatures > superfeature identifier e.g. *HBA[4618]*\n", |
| 161 | + "* Run trajectory if loaded" |
122 | 162 | ] |
123 | 163 | }, |
124 | 164 | { |
|
127 | 167 | "metadata": {}, |
128 | 168 | "outputs": [], |
129 | 169 | "source": [ |
130 | | - "view = view3d.show(dynophore, pdb_path, dcd_path)\n", |
131 | | - "view.display(gui=True, style=\"ngl\")\n", |
132 | | - "# NOTE: You might need to run this cell twice for the content to show up" |
| 170 | + "view = dyno.view3d.show(\n", |
| 171 | + " dynophore,\n", |
| 172 | + " pdb_path=pdb_path,\n", |
| 173 | + " dcd_path=dcd_path,\n", |
| 174 | + " visualization_type=\"spheres\",\n", |
| 175 | + " color_cloud_by_frame=False,\n", |
| 176 | + " macromolecule_color=\"#005780\",\n", |
| 177 | + " frame_range=None,\n", |
| 178 | + ")\n", |
| 179 | + "view.display(gui=True, style=\"ngl\")" |
133 | 180 | ] |
134 | 181 | }, |
135 | 182 | { |
136 | 183 | "cell_type": "markdown", |
137 | 184 | "metadata": {}, |
138 | 185 | "source": [ |
139 | | - "In case a trajectory is Load the `TrajectoryPlayer` for more visualization options:" |
| 186 | + "In case a trajectory is loaded, use the `TrajectoryPlayer` for more visualization options:" |
140 | 187 | ] |
141 | 188 | }, |
142 | 189 | { |
|
157 | 204 | }, |
158 | 205 | { |
159 | 206 | "cell_type": "markdown", |
160 | | - "metadata": {}, |
| 207 | + "metadata": { |
| 208 | + "tags": [] |
| 209 | + }, |
161 | 210 | "source": [ |
162 | | - "### Plot interactions overview (heatmap)" |
| 211 | + "### Plot interactions overview (heatmap)\n", |
| 212 | + "\n", |
| 213 | + "Check how often each superfeature interacts with which environmental partners throughout the MD simulation (in %)." |
163 | 214 | ] |
164 | 215 | }, |
165 | 216 | { |
|
168 | 219 | "metadata": {}, |
169 | 220 | "outputs": [], |
170 | 221 | "source": [ |
171 | | - "plot.interactive.superfeatures_vs_envpartners(dynophore)" |
| 222 | + "dyno.plot.interactive.superfeatures_vs_envpartners(dynophore)" |
172 | 223 | ] |
173 | 224 | }, |
174 | 225 | { |
175 | 226 | "cell_type": "markdown", |
176 | 227 | "metadata": {}, |
177 | 228 | "source": [ |
178 | | - "### Plot superfeature occurrences (time series)" |
| 229 | + "### Plot superfeature occurrences (time series)\n", |
| 230 | + "\n", |
| 231 | + "Check when (barcode) and how often (in %) a superfeature $S$ occurs throughout the MD simulation.\n", |
| 232 | + "\n", |
| 233 | + "$S\\,\\text{occurrence [%]} = \\frac{\\text{Number of frames in which}\\,S\\,\\text{occurs}}{\\text{Number of frames}} \\times 100$" |
179 | 234 | ] |
180 | 235 | }, |
181 | 236 | { |
|
184 | 239 | "metadata": {}, |
185 | 240 | "outputs": [], |
186 | 241 | "source": [ |
187 | | - "plot.interactive.superfeatures_occurrences(dynophore)" |
| 242 | + "dyno.plot.interactive.superfeatures_occurrences(dynophore)" |
188 | 243 | ] |
189 | 244 | }, |
190 | 245 | { |
|
198 | 253 | "cell_type": "markdown", |
199 | 254 | "metadata": {}, |
200 | 255 | "source": [ |
201 | | - "#### Interaction occurrence" |
| 256 | + "#### Interaction occurrence\n", |
| 257 | + "\n", |
| 258 | + "Check when (barcode) and how often (in %\\) each environmental partner $E$ interacts in context of a superfeature $S$ ($E_S$).\n", |
| 259 | + "\n", |
| 260 | + "$E_S\\,\\text{occurrence [%]} = \\frac{\\text{Number of frames where}\\,E\\,\\text{interacts in context of}\\,S}{\\text{Number of frames where}\\,S\\,\\text{occurs}} \\times 100$" |
202 | 261 | ] |
203 | 262 | }, |
204 | 263 | { |
|
207 | 266 | "metadata": {}, |
208 | 267 | "outputs": [], |
209 | 268 | "source": [ |
210 | | - "plot.interactive.envpartners_occurrences(dynophore)" |
| 269 | + "dyno.plot.interactive.envpartners_occurrences(dynophore)" |
211 | 270 | ] |
212 | 271 | }, |
213 | 272 | { |
214 | 273 | "cell_type": "markdown", |
215 | 274 | "metadata": {}, |
216 | 275 | "source": [ |
217 | | - "#### Interaction distances" |
| 276 | + "#### Interaction distances\n", |
| 277 | + "\n", |
| 278 | + "Check for each superfeature, the distances to all environmental partners throughout the MD simulation. \n", |
| 279 | + "\n", |
| 280 | + "* **Time series**: Distances are shown for all frames regardless of whether that frame shows an interaction between the environmental partner and the superfeature's ligand atoms or not. Interactions are indicated with a dot in the plot.\n", |
| 281 | + "* **Histogram**: Only distances are shown that belong to frames in which an interaction between the environmental partner and the superfeature's ligand atoms ocurrs." |
218 | 282 | ] |
219 | 283 | }, |
220 | 284 | { |
|
223 | 287 | "metadata": {}, |
224 | 288 | "outputs": [], |
225 | 289 | "source": [ |
226 | | - "plot.interactive.envpartners_distances(dynophore)" |
| 290 | + "dyno.plot.interactive.envpartners_distances(dynophore)" |
227 | 291 | ] |
228 | 292 | }, |
229 | 293 | { |
230 | 294 | "cell_type": "markdown", |
231 | 295 | "metadata": {}, |
232 | 296 | "source": [ |
233 | | - "#### Interaction profile (all-in-one)" |
| 297 | + "#### Interaction profile (all-in-one)\n", |
| 298 | + "\n", |
| 299 | + "This is a summary of the plots shown above. Note that in this case *all* distances throughout the MD simulation are shown (regardless of whether the frame shows an interaction or not)." |
234 | 300 | ] |
235 | 301 | }, |
236 | 302 | { |
|
239 | 305 | "metadata": {}, |
240 | 306 | "outputs": [], |
241 | 307 | "source": [ |
242 | | - "plot.interactive.envpartners_all_in_one(dynophore)" |
| 308 | + "dyno.plot.interactive.envpartners_all_in_one(dynophore)" |
243 | 309 | ] |
244 | 310 | } |
245 | 311 | ], |
|
0 commit comments