Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

amber mbar parser #51

Merged
merged 1 commit into from
Jan 17, 2018
Merged

amber mbar parser #51

merged 1 commit into from
Jan 17, 2018

Conversation

brycestx
Copy link
Collaborator

@brycestx brycestx commented Jan 11, 2018

Fixes #42

This pull request adds support for amber mbar parsing for amber .out files by using the extract_u_nk function, which I wrote to primarily mimic the output format of the extract_u_nk gromacs function.

A test_u_nk function was also added to test_amber.py. I am now working on adding a minimal test example to alchemtest.

@brycestx brycestx mentioned this pull request Jan 11, 2018
1 task
@orbeckst
Copy link
Member

I'll review once you have added the data files to alchemtest alchemistry/alchemtest#20

@brycestx
Copy link
Collaborator Author

@orbeckst done

@orbeckst
Copy link
Member

orbeckst commented Jan 11, 2018

Thanks, I reviewed alchemistry/alchemtest#21 – if you can quickly address my comments then we can merge the data set in a few minutes.

@brycestx
Copy link
Collaborator Author

@orbeckst just updated my alchemistry PR

@orbeckst
Copy link
Member

alchemistry/alchemtest#21 was merged. I will restart the tests so that the new data files are picked up and then we'll see.

@codecov-io
Copy link

codecov-io commented Jan 12, 2018

Codecov Report

Merging #51 into master will decrease coverage by 0.46%.
The diff coverage is 91.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #51      +/-   ##
==========================================
- Coverage   98.57%   98.11%   -0.47%     
==========================================
  Files           9        9              
  Lines         422      478      +56     
  Branches       78       94      +16     
==========================================
+ Hits          416      469      +53     
- Misses          3        4       +1     
- Partials        3        5       +2
Impacted Files Coverage Δ
src/alchemlyb/parsing/amber.py 97.35% <91.66%> (-0.89%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a1a3e5f...9117cc6. Read the comment docs.

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

Tests pass but coverage decreased. Looking at https://codecov.io/gh/alchemistry/alchemlyb/src/713871daad3834ea5895a8d1560d57e6ebbaeadd/src/alchemlyb/parsing/amber.py the lines that are not tested all relate to catching problems with the file format or the data themselves.

Ideally, add additional tests that exercise the checks (see what @shuail did with invalid_files for the TI parser.)

If want to indicate that something is not tested, add # pragma: no cover on the same line as the if statement that leads to the exception or warning.


file_datum.mbar_energies[lmbda].append(E - E_ref)

if high_E_cnt:
Copy link
Member

Choose a reason for hiding this comment

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

add test file or remove from coverage with #pragma: no cover

if not file_validation(outfile):
return None
if not file_datum.have_mbar:
logging.error('ERROR: No MBAR energies found! Cannot parse file.')
Copy link
Member

Choose a reason for hiding this comment

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

SHouldn't this raise an exception? At this point it shouldn't continue, should it?

Copy link
Member

Choose a reason for hiding this comment

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

It should behave in the same way as the TI parser.

@brycestx
Copy link
Collaborator Author

@orbeckst alchemistry/alchemtest#22 must be approved before the additional tests I have added can be tested properly

orbeckst pushed a commit to alchemistry/alchemtest that referenced this pull request Jan 16, 2018
This PR adds Bace solvated vdw output files from a perturbation that was improperly prepared and has large energies and NaN's at endpoints. The purpose of this example is to increase coverage of tests in Alchemlyb alchemistry/alchemlyb#51.

* Added Bace CAT-13d~CAT-17a perturbation with mbar from JACS set and load_bace_example function to access.py
* Added load_bace_example to access.py
* bzip2 .out files in bace example directory and add to amber.rst file in docs/
* add new bace_improper example for testing of amber MBAR parsing in alchemlyb
@orbeckst
Copy link
Member

I merged alchemistry/alchemtest#22 and restarted the Travis tests. Will have a look once the tests are done.

Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

I only have a minor comment in order to more clearly indicate what is covered and what is not.

file_datum.mbar_lambdas = mbar_lambdas
clambda_str = '%6.4f' % clambda

if clambda_str not in mbar_lambdas:
Copy link
Member

Choose a reason for hiding this comment

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

This block is not tested. See https://codecov.io/gh/alchemistry/alchemlyb/pull/51/src/src/alchemlyb/parsing/amber.py?before=src/alchemlyb/parsing/amber.py#L218

Put a #pragma: no cover to indicate that we exclude it from test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Should be addressed in alchemistry/alchemtest#23

@orbeckst orbeckst self-assigned this Jan 16, 2018
@brycestx
Copy link
Collaborator Author

brycestx commented Jan 16, 2018

@orbeckst should be good to go after alchemistry/alchemtest#24 merge

@orbeckst
Copy link
Member

Merged PR alchemistry/alchemtest#24 and waiting for Travis.

@orbeckst
Copy link
Member

Travis has issues https://www.traviscistatus.com/incidents/c1s4dlyxd4lf so might take a while.

@brycestx
Copy link
Collaborator Author

Yea I saw it hanging and was hoping it wasn't my code that caused it... ha

@orbeckst
Copy link
Member

Thanks @brycestx ; I will take it from here.

I will rebase and then merge. (Probably also add another no cover.)

@orbeckst
Copy link
Member

I rebased against master and excluded the file_validation(outfile) in extract_dHdl() from the coverage. (Note, I force-pushed to the branch!)

I'll wait for the tests to finish and then squash & merge.

- fixes #42
- Added functions to extract u_nk mbar energies from Amber files
  if they exist.
- added test to determine if file was parsed correctly.
  ix test_amber.py to conform to new load_bace_example added to alchemtest.
- small formatting adjustments.
- Adding another test "load_bace_improper" to increase coverage
- Adding support for exception thrown by improper clambda value for test case.
- removed untested portion of amber parser from coverage
  The "file_validation(outfile)" step in extract_dHdl() is not covered by
  our tests. I am flagging the "not tested" status explicitly in the code
  with `#pragma: no cover`.
@orbeckst
Copy link
Member

I squashed everything into a single commit.

@orbeckst orbeckst merged commit ab1b657 into master Jan 17, 2018
@orbeckst
Copy link
Member

@brycestx merged – thanks for all the work.

(The coverage diff was "only" 91% but I looked at the code and it seemed ok to me so I overrode the merge warning.)

@orbeckst orbeckst deleted the amber-mbar-parse branch January 17, 2018 17:52
@brycestx
Copy link
Collaborator Author

@orbeckst hmm any idea why that is. Looking here it looks much better than before.. https://codecov.io/gh/alchemistry/alchemlyb/src/ab1b6573670ab13d09b92ee291e9159a1e3ca860/src/alchemlyb/parsing/amber.py

@orbeckst
Copy link
Member

The relative diff is also 91.66% in the page that you linked – I think we've been looking at the same thing. The overall coverage of the file is still 97.35%. If you want to test the lines that are omitted or marked # pragma: no cover then that would be great, of course, but I consider the code that went in of a high standard with good testing already.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants