Skip to content
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

extended AtomGroup with: bond orders, the ability to extend an atomgr… #1978

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

michelsanner
Copy link

Added and extend() method to the AtomGroup class. This method performs the same operation as add but without creating a new AtomGRoup instance. This was done by modifying add a little and exposing the overwrite=False argument in setCoords(). I use it when adding atoms to an atom group (e.g. protonating the molecule, adding missing atoms, or mutating amino acid side chains). Since i might have several selections referring to this AtomGroup I want it to remain the same.

I also added support for storing bond order information using the new slots _bonOrders and _bondIndex.
bond orders can be set when bonds are set using an optional argument ag.setBonds(bonds, bondOrders). or after bonds have been set ag.setBondOrders(bondOrders). the bonOrders argument has to be a list of integers of length len(self._bonds) containing the following values: 1: single, 2: double, 3:triple, 4:aromatic, 5:amide.

I also add hash to the AtomGtoup to enable using them as keys in dictionaries.

@jamesmkrieger
Copy link
Contributor

This sounds great too. Thank you

@michelsanner
Copy link
Author

Hello,
I looked at the error and they seem to occur in part of the code unrelated to my changes. Can you please advise on what to do ?

thanks

@jamesmkrieger
Copy link
Contributor

Hello, I looked at the error and they seem to occur in part of the code unrelated to my changes. Can you please advise on what to do ?

thanks

It seems to be a problem with the Bioexcel Covid-19 simulations database, which happens from time to time. I'd suggest rerunning the checks in a few days, at which point they will hopefully pass

@michelsanner
Copy link
Author

Do I have to do something to get a review done ? or is it just in the queue waiting to be reviewed ?

@jamesmkrieger
Copy link
Contributor

It’s in the queue. We’re all busy but will get to it when we can

@@ -493,7 +525,7 @@ def _getCoords(self):
if self._coords is not None:
return self._coords[self._acsi]

def setCoords(self, coords, label=''):
def setCoords(self, coords, label='', overwrite=False):
Copy link
Contributor

Choose a reason for hiding this comment

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

it could help to add docs for this

Copy link
Author

Choose a reason for hiding this comment

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

Here I only exposed the overwrite=False optional argument present in the _setCoords() signature. _setCoords() is called by setCoords() but I could not pass overwrite=True. In _setCoords, overwrite can be used to force reshaping the _coords array, although the argument is not mentioned i the _setCoords() method doc string either. An alternative would have been for me to set ag1._coords to None prior to calling setCoords() but I felt exposing the argument was cleaner.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but seeing as most users probably aren’t using _setCoords much it makes sense to add this to setCoords docs too

Copy link
Author

Choose a reason for hiding this comment

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

I added the description in the doc string

prody/atomic/bond.py Outdated Show resolved Hide resolved
Copy link
Contributor

@jamesmkrieger jamesmkrieger left a comment

Choose a reason for hiding this comment

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

This looks generally good. Just some minor changes

@michelsanner
Copy link
Author

michelsanner commented Nov 8, 2024 via email

@jamesmkrieger
Copy link
Contributor

You're welcome. I don't think we have any particular process.

You'll see now that I have reviewed both your pull requests a first time and suggested several small changes.

Thanks again for adding these!

@jamesmkrieger
Copy link
Contributor

I still need to look through the changes properly

…f the overwrite arguemnt\n- fixed typo in setBondOrders dock string
@jamesmkrieger
Copy link
Contributor

The PR with the ftp hot fixes is merged so hopefully the checks just pass now

@michelsanner
Copy link
Author

michelsanner commented Nov 15, 2024 via email

@jamesmkrieger
Copy link
Contributor

you probably need to pull from the main branch

@jamesmkrieger
Copy link
Contributor

You probably need more unit tests for the new behaviour, but otherwise it looks good now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants