-
Notifications
You must be signed in to change notification settings - Fork 673
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
deprecate hydrogen bond analysis in water bridge analysis #2913
Conversation
Hello @xiki-tempula! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2021-01-27 21:11:07 UTC |
Going to ping @RMeli here, I believe this move was started in PR #2746, but I don't know why it stalled. |
@IAlibay, PR #2746 stalled because of #2745 (comment) and for lack of time. @xiki-tempula did ask me if he could supersede my PR as part of his current work and I have no problems with that. |
Codecov Report
@@ Coverage Diff @@
## develop #2913 +/- ##
========================================
Coverage 93.17% 93.17%
========================================
Files 171 171
Lines 22735 22741 +6
Branches 3216 3216
========================================
+ Hits 21183 21189 +6
Misses 1504 1504
Partials 48 48
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of comments + need to work out what the target version will be for full removal.
self.u.atoms[tmp_acceptors].positions, | ||
box=self.box | ||
) | ||
warnings.warn( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So in the past we've been a little bit more cautious with stubs, specifically setting simplewarning through something like:
with warnings.catch_warnings():
warnings.simplefilter('always', DeprecationWarning)
warnings.warn(("This module has been moved to "
"MDAnalysis.analysis.hydrogenbonds.wbridge_analysis "
"It will be removed in release 3.0"),
category=DeprecationWarning)
from ..hydrogenbonds.wbridge_analysis import WaterBridgeAnalysis
Whilst I'm not sure the order of the import matters so much, the use of filtering is probably useful in cases where people tend to just blanket remove all warnings. Pinging @orbeckst here who probably has more context on why this was the decision taken for stubs circa ~ v0.21.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late (and unhelpful) reply: I don't remember and the more cautious approach by @IAlibay looks good to me.
Removal would be 2.0 (together with old h-bonds).
@@ -0,0 +1,1799 @@ | |||
# -*- Mode: python; tab-width: 4; indent-tabs-mode:nil; coding:utf-8 -*- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a cursory look, it seems fine as just the moved file + PEP8 changes. Unfortunately the relatively unhelpful git diff make this hard to check thoroughly (PEP8 probably could have just been dealt with in a separate PR but too late now).
Is there any particular changes here that you'd like us to look at?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As is described in the PR description. I have
- Fixed the PEP8 issue
- Remove reference to the old HBA in the doc
- Added the code for deprecation related stuff.
None of the code inside the wba is modified.
) | ||
warnings.warn( | ||
"This module has been moved to MDAnalysis.analysis.hydrogenbonds" | ||
"It will be removed in MDAnalysis version 2.0. Please use " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Next target version is 2.0, so removals have to be done afterwards unless we want to make this a v1.1 target instead. Thoughts @orbeckst ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we have to do a 1.1 for whatever reasons then we keep things as unchanging as possible. But the goal was to keep 1.x boring and as similar to the old stuff as possible, so any removals target 2.0.
I hope that we are only doing bug fixes for 1.x so that this stays 1.0.x
Co-authored-by: Irfan Alibay <IAlibay@users.noreply.github.com>
Co-authored-by: Irfan Alibay <IAlibay@users.noreply.github.com>
Co-authored-by: Irfan Alibay <IAlibay@users.noreply.github.com>
@orbeckst Thank you for the advice. I have changed the changelog and remove the water_bridge from the hbond module. I will open another PR for master. |
@orbeckst Thank you for the advice. I was wondering if there is anything that I could do to get this PR merged. I'm working to port @p-j-smith 's MDAnalysis.analysis.hydrogenbonds.hbond_analysis.HydrogenBondAnalysis.lifetime() to water bridge analysis, so it would be nice if this PR could be merged. |
Sorry , I am snowed under with other things at the moment. Could you please ping me at the end of the week again? Sorry again for the long silence.
|
@orbeckst Thanks for all the help. I wonder if you mind give a look, please? I will make another PR to the masters once this one is merged. |
Thanks for the reminder. I put it in my calendar for Wednesday — sorry, there’s no way I can get to it any earlier (and I had not enough spare time last week).
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR moves wbridge_analysis to hydrogenbonds. Please open a PR against master that just includes the deprecations, stating that in 2.0, it will be in hydrogenbonds. When the deprecation PR is approved, I can also approve the move here.
@xiki-tempula what is your plan for wbridge analysis? Do you want to rewrite it to base it on the new hydrogenbond analysis? It would be really good to have HydrogenBondAnalysis and WaterBridgeAnalysis behave in the same way as far as selections and performance go. If there's a way to avoid duplication of code then I would be very much in favor of, e.g., creating a base class for both HydrogenBondAnalysis and WaterBridgeAnalysis. |
@orbeckst The PR against the master is done in #3111. The issue with HydrogenBondAnalysis is a quite tricky one. Since the WaterBridgeAnalysis is written based on the old HydrogenBondAnalysis, it has all the functionality of the old HydrogenBondAnalysis. Later on, @p-j-smith introduced capped-distance to HydrogenBondAnalysis, which brought a major speed improvement. So I have adopted the capped-distance to distance calculations. Currently, WaterBridgeAnalysis and HydrogenBondAnalysis offer the same performance in terms of computing hydrogen bonds. The selection problem is a bit tricky. As is discussed in #2177, the WaterBridgeAnalysis adopted the same selection scheme as the old HydrogenBondAnalysis. I'm currently working on a RDKIT based selection scheme. It is difficult to write WaterBridgeAnalysis based on HydrogenBondAnalysis as WaterBridgeAnalysis needs a more complex data structure but it is easy to write HydrogenBondAnalysis based on WaterBridgeAnalysis. The only functionality that is present in HydrogenBondAnalysis but not WaterBridgeAnalysis is the lifetime analysis, which I plan to add when this PR is merged. |
Hi, I don't know the full extent of the functionality of the WaterBridgeAnalysis class, but I have used HydrogenBondAnalysis to find hydrogen bonds and then used NetworkX to look for water-bridging in the following way:
Another PhD student in my group had the idea of using NetworkX for this. We've only used it to look at the statistics of the path-length distribution, but NetworkX also returns the list of atoms in the through-water path from donor-to acceptor. I'm not sure whether this is something you would be interested in, but offloading the path-finding to NetworkX might give a performance boost whilst also keeping the same selections etc. as HydrogenBondAnalysis. If this is something you're interested in @xiki-tempula I'd be happy to work with you on it. |
@p-j-smith Thanks for the insight. The WaterBridgeAnalysis basically does what you have said with various tweaks for speed improvement and robustness. The first step is to find the hydrogen bonds within a defined space. Instead of The second step is finding a path from selection 1 to selection 2. I have written an optimized path-finder for this type of job. Though I have not tested the NetworkX implementation, I think it would be interesting to see how would NetworkX perform. I think one strength of the WaterBridgeAnalysis is the flexible analysis functionality. The |
Just jumping in here and focusing very specifically on the last sentence. I don't know what your plans are re: RDKIT-based selections, but if it's possible to make it optional that would be great. WaterBridgeAnalysis is a great core analysis feature of MDA, since we probably can't make RDKIT a core dependency, having the ability to use it without RDKIT is probably quite important. |
Sorry - it's been a while since I worked on this. You're completely right - I remember now that in post-processing the hydrogen bonds to find water-bridging I also had to use three selections - for the source, sink and path. So what I suggested would probably complicate rather than simplify things. |
With PR #3111 to be merged into 1.0.2-develop, this is good to go from my end. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I've not been keeping up, from a cursory look it seems fine. I'll approve since @orbeckst did / so I'm not blocking merging :)
@@ -156,6 +156,7 @@ Changes | |||
`__call__` (Issue #2860, PR #2859) | |||
* deprecated ``analysis.helanal`` module has been removed in favour of | |||
``analysis.helix_analysis`` (PR #2929) | |||
* Move water bridge analysis from hbonds to hydrogenbonds (Issue #2739 PR #2913) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically new changes go to the top of the list, but I'm willing to let that go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate your attention to detail.
I merged the whole thing nevertheless, as this has been sitting for way too long.
I want to rebase all of this into a single commit (there's too much clutter in the history) but Rebase and merge will not work automatically. @xiki-tempula please condense the history of this PR in not more than ~3 commits (or just a single one) and then force-push so that we have a clean history. I leave this to you because you know best what the end result ought to look like. I will block until the history is cleaned up. |
Actually, forget my previous comment: Squash and merge works just fine. Will do this now. Sorry for the clutter! |
…s#2913) * Move water bridge analysis from hbonds to hydrogenbonds (PR MDAnalysis#2913) * part of MDAnalysis#2739 * deprecate hydrogen bond analysis in water bridge in PR MDAnalysis#3111 * Update CHANGELOG Co-authored-by: Irfan Alibay <IAlibay@users.noreply.github.com>
Fixes #
deprecate hydrogen bond analysis in water bridge analysis.
The hydrogen bond analysis is not used in the original water bridge analysis and I have cleared some reference to the hydrogen bond analysis in the doc sections.
Move water bridge analysis from hbonds to hydorgenbonds
Related to #2739 and #2746
Changes made in this Pull Request:
PR Checklist