-
Notifications
You must be signed in to change notification settings - Fork 59
Implement the workflow pipeline #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 139 commits
Commits
Show all changes
148 commits
Select commit
Hold shift + click to select a range
eed8ab8
load_data
xiki-tempula 4f96b58
update
xiki-tempula f05c5dd
update
xiki-tempula 36f107a
update
xiki-tempula 70d56bd
add doc
xiki-tempula d415427
add test
xiki-tempula f814bac
Update mbar_.py
xiki-tempula e197f67
cleanup
xiki-tempula 61c9de2
Merge branch 'master' into workf
xiki-tempula 37a2503
remove dependency for scipy constant
xiki-tempula ba2dcc3
dump test
xiki-tempula 94d7bb6
Update test_workflow.py
xiki-tempula e4f6627
bump test
xiki-tempula 2e0aed0
cleanup
xiki-tempula 5ab748e
Delete result.log
xiki-tempula ddcaa8d
cleanup
xiki-tempula e566131
Merge branch 'workf' of https://github.com/xiki-tempula/alchemlyb int…
xiki-tempula 90d033a
logging is a global variable
xiki-tempula c5a9b44
Revert "logging is a global variable"
xiki-tempula 26e83fb
move some part to other PR
xiki-tempula eff7981
clean up
xiki-tempula 71524fc
Merge branch 'master' into workf
xiki-tempula ea6b834
bump coverage
xiki-tempula f4b736c
dump coverage
xiki-tempula 7dcce77
typo
xiki-tempula a926597
update
xiki-tempula cf142a1
revert change
xiki-tempula ce1539a
update
xiki-tempula c5724e1
Update ti_dhdl.py
xiki-tempula 3cc332d
Merge branch 'master' into workf
xiki-tempula 1a97228
Update abfe.py
xiki-tempula 4d5425b
update to pass the test
xiki-tempula 058aa99
Merge branch 'master' into workf
xiki-tempula ef52952
Update mbar_.py
xiki-tempula 9d2eb06
update
xiki-tempula ab1ab76
Update abfe.py
xiki-tempula 10fbdc4
Update mbar_.py
xiki-tempula 622125a
Merge branch 'master' into workf
xiki-tempula 4a72c2a
Revert "Update mbar_.py"
xiki-tempula 90495b5
Merge branch 'workf' of https://github.com/xiki-tempula/alchemlyb int…
xiki-tempula dd1735e
Update mbar_.py
xiki-tempula eaf0b6e
Merge branch 'master' into workf
xiki-tempula cd2ff92
Create convergence.py
xiki-tempula aa3054e
Update convergence.py
xiki-tempula ef21b2d
Update convergence.py
xiki-tempula 7238298
update
xiki-tempula 8ad6bb2
update
xiki-tempula e87867f
update doc
xiki-tempula 7d2b936
update doc
xiki-tempula 36f9adc
update
xiki-tempula f9d08bc
update
xiki-tempula daa9870
Merge branch 'master' into convergence
orbeckst 305ceac
update
xiki-tempula 212e955
change parser
xiki-tempula d281582
Update test_convergence.py
xiki-tempula f6ce666
update
xiki-tempula e9601fb
Update convergence.py
xiki-tempula a4d379a
Update convergence.py
xiki-tempula 1340367
Update convergence.py
xiki-tempula 8b5135e
Merge branch 'master' into workf
xiki-tempula 6a38d27
Merge pull request #1 from xiki-tempula/convergence
xiki-tempula e082035
Update abfe.py
xiki-tempula e7ce4fb
update
xiki-tempula 3cbd016
Update abfe.py
xiki-tempula b70e68c
Update abfe.py
xiki-tempula 204d22a
Merge branch 'master' into workf
xiki-tempula c8b7f66
Update convergence.py
xiki-tempula 696c36d
Merge branch 'master' into workf
xiki-tempula 24298a4
Update abfe.py
xiki-tempula 73b781e
Update convergence.py
xiki-tempula e93d3bf
update
xiki-tempula 281a864
update
xiki-tempula 602b98b
Update test_workflow_ABFE.py
xiki-tempula b8606dd
Reobust gmx (#2)
xiki-tempula bbd281d
update
xiki-tempula dd5a604
Merge branch 'master' into workf
xiki-tempula 1c40e97
test
xiki-tempula aecac7e
Update test_workflow.py
xiki-tempula 672a41a
Merge branch 'workf' into base
xiki-tempula afb22f5
Base (#3)
xiki-tempula 09efd77
Revert "Merge branch 'workf' into base"
xiki-tempula b173d93
Update base.py
xiki-tempula 9ddc811
Update alchemlyb.workflows.base.rst
xiki-tempula 3dc8c2a
update
xiki-tempula ecd29ee
update
xiki-tempula 0b37cf4
Update base.py
xiki-tempula 9b73218
Merge branch 'master' into base
xiki-tempula dd74acf
update
xiki-tempula b8355bb
Update CHANGES
xiki-tempula 3132af3
Merge branch 'base' into workf
xiki-tempula 36ca207
update
xiki-tempula 02e9520
update
xiki-tempula b58d117
update
xiki-tempula 58f52e7
update
xiki-tempula a71d32f
update
xiki-tempula 3dbc165
update
xiki-tempula 36ed0d0
Merge branch 'master' into workf
xiki-tempula f045017
update
xiki-tempula 7da1bda
Merge branch 'workf' of https://github.com/xiki-tempula/alchemlyb int…
xiki-tempula 81c33b8
Merge branch 'master' into workf
xiki-tempula b5a27a3
update
xiki-tempula 87c473e
update
xiki-tempula 5ee44a8
update
xiki-tempula db5232e
Update abfe.py
xiki-tempula 1d2d536
update
xiki-tempula e79d31b
Merge branch 'master' into workf
orbeckst 1d28042
update
xiki-tempula 456288a
Update abfe.py
xiki-tempula aea041a
Merge branch 'master' into workf
xiki-tempula d859c4e
update
xiki-tempula 03aad47
Update docs/workflows/alchemlyb.workflows.ABFE.rst
xiki-tempula 995bba1
Update docs/workflows/alchemlyb.workflows.ABFE.rst
xiki-tempula 5e3d6c4
update
xiki-tempula 1a9f155
Merge branch 'master' into workf
xiki-tempula 2ccef0c
resolve comments
xiki-tempula 7aa6ecb
fix name
xiki-tempula eca06db
fix test
xiki-tempula 720a76b
fix test
xiki-tempula 5c829d0
fix test
xiki-tempula 50f7432
fix test
xiki-tempula 2b0941d
remove no cover
xiki-tempula 2d173a8
bump coverage
xiki-tempula b2ed582
bump coverage
xiki-tempula 80b9bb3
bump coverage
xiki-tempula d5c9ea5
remove no cover
xiki-tempula bd8873b
Merge branch 'master' into workf
orbeckst d061fdc
update
xiki-tempula a778a0e
update
xiki-tempula ab71686
update doc.
xiki-tempula c246e9c
fix docs
xiki-tempula c35ca7a
Update docs/workflows/alchemlyb.workflows.ABFE.rst
xiki-tempula 9f17cbc
Update src/alchemlyb/convergence/convergence.py
xiki-tempula cc33374
Update src/alchemlyb/convergence/convergence.py
xiki-tempula f840d27
Update src/alchemlyb/estimators/mbar_.py
xiki-tempula 5070fe6
Update src/alchemlyb/estimators/mbar_.py
xiki-tempula f7c7c21
Update src/alchemlyb/estimators/mbar_.py
xiki-tempula 30bccd3
Update src/alchemlyb/estimators/mbar_.py
xiki-tempula fa4c4bf
update changes
xiki-tempula 6cf8895
no cover
xiki-tempula 8a31787
Update CHANGES
xiki-tempula be55f59
update
xiki-tempula e6752c9
update
xiki-tempula 282e98d
fix test
xiki-tempula 594bb33
changes
xiki-tempula 77ce671
raise OSError from original_exception in ABFE.read()
orbeckst ed3871d
fixed tests for OSError exceptions
orbeckst d6d7b9f
use upper case estimators in tests
orbeckst ef4a8d7
fix test for windows, too
orbeckst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| The ABFE workflow | ||
| ================== | ||
| The *Absolute binding free energy* (ABFE) workflow provides a complete workflow | ||
| that uses the energy files generated by MD engine as input and generates the | ||
| binding free energy as well as the analysis plots. | ||
|
|
||
| Fully Automatic analysis | ||
| ------------------------ | ||
| *Absolute binding free energy* (ABFE) calculations can be analyzed with | ||
| two lines of code in a fully automated manner (similar to | ||
| `Alchemical Analysis <https://github.com/MobleyLab/alchemical-analysis>`_). | ||
| In this case, any parameters are set when invoking :class:`~alchemlyb.workflows.abfe.ABFE` | ||
| and reasonable defaults are chosen for any parameters not set explicitly. The two steps | ||
| are to | ||
|
|
||
| 1. initialize an instance of the :class:`~alchemlyb.workflows.abfe.ABFE` class | ||
| 2. invoke the :meth:`~alchemlyb.workflows.ABFE.run` method to execute | ||
| complete workflow. | ||
|
|
||
| For a GROMACS ABFE simulation, executing the workflow would look similar | ||
| to the following code (The log is configured by logger). :: | ||
|
|
||
| >>> from alchemtest.gmx import load_ABFE | ||
| >>> from alchemlyb.workflows import ABFE | ||
| >>> # Enable the logger | ||
| >>> import logging | ||
| >>> logging.basicConfig(filename='ABFE.log', level=logging.INFO) | ||
| >>> # Obtain the path of the data | ||
| >>> import os | ||
| >>> dir = os.path.dirname(load_ABFE()['data']['complex'][0]) | ||
| >>> print(dir) | ||
| 'alchemtest/gmx/ABFE/complex' | ||
| >>> workflow = ABFE(units='kcal/mol', software='Gromacs', dir=dir, | ||
| >>> prefix='dhdl', suffix='xvg', T=298, outdirectory='./') | ||
| >>> workflow.run(skiptime=10, uncorr='dhdl', threshold=50, | ||
| >>> methods=('MBAR', 'BAR', 'TI'), overlap='O_MBAR.pdf', | ||
| >>> breakdown=True, forwrev=10) | ||
|
orbeckst marked this conversation as resolved.
|
||
|
|
||
|
|
||
| The workflow uses the :class:`~alchemlyb.parsing` to parse the data from the | ||
| energy files, remove the initial unequilibrated frames and decorrelate the data | ||
| with :class:`~alchemlyb.preprocessing.subsampling`. The decorrelated dataset | ||
| :ref:`dHdl <dHdl>` and :ref:`u_nk <u_nk>` are then passed to | ||
| :class:`~alchemlyb.estimators` for free energy estimation. The workflow will | ||
| also perform a set of analysis that allows the user to examine the quality of | ||
| the estimation. | ||
|
|
||
| File Input | ||
| ^^^^^^^^^^ | ||
|
|
||
| This command expects the energy files to be structured in two common ways. It | ||
| could either be :: | ||
|
|
||
| simulation | ||
| ├── lambda_0 | ||
| │ ├── prod.xvg | ||
| │ └── ... | ||
| ├── lambda_1 | ||
| │ ├── prod.xvg | ||
| │ └── ... | ||
| └── ... | ||
|
|
||
| Where :code:`dir='simulation/lambda_*', prefix='prod', suffix='xvg'`. Or :: | ||
|
|
||
| dhdl_files | ||
| ├── dhdl_0.xvg | ||
| ├── dhdl_1.xvg | ||
| └── ... | ||
|
|
||
| Where :code:`dir='dhdl_files', prefix='dhdl_', suffix='xvg'`. | ||
|
|
||
| Output | ||
| ^^^^^^ | ||
|
|
||
| The workflow returns the free energy estimate using all of | ||
| :class:`~alchemlyb.estimators.TI`, :class:`~alchemlyb.estimators.BAR`, | ||
| :class:`~alchemlyb.estimators.MBAR`. For ABFE calculations, the alchemical | ||
| transformation is usually done is three stages, the *bonded*, *coul* and *vdw* | ||
| which corresponds to the free energy contribution from applying the | ||
| restraint to restrain the ligand to the protein, decouple/annihilate the | ||
| coulombic interaction between the ligand and the protein and | ||
| decouple/annihilate the protein-ligand lennard jones interactions. The result | ||
| will be stored in :attr:`~alchemlyb.workflows.ABFE.summary` as | ||
| :class:`pandas.Dataframe`. :: | ||
|
|
||
|
|
||
| MBAR MBAR_Error BAR BAR_Error TI TI_Error | ||
| States 0 -- 1 0.065967 0.001293 0.066544 0.001661 0.066663 0.001675 | ||
| 1 -- 2 0.089774 0.001398 0.089303 0.002101 0.089566 0.002144 | ||
| 2 -- 3 0.132036 0.001638 0.132687 0.002990 0.133292 0.003055 | ||
| ... | ||
| 26 -- 27 1.243745 0.011239 1.245873 0.015711 1.248959 0.015762 | ||
| 27 -- 28 1.128429 0.012859 1.124554 0.016999 1.121892 0.016962 | ||
| 28 -- 29 1.010313 0.016442 1.005444 0.017692 1.019747 0.017257 | ||
| Stages coul 10.215658 0.033903 10.017838 0.041839 10.017854 0.048744 | ||
| vdw 22.547489 0.098699 22.501150 0.060092 22.542936 0.106723 | ||
| bonded 2.374144 0.014995 2.341631 0.005507 2.363828 0.021078 | ||
| TOTAL 35.137291 0.103580 34.860619 0.087022 34.924618 0.119206 | ||
|
orbeckst marked this conversation as resolved.
|
||
|
|
||
| Output Files | ||
| ^^^^^^^^^^^^ | ||
|
|
||
| For quality assessment, a couple of plots were generated and written to | ||
| the folder specified by `outdirectory`. | ||
|
|
||
| The :ref:`overlay matrix for the MBAR estimator <plot_overlap_matrix>` will be | ||
| plotted and saved to :file:`O_MBAR.pdf`, which examines the overlap between | ||
| different lambda windows. | ||
|
|
||
| The :ref:`dHdl for TI <plot_TI_dhdl>` will be plotted to | ||
| :file:`dhdl_TI.pdf`, allows one to examine if the lambda scheduling has | ||
| covered the change of the gradient in the lambda space. | ||
|
|
||
| The :ref:`dF states <plot_dF_states>` will be plotted to :file:`dF_state.pdf` in | ||
| portrait model and :file:`dF_state_long.pdf` in landscape model, which | ||
| allows the user to example the contributions from each lambda window. | ||
|
|
||
| The forward and backward convergence will be plotted to :file:`dF_t.pdf` using | ||
| :class:`~alchemlyb.estimators.MBAR` and saved in | ||
| :attr:`~alchemlyb.workflows.ABFE.convergence`, which allows the user to | ||
| examine if the simulation time is enough to achieve a converged result. | ||
|
|
||
| Semi-automatic analysis | ||
| ----------------------- | ||
| The same analysis could also performed in steps allowing access and modification | ||
| to the data generated at each stage of the analysis. :: | ||
|
|
||
| >>> from alchemtest.gmx import load_ABFE | ||
| >>> from alchemlyb.workflows import ABFE | ||
| >>> # Obtain the path of the data | ||
| >>> import os | ||
| >>> dir = os.path.dirname(load_ABFE()['data']['complex'][0]) | ||
| >>> print(dir) | ||
| 'alchemtest/gmx/ABFE/complex' | ||
| >>> # Load the data | ||
| >>> workflow = ABFE(software='Gromacs', dir=dir, | ||
| >>> prefix='dhdl', suffix='xvg', T=298, outdirectory='./') | ||
| >>> # Set the unit. | ||
| >>> workflow.update_units('kcal/mol') | ||
| >>> # Read the data | ||
| >>> workflow.read() | ||
| >>> # Decorrelate the data. | ||
| >>> workflow.preprocess(skiptime=10, uncorr='dhdl', threshold=50) | ||
| >>> # Run the estimator | ||
| >>> workflow.estimate(methods=('mbar', 'bar', 'ti')) | ||
| >>> # Retrieve the result | ||
| >>> summary = workflow.generate_result() | ||
| >>> # Plot the overlap matrix | ||
| >>> workflow.plot_overlap_matrix(overlap='O_MBAR.pdf') | ||
| >>> # Plot the dHdl for TI | ||
| >>> workflow.plot_ti_dhdl(dhdl_TI='dhdl_TI.pdf') | ||
| >>> # Plot the dF states | ||
| >>> workflow.plot_dF_state(dF_state='dF_state.pdf') | ||
| >>> # Convergence analysis | ||
| >>> workflow.check_convergence(10, dF_t='dF_t.pdf') | ||
|
|
||
| API Reference | ||
| ------------- | ||
| .. autoclass:: alchemlyb.workflows.ABFE | ||
| :members: | ||
| :inherited-members: | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| from .mbar_ import MBAR, AutoMBAR | ||
| from .bar_ import BAR | ||
| from .ti_ import TI | ||
|
|
||
| FEP_ESTIMATORS = [MBAR.__name__, AutoMBAR.__name__, BAR.__name__] | ||
| TI_ESTIMATORS = [TI.__name__] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.