Preserve residue IDs, insertion codes, and bond orders in OpenMM topology conversions#1316
Merged
Merged
Conversation
added 2 commits
September 11, 2023 17:35
swails
reviewed
Sep 12, 2023
| order = n | ||
| top.addBond( | ||
| atoms[bond.atom1.idx], atoms[bond.atom2.idx], type=type, order=order | ||
| ) |
Contributor
There was a problem hiding this comment.
I've also recently added a qualitative_type that is basically a translation of the RDKit bond types. Not sure if that would be useful here or not.
Contributor
Author
There was a problem hiding this comment.
Hmm... maybe. Would it make sense to add
qualitative_type = None
if b.type is not None:
name = repr(b.type).upper()
if hasattr(QualitativeBondType, name):
qualitative_type = getattr(QualitativeBondType, name)to parmed.openmm.load_topology(), and do something like
type = None
if bond.qualitative_type is not None:
name = bond.qualitative_type.name.lower().capitalize()
if hasattr(app, name):
t = getattr(app, name)
if t in bond_orders_by_openmm_type: # ensure t is a recognized type
type = t
else: # try determining the type from the bond order
for t, o in bond_orders_by_openmm_type.items():
if math.isclose(bond.order, o):
type = tin Structure.topology.getter()?
Contributor
There was a problem hiding this comment.
I'm tempted to say let's hold off on that until and unless it proves useful, and let's just get this change merged.
Contributor
|
The build failures are fixed in #1315, so once that is merged this can be rebased and should run to completion. The failures are a result of downstream updates in dependencies (scipy, AmberTools, and OpenMM). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR modifies
parmed.openmm.load_topology()andStructure.topology.getter()in order to preserve additional topology information.Changes to
parmed.openmm.load_topology():idis the string representation of an integer, set the corresponding ParmEd residuenumberto that integer.insertion_code<- OpenMM residueinsertionCodetypedata, use it to set the corresponding ParmEd bondorder. Otherwise, use the OpenMM bondorder(converted to a float).Changes to
Structure.topology.getter():id<- string representation of ParmEd residuenumberinsertionCode<- ParmEd residueinsertion_codeorderto determine OpenMM bondtypeandorder.