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

Fixing broken top reader #110

Merged
merged 2 commits into from Mar 23, 2017

Conversation

jandom
Copy link
Collaborator

@jandom jandom commented Mar 22, 2017

Fixes #61 @orbeckst

  • Re-enable test cases,
  • Exclusions-related bug,
  • Handling improper overrides in scaling code,
  • Atom naming to match conf.gro file in amber03w tests.

- Re-enable test cases,
- Exclusions-related bug,
- Handling improper overrides in scaling code,
- Atom naming to match conf.gro file in amber03w tests.
@orbeckst
Copy link
Member

Does this PR replace #97 ?

@jandom
Copy link
Collaborator Author

jandom commented Mar 22, 2017

Negative, it just fixes the current develop branch and hopefully resolves #61

@orbeckst orbeckst self-requested a review March 22, 2017 17:15
@orbeckst
Copy link
Member

Ok.

I'll review when tests pass. Please ping me when ready.

@jandom
Copy link
Collaborator Author

jandom commented Mar 22, 2017

hmm, it's strange the base branch develop passes but these tests fail in ways that are not related to my code, i think

@orbeckst i'm no longer super-familiar with this code maybe you can shed some light on the failures?

@jandom
Copy link
Collaborator Author

jandom commented Mar 22, 2017

Maybe i'm doing sth wrong but on my end everything passes on development and fix/61-top-reader-broken

$ py.test gromacs
=============================================================================================== test session starts ================================================================================================
platform linux2 -- Python 2.7.12, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
rootdir: /media/domanski/STORAGE_4/workspace/GromacsWrapper/gromacs, inifile: 
collected 78 items 

gromacs/tests/test_cbook.py .
gromacs/tests/test_run.py .........
gromacs/tests/test_setup.py .
gromacs/tests/test_tools.py ......................
gromacs/tests/test_utilities.py ........................
gromacs/tests/test_version.py ...
gromacs/tests/fileformats/top/test_amber03star.py xx....
gromacs/tests/fileformats/top/test_amber03w.py xxx...
gromacs/tests/fileformats/top/test_charmm22.py x.....

====================================================================================== 72 passed, 6 xfailed in 13.78 seconds =======================================================================================
domanski@dcd:~/workspace/GromacsWrapper$ git checkout fix/61-top-reader-broken
Switched to branch 'fix/61-top-reader-broken'
domanski@dcd:~/workspace/GromacsWrapper$ py.test gromacs
=============================================================================================== test session starts ================================================================================================
platform linux2 -- Python 2.7.12, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
rootdir: /media/domanski/STORAGE_4/workspace/GromacsWrapper/gromacs, inifile: 
collected 78 items 

gromacs/tests/test_cbook.py .
gromacs/tests/test_run.py .........
gromacs/tests/test_setup.py .
gromacs/tests/test_tools.py ......................
gromacs/tests/test_utilities.py ........................
gromacs/tests/test_version.py ...
gromacs/tests/fileformats/top/test_amber03star.py ......
gromacs/tests/fileformats/top/test_amber03w.py ......
gromacs/tests/fileformats/top/test_charmm22.py ......

============================================================================================ 78 passed in 19.95 seconds ============================================================================================

@jandom
Copy link
Collaborator Author

jandom commented Mar 22, 2017

@orbeckst this failure mode seems to be occurring also on other PRs, such as
#101 and in related to numkit integration testing?

@jandom
Copy link
Collaborator Author

jandom commented Mar 22, 2017

@orbeckst @dotsdl broken the travis.ci for develop branch just by restarting the build
https://travis-ci.org/Becksteinlab/GromacsWrapper/jobs/198105261

This is also described here
rbgirshick/py-faster-rcnn#481

It is some sort of numpy version problem

@dotsdl
Copy link
Collaborator

dotsdl commented Mar 22, 2017

@jandom do you still have issues with tmpdirs? Is there anything here you'd like from me?

@jandom
Copy link
Collaborator Author

jandom commented Mar 22, 2017

@dotsdl yeah i do – i'd like to understand how they can be used if a test fails? maybe i'm doing something inefficiently, but i suspect many other old-geezers do it the same :P I basically had to engineer the failed test case in a separate directory copying the input files into that location.

I imagine that there is a way where I can go to the tmpdir used by the failed test and inspect what's going on there?

@codecov-io
Copy link

codecov-io commented Mar 22, 2017

Codecov Report

Merging #110 into develop will decrease coverage by 0.22%.
The diff coverage is 68.18%.

