Skip to content
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

Added the capability of loading a single test case for AMBER #71

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c2a4f6a
added new test files and single file load capabil
DrDomenicoMarson Sep 24, 2022
61f5288
removed .out not compressed file
DrDomenicoMarson Sep 24, 2022
819b2ad
created the load_testfile function
DrDomenicoMarson Sep 25, 2022
423c13c
fixed to comply to sphinx
DrDomenicoMarson Sep 25, 2022
7ec895a
compressed
DrDomenicoMarson Sep 27, 2022
5de020b
Merge branch 'master' into add-amber-mbar-none-non-finished
orbeckst Sep 27, 2022
6cb3792
Merge branch 'master' into add-amber-mbar-none-non-finished
orbeckst Sep 28, 2022
be6b856
load_testfile now is compliant with the directives
DrDomenicoMarson Sep 28, 2022
98b8d4e
Merge branch 'add-amber-mbar-none-non-finished' of github.com:DrDomen…
DrDomenicoMarson Sep 28, 2022
ea8f255
fixed a bug in retriving file name
DrDomenicoMarson Sep 28, 2022
c761bf1
reintroduced invalidfiles
DrDomenicoMarson Sep 28, 2022
8957129
updated the docs
DrDomenicoMarson Sep 28, 2022
32a1094
Update src/alchemtest/amber/access.py
DrDomenicoMarson Sep 28, 2022
28b3611
Update src/alchemtest/amber/testfiles/descr.rst
DrDomenicoMarson Sep 28, 2022
9b52b56
load_invalidfiles now load files from testfiles
DrDomenicoMarson Sep 29, 2022
43c8584
issue a DeprecationWarning in load_invalidfiles
DrDomenicoMarson Sep 29, 2022
32e7e9f
edited docstring of load_testfiles
DrDomenicoMarson Sep 29, 2022
67cb793
made the filename extraction more robust
DrDomenicoMarson Sep 29, 2022
4a1f11d
fixed the tests for the new function
DrDomenicoMarson Sep 29, 2022
02464ef
fixed load_invalidfiles to pass the tests
DrDomenicoMarson Sep 29, 2022
6ba30d0
Merge branch 'master' into add-amber-mbar-none-non-finished
xiki-tempula Oct 1, 2022
7add57e
got rid of (glob, join, dirname) using Path
DrDomenicoMarson Oct 1, 2022
ee0bd39
got rid of listdir
DrDomenicoMarson Oct 1, 2022
0abec73
Merge branch 'add-amber-mbar-none-non-finished' of github.com:DrDomen…
DrDomenicoMarson Oct 1, 2022
e9d32cc
removed a debugging print
DrDomenicoMarson Oct 1, 2022
b50d98b
added 'out' and 'tar' as possible suffixes
DrDomenicoMarson Oct 2, 2022
958edbe
Merge branch 'master' into add-amber-mbar-none-non-finished
orbeckst Oct 9, 2022
ec32c47
removed auto key generation
DrDomenicoMarson Oct 12, 2022
f711a06
changed extension
DrDomenicoMarson Oct 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion docs/amber.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ They can be accessed using the following accessor functions:
load_bace_example
load_simplesolvated
load_invalidfiles
load_testfiles


.. _amber_bace_improper:
Expand All @@ -44,6 +45,13 @@ They can be accessed using the following accessor functions:

.. _amber_invalidfiles:

.. include:: ../src/alchemtest/amber/invalidfiles/descr.rst
.. include:: ../src/alchemtest/amber/testfiles/descr_invalid.rst

.. autofunction:: alchemtest.amber.load_invalidfiles


.. _load_testfiles:

.. include:: ../src/alchemtest/amber/testfiles/descr.rst

.. autofunction:: alchemtest.amber.load_testfiles
1 change: 1 addition & 0 deletions src/alchemtest/amber/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
from .access import load_bace_example
from .access import load_simplesolvated
from .access import load_invalidfiles
from .access import load_testfiles
90 changes: 68 additions & 22 deletions src/alchemtest/amber/access.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
"""Accessors for Amber TI datasets.

"""

from os.path import dirname, join
from glob import glob

import warnings
from pathlib import Path
from .. import Bunch


Expand All @@ -20,10 +18,10 @@ def load_bace_improper():
- 'data' : the data files for improper solvated vdw alchemical leg

"""
module_path = dirname(__file__)
data = {'vdw': glob(join(module_path, 'bace_improper/solvated/vdw/*/ti-*.out.bz2'))}
module_path = Path(__file__).parent
data = {'vdw': list(map(str, module_path.glob('bace_improper/solvated/vdw/*/ti-*.out.bz2')))}

with open(join(module_path, 'bace_improper', 'descr.rst')) as rst_file:
with open(module_path / 'bace_improper' / 'descr.rst') as rst_file:
fdescr = rst_file.read()

return Bunch(data=data,
Expand All @@ -41,20 +39,20 @@ def load_bace_example():
- 'data' : the data files by system and alchemical leg

"""
module_path = dirname(__file__)
module_path = Path(__file__).parent
data = {'complex':
{'decharge': glob(join(module_path, 'bace_CAT-13d~CAT-17a/complex/decharge/*/ti-*.out.bz2')),
'recharge': glob(join(module_path, 'bace_CAT-13d~CAT-17a/complex/recharge/*/ti-*.out.bz2')),
'vdw': glob(join(module_path, 'bace_CAT-13d~CAT-17a/complex/vdw/*/ti-*.out.bz2'))
{'decharge': list(map(str, module_path.glob('bace_CAT-13d~CAT-17a/complex/decharge/*/ti-*.out.bz2'))),
'recharge': list(map(str, module_path.glob('bace_CAT-13d~CAT-17a/complex/recharge/*/ti-*.out.bz2'))),
'vdw': list(map(str, module_path.glob('bace_CAT-13d~CAT-17a/complex/vdw/*/ti-*.out.bz2')))
},
'solvated':
{'decharge': glob(join(module_path, 'bace_CAT-13d~CAT-17a/solvated/decharge/*/ti-*.out.bz2')),
'recharge': glob(join(module_path, 'bace_CAT-13d~CAT-17a/solvated/recharge/*/ti-*.out.bz2')),
'vdw': glob(join(module_path, 'bace_CAT-13d~CAT-17a/solvated/vdw/*/ti-*.out.bz2'))
{'decharge': list(map(str, module_path.glob('bace_CAT-13d~CAT-17a/solvated/decharge/*/ti-*.out.bz2'))),
'recharge': list(map(str, module_path.glob('bace_CAT-13d~CAT-17a/solvated/recharge/*/ti-*.out.bz2'))),
'vdw': list(map(str, module_path.glob('bace_CAT-13d~CAT-17a/solvated/vdw/*/ti-*.out.bz2')))
}
}

with open(join(module_path, 'bace_CAT-13d~CAT-17a', 'descr.rst')) as rst_file:
with open(module_path / 'bace_CAT-13d~CAT-17a' / 'descr.rst') as rst_file:
fdescr = rst_file.read()

return Bunch(data=data,
Expand All @@ -74,11 +72,11 @@ def load_simplesolvated():

"""

module_path = dirname(__file__)
data = {'charge': glob(join(module_path, 'simplesolvated/charge/*/ti-*.out')),
'vdw': glob(join(module_path, 'simplesolvated/vdw/*/ti-*.out'))}
module_path = Path(__file__).parent
data = {'charge': list(map(str, module_path.glob('simplesolvated/charge/*/ti-*.tar.bz2'))),
'vdw': list(map(str, module_path.glob('simplesolvated/vdw/*/ti-*.tar.bz2')))}

with open(join(module_path, 'simplesolvated', 'descr.rst')) as rst_file:
with open(module_path / 'simplesolvated' / 'descr.rst') as rst_file:
fdescr = rst_file.read()

return Bunch(data=data,
Expand All @@ -96,12 +94,60 @@ def load_invalidfiles():
- 'data' : the example of invalid data files
- 'DESCR': the full description of the dataset


.. deprecated:: 0.7
use :func:`load_testfiles` instead

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the start of the function, issue a DeprecationWarning

warnings.warn("load_invalidfiles() was deprecated in 0.7.0 and will be removed in the following release. Use load_testfiles() instead", DeprecationWarning)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

"""

module_path = dirname(__file__)
data = [glob(join(module_path, 'invalidfiles/*.out.bz2'))]
warnings.warn(
"load_invalidfiles() was deprecated in 0.7.0 and will be removed in the following release."
" Use load_testfiles() instead",
DeprecationWarning)
module_path = Path(__file__).parent
data = [[
module_path / 'testfiles' / 'no_useful_data.out.bz2',
module_path / 'testfiles' / 'no_control_data.out.bz2',
module_path / 'testfiles' / 'no_temp0_set.out.bz2',
module_path / 'testfiles' / 'no_free_energy_info.out.bz2',
module_path / 'testfiles' / 'no_atomic_section.out.bz2',
module_path / 'testfiles' / 'no_results_section.out.bz2']]

with open(module_path / 'testfiles' / 'descr_invalid.rst') as rst_file:
fdescr = rst_file.read()

return Bunch(data=data,
DESCR=fdescr)


def load_testfiles():
"""Load incomplete or wrongly formatted files to be used to test the AMBER parsers.

Returns
-------
data : Bunch
Dictionary-like object, the interesting attributes are:

- 'data' : the data files
- 'DESCR': the full description of all the files

"""

with open(join(module_path, 'invalidfiles', 'descr.rst')) as rst_file:
testfiles_path = Path(__file__).parent / 'testfiles'

data = {
"not_finished_run": [testfiles_path / "not_finished_run.out.bz2"],
"none_in_mbar": [testfiles_path / "none_in_mbar.out.bz2"],
"no_useful_data": [testfiles_path / "no_useful_data.out.bz2"],
"no_temp0_set": [testfiles_path / "no_temp0_set.out.bz2"],
"no_results_section": [testfiles_path / "no_results_section.out.bz2"],
"no_free_energy_info": [testfiles_path / "no_free_energy_info.out.bz2"],
"no_dHdl_data_points": [testfiles_path / "no_dHdl_data_points.out.bz2"],
"no_control_data": [testfiles_path / "no_control_data.out.bz2"],
"no_atomic_section": [testfiles_path / "no_atomic_section.out.bz2"],
}

with open(testfiles_path / 'descr.rst') as rst_file:
fdescr = rst_file.read()

return Bunch(data=data,
Expand Down
14 changes: 0 additions & 14 deletions src/alchemtest/amber/invalidfiles/descr.rst

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading