-
Notifications
You must be signed in to change notification settings - Fork 662
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
Make CRD EXT format optional #3635
Conversation
Hello @mdpoleto! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2022-04-18 18:42:36 UTC |
Codecov Report
@@ Coverage Diff @@
## develop #3635 +/- ##
===========================================
+ Coverage 94.25% 94.28% +0.03%
===========================================
Files 190 190
Lines 24791 24792 +1
Branches 3340 3340
===========================================
+ Hits 23367 23376 +9
+ Misses 1376 1368 -8
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.
Thanks for the PR @mdpoleto . I have a number of initial comments.
- Why do we need the extended kwarg in write() and init? Isn't init sufficient? Right now I'd remove the kwarg from write() but if you can convince me that it should be there I'll change my mind. Is there a specific reason why it needs to be in two places or do other writers do similar things?
- The code can be simplified, see comments (you can accept the suggestions to make your life easier).
- Please add tests for the new functionality.
- Please update CHANGELOG.
- Add yourself to AUTHORS.
Co-authored-by: Oliver Beckstein <orbeckst@gmail.com>
Co-authored-by: Oliver Beckstein <orbeckst@gmail.com>
Co-authored-by: Oliver Beckstein <orbeckst@gmail.com>
Co-authored-by: Oliver Beckstein <orbeckst@gmail.com>
@orbeckst Thanks for your comments and patience. This is my first PR to a big code like MDA, so I am still learning how to navigate the process. I am not sure how to add test cases for this new functionality. Could you provide some tips to that? |
Contributing to a medium sized package such as MDAnalysis is certainly a learning experience. In the User Guide we have a section Contributing to the main codebase that you should have a look at. We're trying to help, and we thank you for your patience in advance. The process can take a while because we strive to maintain high code quality so there will invariably be multiple rounds of reviews, often from different developers. We aren't making petty requests but we are all trying our best to make our code useful and robust for the few thousand users that rely on it for their work. Testing is therefore incredibly important; the User Guide has a section on testing. The CRD format can be used both for topology information (through the CRDParser) and as a coordinate CRDReader and CRDWriter. You are modifying the CRDWriter so you need to add tests that check your new functionality. These tests are located in testsuite/MDAnalysisTests/coordinates/test_crd.py. Look for tests for writing. Then start by adding your own test, modelled on the existing one, where you use your new feature. Check in your test that the output is correct. During development I run tests locally using When you push your changes to the branch, have a look at the Checks and the coverage. It can tell you which lines have not been tested. |
@orbeckst Thanks for all the info. I did read the "Contributing to the main codebase" section, which was very helpful. The testing section now was very helpful. I included a test for the extended format and it ran just fine locally. I included it on my last commit. If anything else is needed, please let me know. |
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.
Looks really good! I have a minor doc comment and I'd like to see a second test that shows that we can read the extended file that we wrote. It would look similar to the test you wrote but now you also read back the outfile
and assert that you get the right number of atoms, residues, and perhaps the center of geometry of all positions, and the total charge of the system (or something like that — you get the idea, test in aggregate so that you see if something is not read properly).
Co-authored-by: Oliver Beckstein <orbeckst@gmail.com>
#return str(tmpdir) + '/out.crd' | ||
return os.path.join(str(tmpdir), 'test.crd') |
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.
why this change? iirc tmpdir
is a Path
object so should work ok as is?
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 what I understood from @tylerjereddy 's comment, using this construct is preferred since it does not leave artifacts behind. See full discussion at: #3635 (comment)
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 was indeed what @tylerjereddy suggested.
Maybe @richardjgowers was thinking to use
return str(tmpdir / 'test.crd')
We do need a str
for Universe as we cannot use py.path or pathfile objects yet.
By the way, please remove commented out code.
@orbeckst at the time of my last commit all checks passed but now there seems to be a conflict with AUTHORS. Should I address it? |
@mdpoleto yes please resolve the conflict — just add your name at the end of the AUTHORS list. We just had another PR merged that collided with yours. That's not uncommon. |
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.
please see comments, sorry to be short
@orbeckst I believe I addressed them all. Let me know if anything else is needed |
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.
All good. Thank you for your contribution!
I had some minor comments that I am adding to the PR.
When the tests come back all clear, I will squash-merge the PR.
Congratulations on your first contribution, @mdpoleto ! I'll send you an invite for the org so that you're also listed as a Contributor, if you accept. |
Thanks for all the help and guidance @orbeckst |
Update of AUTHORS and CHANGELOG with inferred author contributions. * Removed duplicate mattwthompson in 0.20.0 changelog entry.: mattwthompson was placed twice by accident, this removes this duplication. * Addition of missing authors. An retrospective analysis of the authors found via `git shortlog -s -n --email --branches="develop"` found several commits by authors which were not present in the `AUTHORS.md` file. - Zhenbo Li: commited via PR: Started tests for gnm. #803 and Make Travis run tests on OSX. #771, - Jenna M. Swarthout via PR Update CoC according to suggestions from current CoC committee #4289 and Point to new reporting form link (owned by conduct@mdanalysis.org) #4298, - Bradley Dice via PR Fix GSD Windows compatibility #2384 , - David Minh via PR #2668 There seemed to be no indications in the above mentioned PRs that the author did not want to be in the authors file, it looks like it was just forgotten. * Addition of missing entries from the changelog Continued cross referencing of the git shortlog output but also accounting for the changelog identified several individuals that had not been included in the changelog entries for the release they contributed under. They were added to the relevant entry of the changelog based on the merge commit date. Please note that for Tone Bengsten, we a) had no github handle (so they were assigned @tbengtsen), and b) no specific commit. Given we know that this individual was including alongside the encore merge, they were assigned to the 0.16.0 release. * Update CHANGELOG * PR #1218 * PR #1284 and #1408 * PR #4109 * based on git history * PRs #803 and #771 (author addition, changelog addition) * PR #2255 and #2221 * PR #1225 * PR #4289 and #4298 * PR #4031 * PR #4085 * PR #3635 * PR #2356 * PR #2559 * No GH handle - Encore author addition @tbengtsen * PR #4184 * PR #2614 * PR #2219 * PR #2384 * PR #2668 * Add missing entry for Jenna Thanks to @fiona-naughton for helping out with digging into this data :) Co-authored-by: Fiona Naughton <fiona@mdanalysis.org> Co-authored-by: Oliver Beckstein <orbeckst@mdanalysis.org>
Fixes issue #3605
Changes made in this Pull Request:
crdext
input for the CRDWriter.write() function.PR Checklist