Move the water bridge analysis to the new analysis class#2087
Move the water bridge analysis to the new analysis class#2087orbeckst merged 30 commits intoMDAnalysis:developfrom xiki-tempula:new_wba
Conversation
Move the water bridge analysis to the new analysis class, add high
Order water bridge support. (PR #2087)
|
It seems that the line |
|
yes this is not valid syntax for python 3.4 and older. What did you want to replace? |
|
@kain88-de |
|
what are the keys of `result_dict`?
…On Wed, Oct 3, 2018 at 3:27 PM xiki-tempula ***@***.***> wrote:
@kain88-de <https://github.com/kain88-de>
My current thought would be replaced with
result = [[i for i in key] for key in result_dict]
[result[i].append(result_dict[key]*1.0/length) for i, key in enumerate(result_dict)]
return result
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2087 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEGnVvmHJBsNHoOnvh6sk31QJCrgmVvdks5uhLszgaJpZM4XFqGz>
.
|
|
@kain88-de It is a tuple has the form |
|
Why not a manual unpack if the structure is known?
`[[k[0], k[1], k[2], k[3], v/length] for k, v in
six.iteritems(result_dict)]`
To remove `*1.0` include `from __future__ import division` at the beginning
of the file. Python will then automatically do a type conversion to float.
…On Wed, Oct 3, 2018 at 4:02 PM xiki-tempula ***@***.***> wrote:
@kain88-de <https://github.com/kain88-de> It is a tuple has the form
(from_index, to_index, (from_resname, from_resid, from_name), (to_resname,
to_resid, to_name)).
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2087 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEGnViOslnNCbQEONH0y82eUZLDea0fVks5uhMODgaJpZM4XFqGz>
.
|
|
@kain88-de Sorry, I haven't made this clear. This is the default output version. In this update, the user has the freedom to define the key to this dictionary. |
Codecov Report
@@ Coverage Diff @@
## develop #2087 +/- ##
===========================================
+ Coverage 89.75% 89.82% +0.07%
===========================================
Files 173 173
Lines 21536 21711 +175
Branches 2804 2846 +42
===========================================
+ Hits 19329 19502 +173
Misses 1615 1615
- Partials 592 594 +2
Continue to review full report at Codecov.
|
|
The doc test had stalled. I restarted it. Then we should also see coverage. Please also fix the conflicts with develop. |
|
@orbeckst Thank you for the advice. I have fixed the conflict but I think the py36 develop build might have some problem which makes the test fails. |
|
I restarted the 3.6 jobs, maybe that helps? |
|
If not, drop an email to the dev list; I am not sure what's wrong. |
|
I just merged @richardjgowers PR #2145 so rebase against develop (or merge develop) and see if this fixes things. |
|
@orbeckst Thank you for the information. Would you mind restart the Travis build, please? I guess there we probably don't need another commit. |
|
Did you merge develop? This is needed for the change to take place. This will automatically run Travis. |
|
@orbeckst Thank you for the advice. I have merged the develop to this PR and it seems that MDAnalysisTests.analysis.test_encore.TestEncore is failing. |
|
Probably the usual failure due to the sensitivity of the encore tests to small data.
Perhaps someone who's not celebrating Thanksgiving today (big deal in the US) could restart the Travis tests?
…--
Oliver Beckstein
email: orbeckst@gmail.com
Am Nov 22, 2018 um 10:11 schrieb xiki-tempula ***@***.***>:
@orbeckst Thank you for the advice. I have merged the develop to this PR and it seems that MDAnalysisTests.analysis.test_encore.TestEncore is failing.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
I restarted the one job that failed. |
There was a problem hiding this comment.
That's a big PR. It mixes new features (higher order wbridges) with refactoring (AnalysisBase). It would have been easier if these two things had been addressed separately. In particular, new features automatically imply that this has to go into a 0.20.x (because we use semantic versioning.
Many of my comments are regarding documentation, mainly to make clearer what happens in the module.
I am also concerned with code duplication between the new wbridge analysis and the hbond analysis. I am not 100% sure what the best course forward is but I'd like to hear suggestions. Perhaps create a mixin-class and raise an issue for refactoring hbond analysis; not everything has to be accomplished in one PR (many smaller PRs with weel-defined goals are much better).
In the tests I'd also suggest to reduce code-duplication by using more fixtures as this also leads to cleaner separation of data and test logic.
ADDENDUM
- remove file
package/.DS_Storefrom the PR - rebase against develop (or merge develop)
| raise pytest.fail("selection_type aaa should rasie error") | ||
|
|
||
| def test_empty_selection(self): | ||
| grofile = '''Test gro file |
|
|
||
| def test_loop(self): | ||
| '''Test if loop can be handled correctly''' | ||
| grofile = '''Test gro file |
| return Atomtypes(np.array([guess_atom_type(name) for name in names], dtype=object)) | ||
|
|
||
|
|
||
| class TestHydrogenBondAnalysis(object): |
There was a problem hiding this comment.
Shouldn't this be in a different test?
There was a problem hiding this comment.
@orbeckst I'm thinking of unifying the output of HydrogenBondAnalysis and WaterBridgeAnalysis. So I have transported the HydrogenBondAnalysis to here to make sure WaterBridgeAnalysis can pass the tests which were written for HydrogenBondAnalysis.
|
@orbeckst Sorry for bothering you in this busy season of GSoC, I have submitted a commit which passes all the test. Would you mind give a review, please? Thank you. Once this PR is merged, we can probably be thinking of how to use capped_distance to improve the performance. |
|
@xiki-tempula , can you please go through the comments above and for each comment reply how you addressed it or if you decided to not address it an why? Think of it as addressing revisions in a paper. Don't click the "Resolved" button on the comments. I will do this after having read your replies. Given the decisions regarding refactoring H-bond analysis in #2238 , you don't need to worry about code duplication between HydrogenBondAnalysis and WaterBridgeAnalysis for the moment. This might come up later with the new module. Reading your summary of changes will make it a lot easier for me to go through things. The PR is so big that I don't have the time to re-read all the lines of code and compare to what I said in December. (As a general rule: the smaller the PR the better the chance that someone can review it in a timely manner.) Ping me when you're done and I will review your comments and code where necessary. Thanks! |
|
@orbeckst Thank you for the comments. I have added my comments to the comments. Most of the issue is with the use of the fixture. Now, all the universe used in the test section is made into a fixture and is listed on the top of the test section. There are some lines in the test which exceeds 80 characters. I can fix that but I prefer to do that when things are finalised. |
orbeckst
left a comment
There was a problem hiding this comment.
Looking good, just address these minor issues (see comments):
- remove
.DS_Storefiles – add .DS_Store to.gitignore - small documentation issues (see comments)
- very minor code style issue
| # hbonds linking the selection 1 and selection 2 to the bridging | ||
| # water 1 | ||
| [ # hbond 1 from selection 1 to the bridging water 1 | ||
| <donor index (0-based)>, |
There was a problem hiding this comment.
- add the versionchanged to the class
- add an entry to CHANGELOG's Changes stating that the output format of WaterBridgeAnalysis changed
|
|
||
| .. _pandas.DataFrame: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.html | ||
| Note that the result is arranged in the format of (key, proportion of time). When no | ||
| custom analysis function is supplied, the key is expended for backward compatibility. |
There was a problem hiding this comment.
- fix expended -> expanded (?)
- state what it is backward compatible to
| key = (s1_resname, s1_resid, s2_resname, s2_resid) | ||
| output[key] += 1 | ||
|
|
||
| w.count_by_type(analysis_func=analysis) |
There was a problem hiding this comment.
Mention the "in-place" modification requirement for the analysis() function.
| As the _timeseries to timeserie conversion will be deprecated in 1.0 | ||
| this function will automatically lose its value. | ||
| """ | ||
| def _expand_timeseries(self, entry, output_format=None): |
There was a problem hiding this comment.
What does "old" mean? Make this precise with version information, e.g. "format for release up to 0.19.2"
There was a problem hiding this comment.
The explanation has been added.
| # atom1 is hydrogen bond donor, position not swapped. | ||
| atom1, atom2 = atom1, atom2 | ||
| else: | ||
| raise KeyError('Only \'sele1_sele2\' or \'donor_acceptor\' are allowed as output format.') |
There was a problem hiding this comment.
Use double quotation marks to get rid of ugly backslash escapes.
There was a problem hiding this comment.
Double quotations added.
| See Also | ||
| -------- | ||
| :attr:`table` : structured array of the data | ||
| .. versionchanged:: 0.20.0 |
There was a problem hiding this comment.
say what changed
.. versionchanged:: 0.20.0
The output format was changed bla bla...There was a problem hiding this comment.
The change has been mentioned
|
I merged develop into it and fixed the merge conflict in CHANGELOG; note that your GitHub handle @xiki-tempula was already in the authors list for 0.20.0. |
|
@orbeckst I have made the corrections. All the lines in the test file which are too long are being altered. In the main file, though some of the lines are a bit too long, I think having them in the same line might make it easier to read. |
orbeckst
left a comment
There was a problem hiding this comment.
That was a lot of work but finally: LGTM!
Thanks for being patient and addressing all issues.
Move the water bridge analysis to the new analysis class, add high order water bridge support.
Rewritte the count_by_type and count_by_time function, add custom anaylsis function support.
PR Checklist