@@            Coverage Diff             @@
##           develop    #110      +/-   ##
==========================================
- Coverage    44.32%   44.1%   -0.23%     
==========================================
  Files           26      26              
  Lines         4823    4834      +11     
  Branches       695     699       +4     
==========================================
- Hits          2138    2132       -6     
- Misses        2568    2583      +15     
- Partials       117     119       +2
Impacted Files Coverage Δ
gromacs/fileformats/top.py 86.57% <50%> (-0.54%) ⬇️
gromacs/scaling.py 91.39% <72.22%> (-2.94%) ⬇️
gromacs/core.py 53.87% <0%> (-3.45%) ⬇️

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 9fe10ee...173ed56. Read the comment docs.

@dotsdl
Copy link
Collaborator

dotsdl commented Mar 22, 2017

@jandom for your test to use a tmpdir at all, you need to explicitly use it in your test. Best way is to wrap the body of your test in a with tmpdir.as_cwd(): context manager as it's done here. These tmpdirs on a Linux system will show up by default in /tmp, and pytest won't delete them outright (it keeps the most recent 3).

@jandom
Copy link
Collaborator Author

jandom commented Mar 22, 2017

@dotsdl many thanks! all clear now :) 👍

@dotsdl
Copy link
Collaborator

dotsdl commented Mar 22, 2017

@jandom are you ready for review?

@jandom
Copy link
Collaborator Author

jandom commented Mar 22, 2017

@orbeckst ready for review here

@orbeckst orbeckst requested a review from dotsdl March 22, 2017 23:41
@orbeckst
Copy link
Member

@dotsdl please feel free to review, I don't have time today.

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.

Just minor format things and comment clean up.

@@ -17,10 +17,10 @@ class TestAmber03star(TopologyTest):
conf = datafile('fileformats/top/amber03star/conf.gro')
molecules = ['Protein', 'SOL', 'IB+', 'CA', 'CL', 'NA', 'MG', 'K', 'RB', 'CS', 'LI', 'ZN']

@pytest.mark.xfail(raises=ValueError, reason="Not currently maintained. See #61.")
#@pytest.mark.xfail(raises=ValueError, reason="Not currently maintained. See #61.")
Copy link
Member

Choose a reason for hiding this comment

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

remove commented out xfail

def test_read_write(self, tmpdir):
super(TestAmber03star, self).test_read_write(tmpdir)

@pytest.mark.xfail(raises=GromacsError, reason="Not currently maintained. See #61.")
#@pytest.mark.xfail(raises=GromacsError, reason="Not currently maintained. See #61.")
Copy link
Member

Choose a reason for hiding this comment

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

remove commented out xfail

for k in top.dict_molname_mol.keys():
if k in ["Protein", "SOL", "Ion" ]: continue
del top.dict_molname_mol[k]
#for k in top.dict_molname_mol.keys():
Copy link
Member

Choose a reason for hiding this comment

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

Can this be removed or is there a good reason to keep the commented-out code around?

mol = scale_dihedrals(mol, dihedraltypes, args.scale_protein, banned_lines)
mol = scale_impropers(mol, impropertypes, 1.0, banned_lines)
for molname_mol in top.dict_molname_mol.keys():
if not 'Protein' in molname_mol: continue
Copy link
Member

Choose a reason for hiding this comment

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

I prefer putting continue on a separate line (as well as having explicit for blocks).

for at in mol.atoms: at.charge *= math.sqrt(args.scale_protein)
mol = scale_dihedrals(mol, dihedraltypes, args.scale_protein, banned_lines)
mol = scale_impropers(mol, impropertypes, 1.0, banned_lines)
for molname_mol in top.dict_molname_mol.keys():
Copy link
Member

Choose a reason for hiding this comment

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

YOu don't need .keys() here. in will do this automatically for a dict.

for molname_mol in top.dict_molname_mol.keys():
if not 'Protein' in molname_mol: continue
mol = top.dict_molname_mol[molname_mol]
for at in mol.atoms: at.charge *= math.sqrt(args.scale_protein)
Copy link
Member

Choose a reason for hiding this comment

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

block?

- break if..continue and for loop into separate blocks,
- remove commented lines and annotations,
- handle impropers and regular dihedrals in the same way.
@jandom
Copy link
Collaborator Author

jandom commented Mar 23, 2017

@orbeckst this is now all resolved - thank you for all the comments

@orbeckst orbeckst merged commit 7d3ffef into Becksteinlab:develop Mar 23, 2017
@orbeckst
Copy link
Member

Thanks a lot!!

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

Successfully merging this pull request may close these issues.

None yet

4 participants