Residue rotation and UA translation axes for terminal residues - #416
Conversation
…d atoms + average of all other heavy atoms in resid
harryswift01
left a comment
There was a problem hiding this comment.
Thank you for sending these changes through! I think this is a really good improvement, and it’s great to see the terminal residue handling becoming more robust and independent of atom indexing. I’ve just left a few comments around some small technical and maintainability points. If you’re able to have a look through them and let me know what you think, that would be great. Overall, I think this is looking really good and is very close to being ready to go in!
|
@harryswift01 Thank you, Harry! I will make the changes. |
…ed from get_residue_axes and get_UA_axes
…ing print statement
…ed from get_residue_axes and get_UA_axes
…ing print statement
Hi @ioanaapapa, thanks for double checking! Yes, this would be the same issue, not a second one, I just spotted it in a few other tests too. If you're able to apply the same fix there as well, that'd be great. |
|
Thank you! I'll change the tests |
harryswift01
left a comment
There was a problem hiding this comment.
Thanks again for making these changes @ioanaapapa it's looking really good now! Just a couple of small things I noticed, mostly around the docstrings: there are a few repeated lines in there that would be great if we tidied up, I've left comments pointing to each one. I also spotted one thing in get_residue_custom_axes it might be worth adding a guard there to catch zero-length axis vectors, similar to what get_custom_axes already does, just so we don't end up with any NaN values slipping through.
Other than that, this is very close, just a few minor polishing points and I think we'll be good to merge.
|
|
||
| # look for heavy atoms in residue of interest | ||
| residue_heavy_atoms = residue.atoms.select_atoms("mass 2 to 999") | ||
| residue_heavy_atoms = residue.atoms.select_atoms("mass 2 to 999") |
There was a problem hiding this comment.
These two lines also repeat here as well, lines 347 and 348
| @@ -598,7 +589,109 @@ def get_residue_custom_axes(self, edges, center): | |||
| y_axis /= np.linalg.norm(y_axis) | |||
There was a problem hiding this comment.
Whilst I was having a look, I saw that get_custom_axes guards against zero-length axis vectors and raises a clear ValueError if they end up with zero length, but get_residue_custom_axes doesn't have the same check. I think it would be nice to put that raise check in here too, in case any NaN values creep in.
|
@harryswift01 I've tidied up the docstrings and added a ValueError raise in get_residue_custom_axes, alongside a unit test for that. Hope it's okay now! |
harryswift01
left a comment
There was a problem hiding this comment.
Hi @ioanaapapa, thank you for all your work on this! This is all looking good from a technical side now and I can't see any reason why this can't be merged in. Just before we do merge this in, as this is a change in the numerics/science, if @skfegan or @jkalayan or @jimboid could have also have a look at this as well just to make sure there isn't anything I've missed from the science side, then after their approval I'd be happy to see this merged in, this is all great work, thank you again!
jimboid
left a comment
There was a problem hiding this comment.
Improvements to the way terminal residues are treated will help to fix some edge case issues reported on the issue tracker. This has been discussed at length at the all hands meetings with Richard, happy to see this merged @ioanaapapa.
Summary
Terminal residue axes are no longer dependent on atom indices. The edge atom (i.e. heavy atom bonded to neighbour residue) is chosen alongside the average position of heavy atoms bonded to the edge atom and average position of all other heavy in the residue as the three points used for determining the axes. The centre of rotation (at res level)/translation (at UA level) and axes are then computed from the three points similar to the case of non-terminal residues.
Changes
Terminal residue treatment was changed
Edge cases have been introduced
Tests for terminal residues and edge cases
Documentation
get_residue_axes and get_UA_axes structure change
Impact