Skip to content

ENH: hole trajectory analysis: can use dynamic cpoint#1814

Closed
orbeckst wants to merge 3 commits intodevelopfrom
hole-hacking
Closed

ENH: hole trajectory analysis: can use dynamic cpoint#1814
orbeckst wants to merge 3 commits intodevelopfrom
hole-hacking

Conversation

@orbeckst
Copy link
Member

@orbeckst orbeckst commented Mar 8, 2018

Changes made in this Pull Request:

The hole.HOLEtraj kwarg cpoint can now also a AtomGroup. In this case, the cpoint is recalculated for each frame as the COG of the ag, which helps with proteins that undergo conformational changes.

Basic tests were added.

PR Checklist

  • Tests?
  • Docs?
  • CHANGELOG updated?
  • Issue raised/referenced?

@orbeckst
Copy link
Member Author

Not sure why the full py 3.6 test passes (I assume the HOLE tests are not skipped because HOLE is installed) but the numpy version 1.10.4 test fails in one of the HOLE tests.

... TODO.

@orbeckst
Copy link
Member Author

(I'm just restarting the job, just to check that it is reproducible.)

logger.info("HOLE analysis frame %4d (orderparameter %g)", ts.frame, q)
if self._dynamic_cpoint:
hole_kw['cpoint'] = self.cpoint.center_of_geometry()
logger.info("New dynamic CPOINT %r for frame %r", hole_kw['cpoint'], ts.frame)
Copy link
Contributor

Choose a reason for hiding this comment

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

This has the potential to be super verbose. Wouldn't it be more convenient to save the cpoint in an array instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

By verbose you mean "giving output every frame"? Yes, I'll have to check what else is printed. In practice, I would not run this on 1000s of frames because it is pretty slow.

Wouldn't it be more convenient to save the cpoint in an array instead?

You mean as an attribute of the class for further investigation later? That's a good idea.

Copy link
Member Author

Choose a reason for hiding this comment

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

For right now, I changed all per-frame logging to logger.debug. Should use progressmeter for some...

p = profiles_values[0]

assert len(p) == 425, "wrong number of points in HOLE profile"
assert_equal(len(p), 425, err_msg="wrong number of points in HOLE profile")
Copy link
Contributor

Choose a reason for hiding this comment

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

Why revert back to assert_equal? Didn't we agree that with pytest we should use raw asserts expect when comparing arrays?

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought we said "use assert_equal() but not assert_array_equal()" – I don't think that bare assert can properly compare arrays.

Copy link
Member Author

Choose a reason for hiding this comment

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

... but yeah, in this case this should be assert.

Copy link
Member Author

Choose a reason for hiding this comment

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

(I think I used it for making clear where the error message goes... but simple assert should also work there.)

I am also replacing assert_array_* --> assert_*.

assert len(open(filename).readlines()) == 6504, "HOLE VMD surface file is incomplete"
with open(filename) as f:
nlines = len(f.readlines())
assert_equal(nlines, 6504,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above: why assert_equal?

Copy link
Member Author

Choose a reason for hiding this comment

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

Can't remember why I changed it. Should be reverted. Good catch.

class TestHOLEtraj_dynamic_cpoint(_TestHOLEtraj):

@pytest.fixture()
def reference(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the same reference as above. Does it have to be repeated in the class?

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably not, I might well only have been starting to get the hang of using pytest fixtures.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, it is not the same reference. The values are subtly different for "mean HOLE rxncoord", "minimum radius", and "min_radius" because the CPOINT parameter was varied. The test trajectory does not move very much so it does not make a big difference.

I'll leave it as it is.

description).


.. versionchanged:: 0.17.1
Copy link
Member

Choose a reason for hiding this comment

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

18.1 (which I'll rename to 19.0 once we push)

The hole.HOLEtraj kwarg cpoint can now also a AtomGroup. In this case,
the cpoint is recalculated for each frame as the COG of the ag, which
helps with proteins that undergo conformational changes.

Basic tests were added.
@orbeckst
Copy link
Member Author

rebased against develop and force-pushed

@coveralls
Copy link

coveralls commented Jun 18, 2018

Coverage Status

Coverage increased (+0.01%) to 89.904% when pulling 0b30315 on hole-hacking into 61e9ed9 on develop.

@orbeckst
Copy link
Member Author

The only test that fails is the numpy 1.10.4 one in

  • TestHOLEtraj_dynamic_cpoint.test_min_radius
  • TestHOLEtraj_dynamic_cpoint.test_HOLEtraj

I honestly have no idea yet why/where the numpy version makes a difference but it is disturbing and I don't want to brush this off.

Any suggestions welcome.

@orbeckst
Copy link
Member Author

I can reproduce the test failures locally in a numpy 1.10.4 + python 3.5 environment (minor aside: conda-forge gsd is not compatible with this environment so needs to be pip-installed). When I find a bit more time I can try to dig into the differences – but if anyone has any hints why this could produce different results then please let me know. All the actual computation is supposedly done by HOLE itself.

@orbeckst orbeckst mentioned this pull request Feb 10, 2020
4 tasks
@orbeckst
Copy link
Member Author

Would need to be rewritten for the new hole2 module #2523.

@orbeckst orbeckst closed this Aug 16, 2020
@RMeli RMeli deleted the hole-hacking branch December 23, 2023 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants