Jupyter Notebook AMBER MD Setup tutorial
Help improve this workflow!
This workflow has been published but could be further improved with some additional meta data:- Keyword(s) in categories input, output
You can help improve this workflow by suggesting the addition or removal of keywords, suggest changes and report issues, or request to become a maintainer of the Workflow .
Based on the official GROMACS tutorial .
This tutorials aim to illustrate the process of setting up a simulation system containing a protein , step by step, using the BioExcel Building Blocks library (biobb) wrapping the Ambertools MD package .
Settings
Biobb modules used
-
biobb_io : Tools to fetch biomolecular data from public databases.
-
biobb_amber : Tools to setup and run Molecular Dynamics simulations using the Ambertools MD package.
-
biobb_analysis : Tools to analyse Molecular Dynamics trajectories.
-
biobb_structure_utils : Tools to modify or extract information from a PDB structure file.
-
biobb_chemistry : Tools to to perform chemical conversions.
Auxiliar libraries used
-
nb_conda_kernels : Enables a Jupyter Notebook or JupyterLab application in one conda environment to access kernels for Python, R, and other languages found in other environments.
-
jupyter_contrib_nbextensions : Contains a collection of community-contributed unofficial extensions that add functionality to the Jupyter notebook.
-
nglview : Jupyter/IPython widget to interactively view molecular structures and trajectories in notebooks.
-
ipywidgets : Interactive HTML widgets for Jupyter notebooks and the IPython kernel.
-
plotly : Python interactive graphing library integrated in Jupyter notebooks.
-
simpletraj : Lightweight coordinate-only trajectory reader based on code from GROMACS, MDAnalysis and VMD.
-
gfortran : Fortran 95/2003/2008/2018 compiler for GCC, the GNU Compiler Collection.
Conda Installation
Take into account that, for this specific workflow, there are two environment files, one for linux OS and the other for mac OS:
linux
git clone https://github.com/bioexcel/biobb_wf_amber_md_setup.git
cd biobb_wf_amber_md_setup
conda env create -f conda_env/environment.linux.yml
conda activate biobb_AMBER_MDsetup_tutorials
jupyter nbextension enable python-markdown/main
macos
git clone https://github.com/bioexcel/biobb_wf_amber_md_setup.git
cd biobb_wf_amber_md_setup
conda env create -f conda_env/environment.macos.yml
conda activate biobb_AMBER_MDsetup_tutorials
jupyter nbextension enable python-markdown/main
Please execute the following commands before launching the Jupyter Notebook if you experience some issues with widgets such as NGL View (3D molecular visualization):
jupyter-nbextension enable --py --user widgetsnbextension
jupyter-nbextension enable --py --user nglview
Launch
Protein MD Setup tutorial
jupyter-notebook biobb_wf_amber_md_setup/notebooks/mdsetup/biobb_amber_setup_notebook.ipynb
Protein-Ligand Complex MD Setup tutorial
jupyter-notebook biobb_wf_amber_md_setup/notebooks/mdsetup_lig/biobb_amber_complex_setup_notebook.ipynb
Constant pH MD Setup tutorial
jupyter-notebook biobb_wf_amber_md_setup/notebooks/mdsetup_ph/biobb_amber_CpHMD_notebook.ipynb
ABC MD Setup tutorial
jupyter-notebook biobb_wf_amber_md_setup/notebooks/abcsetup/biobb_amber_ABC_setup.ipynb
Version
2023.3 Release
Copyright & Licensing
This software has been developed in the MMB group at the BSC & IRB for the European BioExcel , funded by the European Commission (EU H2020 823830 , EU H2020 675728 ).
-
(c) 2015-2023 Barcelona Supercomputing Center
-
(c) 2015-2023 Institute for Research in Biomedicine
Licensed under the Apache License 2.0 , see the file LICENSE for details.
Code Snippets
2 3 4 5 6 7 8 | import nglview import ipywidgets import plotly from plotly import subplots import plotly.graph_objs as go pdbCode = "1aki" |
12 13 14 15 16 17 18 19 20 21 22 23 24 | # Import module from biobb_io.api.pdb import pdb # Create properties dict and inputs/outputs downloaded_pdb = pdbCode+'.pdb' prop = { 'pdb_code': pdbCode } #Create and launch bb pdb(output_pdb_path=downloaded_pdb, properties=prop) |
28 29 30 31 32 | # Show protein view = nglview.show_structure_file(downloaded_pdb) view.add_representation(repr_type='ball+stick', selection='all') view._remote_call('setSize', target='Widget', args=['','600px']) view |
36 37 38 39 40 41 42 43 44 | # Import module from biobb_amber.pdb4amber.pdb4amber_run import pdb4amber_run # Create prop dict and inputs/outputs output_pdb4amber_path = 'structure.pdb4amber.pdb' # Create and launch bb pdb4amber_run( input_pdb_path=downloaded_pdb, output_pdb_path=output_pdb4amber_path) |
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | # Import module from biobb_amber.leap.leap_gen_top import leap_gen_top # Create prop dict and inputs/outputs output_pdb_path = 'structure.leap.pdb' output_top_path = 'structure.leap.top' output_crd_path = 'structure.leap.crd' prop = { "forcefield" : ["protein.ff14SB"] } # Create and launch bb leap_gen_top(input_pdb_path=output_pdb4amber_path, #input_pdb_path=downloaded_pdb, output_pdb_path=output_pdb_path, output_top_path=output_top_path, output_crd_path=output_crd_path, properties=prop) |
70 71 72 73 74 | # Show protein view = nglview.show_structure_file(output_pdb_path) view.add_representation(repr_type='ball+stick', selection='all') view._remote_call('setSize', target='Widget', args=['','600px']) view |
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 | # Import module from biobb_amber.sander.sander_mdrun import sander_mdrun # Create prop dict and inputs/outputs output_h_min_traj_path = 'sander.h_min.x' output_h_min_rst_path = 'sander.h_min.rst' output_h_min_log_path = 'sander.h_min.log' prop = { 'simulation_type' : "min_vacuo", "mdin" : { 'maxcyc' : 500, 'ntpr' : 5, 'ntr' : 1, 'restraintmask' : '\":*&!@H=\"', 'restraint_wt' : 50.0 } } # Create and launch bb sander_mdrun(input_top_path=output_top_path, input_crd_path=output_crd_path, input_ref_path=output_crd_path, output_traj_path=output_h_min_traj_path, output_rst_path=output_h_min_rst_path, output_log_path=output_h_min_log_path, properties=prop) |
108 109 110 111 112 113 114 115 116 117 118 119 120 121 | # Import module from biobb_amber.process.process_minout import process_minout # Create prop dict and inputs/outputs output_h_min_dat_path = 'sander.h_min.energy.dat' prop = { "terms" : ['ENERGY'] } # Create and launch bb process_minout(input_log_path=output_h_min_log_path, output_dat_path=output_h_min_dat_path, properties=prop) |
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | #Read data from file and filter energy values higher than 1000 Kj/mol^-1 with open(output_h_min_dat_path,'r') as energy_file: x,y = map( list, zip(*[ (float(line.split()[0]),float(line.split()[1])) for line in energy_file if not line.startswith(("#","@")) if float(line.split()[1]) < 1000 ]) ) plotly.offline.init_notebook_mode(connected=True) fig = { "data": [go.Scatter(x=x, y=y)], "layout": go.Layout(title="Energy Minimization", xaxis=dict(title = "Energy Minimization Step"), yaxis=dict(title = "Potential Energy kcal/mol") ) } plotly.offline.iplot(fig) |
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 | # Import module from biobb_amber.sander.sander_mdrun import sander_mdrun # Create prop dict and inputs/outputs output_n_min_traj_path = 'sander.n_min.x' output_n_min_rst_path = 'sander.n_min.rst' output_n_min_log_path = 'sander.n_min.log' prop = { 'simulation_type' : "min_vacuo", "mdin" : { 'maxcyc' : 500, 'ntpr' : 5, 'ntr' : 1, 'restraintmask' : '\":*&!@H=\"', 'restraint_wt' : 50.0 } } # Create and launch bb sander_mdrun(input_top_path=output_top_path, input_crd_path=output_h_min_rst_path, input_ref_path=output_h_min_rst_path, output_traj_path=output_n_min_traj_path, output_rst_path=output_n_min_rst_path, output_log_path=output_n_min_log_path, properties=prop) |
181 182 183 184 185 186 187 188 189 190 191 192 193 194 | # Import module from biobb_amber.process.process_minout import process_minout # Create prop dict and inputs/outputs output_n_min_dat_path = 'sander.n_min.energy.dat' prop = { "terms" : ['ENERGY'] } # Create and launch bb process_minout(input_log_path=output_n_min_log_path, output_dat_path=output_n_min_dat_path, properties=prop) |
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | #Read data from file and filter energy values higher than 1000 Kj/mol^-1 with open(output_n_min_dat_path,'r') as energy_file: x,y = map( list, zip(*[ (float(line.split()[0]),float(line.split()[1])) for line in energy_file if not line.startswith(("#","@")) if float(line.split()[1]) < 1000 ]) ) plotly.offline.init_notebook_mode(connected=True) fig = { "data": [go.Scatter(x=x, y=y)], "layout": go.Layout(title="Energy Minimization", xaxis=dict(title = "Energy Minimization Step"), yaxis=dict(title = "Potential Energy kcal/mol") ) } plotly.offline.iplot(fig) |
224 225 226 227 228 229 230 231 232 233 234 | # Import module from biobb_amber.ambpdb.amber_to_pdb import amber_to_pdb # Create prop dict and inputs/outputs output_ambpdb_path = 'structure.ambpdb.pdb' # Create and launch bb amber_to_pdb(input_top_path=output_top_path, input_crd_path=output_h_min_rst_path, output_pdb_path=output_ambpdb_path ) |
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | # Import module from biobb_amber.leap.leap_solvate import leap_solvate # Create prop dict and inputs/outputs output_solv_pdb_path = 'structure.solv.pdb' output_solv_top_path = 'structure.solv.parmtop' output_solv_crd_path = 'structure.solv.crd' prop = { "forcefield" : ["protein.ff14SB"], "water_type": "TIP3PBOX", "distance_to_molecule": "9.0", "box_type": "truncated_octahedron" } # Create and launch bb leap_solvate(input_pdb_path=output_ambpdb_path, output_pdb_path=output_solv_pdb_path, output_top_path=output_solv_top_path, output_crd_path=output_solv_crd_path, properties=prop) |
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | # Import module from biobb_amber.leap.leap_add_ions import leap_add_ions # Create prop dict and inputs/outputs output_ions_pdb_path = 'structure.ions.pdb' output_ions_top_path = 'structure.ions.parmtop' output_ions_crd_path = 'structure.ions.crd' prop = { "forcefield" : ["protein.ff14SB"], "neutralise" : True, "positive_ions_type": "Na+", "negative_ions_type": "Cl-", "ionic_concentration" : 150, # 150mM "box_type": "truncated_octahedron" } # Create and launch bb leap_add_ions(input_pdb_path=output_solv_pdb_path, output_pdb_path=output_ions_pdb_path, output_top_path=output_ions_top_path, output_crd_path=output_ions_crd_path, properties=prop) |
288 289 290 291 292 293 294 295 | # Show protein view = nglview.show_structure_file(output_ions_pdb_path) view.clear_representations() view.add_representation(repr_type='cartoon', selection='protein') view.add_representation(repr_type='ball+stick', selection='solvent') view.add_representation(repr_type='spacefill', selection='Cl- Na+') view._remote_call('setSize', target='Widget', args=['','600px']) view |
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | # Import module from biobb_amber.sander.sander_mdrun import sander_mdrun # Create prop dict and inputs/outputs output_min_traj_path = 'sander.min.x' output_min_rst_path = 'sander.min.rst' output_min_log_path = 'sander.min.log' prop = { "simulation_type" : "minimization", "mdin" : { 'maxcyc' : 300, # Reducing the number of minimization steps for the sake of time 'ntr' : 1, # Overwritting restrain parameter 'restraintmask' : '\"!:WAT,Cl-,Na+\"', # Restraining solute 'restraint_wt' : 50.0 # With a force constant of 50 Kcal/mol*A2 } } # Create and launch bb sander_mdrun(input_top_path=output_ions_top_path, input_crd_path=output_ions_crd_path, input_ref_path=output_ions_crd_path, output_traj_path=output_min_traj_path, output_rst_path=output_min_rst_path, output_log_path=output_min_log_path, properties=prop) |
328 329 330 331 332 333 334 335 336 337 338 339 340 341 | # Import module from biobb_amber.process.process_minout import process_minout # Create prop dict and inputs/outputs output_dat_path = 'sander.min.energy.dat' prop = { "terms" : ['ENERGY'] } # Create and launch bb process_minout(input_log_path=output_min_log_path, output_dat_path=output_dat_path, properties=prop) |
345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 | #Read data from file and filter energy values higher than 1000 Kj/mol^-1 with open(output_dat_path,'r') as energy_file: x,y = map( list, zip(*[ (float(line.split()[0]),float(line.split()[1])) for line in energy_file if not line.startswith(("#","@")) if float(line.split()[1]) < 1000 ]) ) plotly.offline.init_notebook_mode(connected=True) fig = { "data": [go.Scatter(x=x, y=y)], "layout": go.Layout(title="Energy Minimization", xaxis=dict(title = "Energy Minimization Step"), yaxis=dict(title = "Potential Energy kcal/mol") ) } plotly.offline.iplot(fig) |
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | # Import module from biobb_amber.sander.sander_mdrun import sander_mdrun # Create prop dict and inputs/outputs output_heat_traj_path = 'sander.heat.netcdf' output_heat_rst_path = 'sander.heat.rst' output_heat_log_path = 'sander.heat.log' prop = { "simulation_type" : "heat", "mdin" : { 'nstlim' : 2500, # Reducing the number of steps for the sake of time (5ps) 'ntr' : 1, # Overwritting restrain parameter 'restraintmask' : '\"!:WAT,Cl-,Na+\"', # Restraining solute 'restraint_wt' : 10.0 # With a force constant of 10 Kcal/mol*A2 } } # Create and launch bb sander_mdrun(input_top_path=output_ions_top_path, input_crd_path=output_min_rst_path, input_ref_path=output_min_rst_path, output_traj_path=output_heat_traj_path, output_rst_path=output_heat_rst_path, output_log_path=output_heat_log_path, properties=prop) |
400 401 402 403 404 405 406 407 408 409 410 411 412 413 | # Import module from biobb_amber.process.process_mdout import process_mdout # Create prop dict and inputs/outputs output_dat_heat_path = 'sander.md.temp.dat' prop = { "terms" : ['TEMP'] } # Create and launch bb process_mdout(input_log_path=output_heat_log_path, output_dat_path=output_dat_heat_path, properties=prop) |
417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 | #Read data from file and filter energy values higher than 1000 Kj/mol^-1 with open(output_dat_heat_path,'r') as energy_file: x,y = map( list, zip(*[ (float(line.split()[0]),float(line.split()[1])) for line in energy_file if not line.startswith(("#","@")) if float(line.split()[1]) < 1000 ]) ) plotly.offline.init_notebook_mode(connected=True) fig = { "data": [go.Scatter(x=x, y=y)], "layout": go.Layout(title="Heating process", xaxis=dict(title = "Heating Step (ps)"), yaxis=dict(title = "Temperature (K)") ) } plotly.offline.iplot(fig) |
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | # Import module from biobb_amber.sander.sander_mdrun import sander_mdrun # Create prop dict and inputs/outputs output_nvt_traj_path = 'sander.nvt.netcdf' output_nvt_rst_path = 'sander.nvt.rst' output_nvt_log_path = 'sander.nvt.log' prop = { "simulation_type" : 'nvt', "mdin" : { 'nstlim' : 500, # Reducing the number of steps for the sake of time (1ps) 'ntr' : 1, # Overwritting restrain parameter 'restraintmask' : '\"!:WAT,Cl-,Na+ & !@H=\"', # Restraining solute heavy atoms 'restraint_wt' : 5.0 # With a force constant of 5 Kcal/mol*A2 } } # Create and launch bb sander_mdrun(input_top_path=output_ions_top_path, input_crd_path=output_heat_rst_path, input_ref_path=output_heat_rst_path, output_traj_path=output_nvt_traj_path, output_rst_path=output_nvt_rst_path, output_log_path=output_nvt_log_path, properties=prop) |
472 473 474 475 476 477 478 479 480 481 482 483 484 485 | # Import module from biobb_amber.process.process_mdout import process_mdout # Create prop dict and inputs/outputs output_dat_nvt_path = 'sander.md.nvt.temp.dat' prop = { "terms" : ['TEMP'] } # Create and launch bb process_mdout(input_log_path=output_nvt_log_path, output_dat_path=output_dat_nvt_path, properties=prop) |
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 | #Read data from file and filter energy values higher than 1000 Kj/mol^-1 with open(output_dat_nvt_path,'r') as energy_file: x,y = map( list, zip(*[ (float(line.split()[0]),float(line.split()[1])) for line in energy_file if not line.startswith(("#","@")) if float(line.split()[1]) < 1000 ]) ) plotly.offline.init_notebook_mode(connected=True) fig = { "data": [go.Scatter(x=x, y=y)], "layout": go.Layout(title="NVT equilibration", xaxis=dict(title = "Equilibration Step (ps)"), yaxis=dict(title = "Temperature (K)") ) } plotly.offline.iplot(fig) |
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | # Import module from biobb_amber.sander.sander_mdrun import sander_mdrun # Create prop dict and inputs/outputs output_npt_traj_path = 'sander.npt.netcdf' output_npt_rst_path = 'sander.npt.rst' output_npt_log_path = 'sander.npt.log' prop = { "simulation_type" : 'npt', "mdin" : { 'nstlim' : 500, # Reducing the number of steps for the sake of time (1ps) 'ntr' : 1, # Overwritting restrain parameter 'restraintmask' : '\"!:WAT,Cl-,Na+ & !@H=\"', # Restraining solute heavy atoms 'restraint_wt' : 2.5 # With a force constant of 2.5 Kcal/mol*A2 } } # Create and launch bb sander_mdrun(input_top_path=output_ions_top_path, input_crd_path=output_nvt_rst_path, input_ref_path=output_nvt_rst_path, output_traj_path=output_npt_traj_path, output_rst_path=output_npt_rst_path, output_log_path=output_npt_log_path, properties=prop) |
544 545 546 547 548 549 550 551 552 553 554 555 556 557 | # Import module from biobb_amber.process.process_mdout import process_mdout # Create prop dict and inputs/outputs output_dat_npt_path = 'sander.md.npt.dat' prop = { "terms" : ['PRES','DENSITY'] } # Create and launch bb process_mdout(input_log_path=output_npt_log_path, output_dat_path=output_dat_npt_path, properties=prop) |
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 | # Read pressure and density data from file with open(output_dat_npt_path,'r') as pd_file: x,y,z = map( list, zip(*[ (float(line.split()[0]),float(line.split()[1]),float(line.split()[2])) for line in pd_file if not line.startswith(("#","@")) ]) ) plotly.offline.init_notebook_mode(connected=True) trace1 = go.Scatter( x=x,y=y ) trace2 = go.Scatter( x=x,y=z ) fig = subplots.make_subplots(rows=1, cols=2, print_grid=False) fig.append_trace(trace1, 1, 1) fig.append_trace(trace2, 1, 2) fig['layout']['xaxis1'].update(title='Time (ps)') fig['layout']['xaxis2'].update(title='Time (ps)') fig['layout']['yaxis1'].update(title='Pressure (bar)') fig['layout']['yaxis2'].update(title='Density (Kg*m^-3)') fig['layout'].update(title='Pressure and Density during NPT Equilibration') fig['layout'].update(showlegend=False) plotly.offline.iplot(fig) |
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 | # Import module from biobb_amber.sander.sander_mdrun import sander_mdrun # Create prop dict and inputs/outputs output_free_traj_path = 'sander.free.netcdf' output_free_rst_path = 'sander.free.rst' output_free_log_path = 'sander.free.log' prop = { "simulation_type" : 'free', "mdin" : { 'nstlim' : 2500, # Reducing the number of steps for the sake of time (5ps) 'ntwx' : 500 # Print coords to trajectory every 500 steps (1 ps) } } # Create and launch bb sander_mdrun(input_top_path=output_ions_top_path, input_crd_path=output_npt_rst_path, output_traj_path=output_free_traj_path, output_rst_path=output_free_rst_path, output_log_path=output_free_log_path, properties=prop) |
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 | # cpptraj_rms: Computing Root Mean Square deviation to analyse structural stability # RMSd against minimized and equilibrated snapshot (backbone atoms) # Import module from biobb_analysis.ambertools.cpptraj_rms import cpptraj_rms # Create prop dict and inputs/outputs output_rms_first = pdbCode+'_rms_first.dat' prop = { 'mask': 'backbone', 'reference': 'first' } # Create and launch bb cpptraj_rms(input_top_path=output_ions_top_path, input_traj_path=output_free_traj_path, output_cpptraj_path=output_rms_first, properties=prop) |
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 | # cpptraj_rms: Computing Root Mean Square deviation to analyse structural stability # RMSd against experimental structure (backbone atoms) # Import module from biobb_analysis.ambertools.cpptraj_rms import cpptraj_rms # Create prop dict and inputs/outputs output_rms_exp = pdbCode+'_rms_exp.dat' prop = { 'mask': 'backbone', 'reference': 'experimental' } # Create and launch bb cpptraj_rms(input_top_path=output_ions_top_path, input_traj_path=output_free_traj_path, output_cpptraj_path=output_rms_exp, input_exp_path=downloaded_pdb, properties=prop) |
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | # Read RMS vs first snapshot data from file with open(output_rms_first,'r') as rms_first_file: x,y = map( list, zip(*[ (float(line.split()[0]),float(line.split()[1])) for line in rms_first_file if not line.startswith(("#","@")) ]) ) # Read RMS vs experimental structure data from file with open(output_rms_exp,'r') as rms_exp_file: x2,y2 = map( list, zip(*[ (float(line.split()[0]),float(line.split()[1])) for line in rms_exp_file if not line.startswith(("#","@")) ]) ) trace1 = go.Scatter( x = x, y = y, name = 'RMSd vs first' ) trace2 = go.Scatter( x = x, y = y2, name = 'RMSd vs exp' ) data = [trace1, trace2] plotly.offline.init_notebook_mode(connected=True) fig = { "data": data, "layout": go.Layout(title="RMSd during free MD Simulation", xaxis=dict(title = "Time (ps)"), yaxis=dict(title = "RMSd (Angstrom)") ) } plotly.offline.iplot(fig) |
719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | # cpptraj_rgyr: Computing Radius of Gyration to measure the protein compactness during the free MD simulation # Import module from biobb_analysis.ambertools.cpptraj_rgyr import cpptraj_rgyr # Create prop dict and inputs/outputs output_rgyr = pdbCode+'_rgyr.dat' prop = { 'mask': 'backbone' } # Create and launch bb cpptraj_rgyr(input_top_path=output_ions_top_path, input_traj_path=output_free_traj_path, output_cpptraj_path=output_rgyr, properties=prop) |
739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 | # Read Rgyr data from file with open(output_rgyr,'r') as rgyr_file: x,y = map( list, zip(*[ (float(line.split()[0]),float(line.split()[1])) for line in rgyr_file if not line.startswith(("#","@")) ]) ) plotly.offline.init_notebook_mode(connected=True) fig = { "data": [go.Scatter(x=x, y=y)], "layout": go.Layout(title="Radius of Gyration", xaxis=dict(title = "Time (ps)"), yaxis=dict(title = "Rgyr (Angstrom)") ) } plotly.offline.iplot(fig) |
764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | # cpptraj_image: "Imaging" the resulting trajectory # Removing water molecules and ions from the resulting structure # Import module from biobb_analysis.ambertools.cpptraj_image import cpptraj_image # Create prop dict and inputs/outputs output_imaged_traj = pdbCode+'_imaged_traj.trr' prop = { 'mask': 'solute', 'format': 'trr' } # Create and launch bb cpptraj_image(input_top_path=output_ions_top_path, input_traj_path=output_free_traj_path, output_cpptraj_path=output_imaged_traj, properties=prop) |
786 787 788 | # Show trajectory view = nglview.show_simpletraj(nglview.SimpletrajTrajectory(output_imaged_traj, output_ambpdb_path), gui=True) view |
Support
- Future updates
Related Workflows





