Add interface to RDKit#736
Conversation
CodSpeed Performance ReportMerging #736 will not alter performanceComparing Summary
|
0ff9c1e to
b84a7db
Compare
d7a3731 to
abedbff
Compare
| for annot_name in include_annotations: | ||
| rdkit_atom.SetProp(annot_name, atoms.get_annotation(annot_name)[i].item()) |
There was a problem hiding this comment.
This looks great @padix-key !
I did some digging and a small point here that might be convenient for the future:
RDKit has some reserved fields for residue and chain level information from PDB structures and we could set those standard field instead of arbitrary properties where those exist (e.g. res_name, res_id, chain_id):
# use rdkit-native annotations for 'res_name', 'chain_id', 'res_id'
res_info = Chem.AtomPDBResidueInfo()
res_info.SetResidueName(atoms.res_name[i])
res_info.SetResidueNumber(int(atoms.res_id[i]))
res_info.SetChainId(atoms.chain_id[i])
rdkit_atom.SetPDBResidueInfo(res_info)The upside of this would be interoperability with tools like prolif that allow annotating interaction information
There was a problem hiding this comment.
There was a problem hiding this comment.
Ok reading the documentation there's an even easier way to set it directly in one go, e.g.
Chem.AtomPDBResidueInfo(atomName="CA", residueName="ALA", chainId="A", residueNumber=1, occupancy=1.0, isHeteroAtom=False, insertionCode="")
There was a problem hiding this comment.
Good spotting, I missed there is a dedicated location for this. I agree we should use AtomPDBResidueInfo instead and only use include_annotations for optional catgegories were we would need to use SetProp.
Would like to create a follow-up PR for this? Note that the upstream branch needs to be interfaces, as the RDKit interface is not in main yet. The reason is that I aim to bundle the release of the interfaces subpackage together with the PyMOL and OpenMM interface
As described in #709, this PR adds an interface to RDKit and also sets the design of other future
biotite.interfacesubpackages. Let me know what you think, especially the design on the higher level (e.g. the@requires_version()decorator, addingpackagingas dependency, the nomenclature withfrom_*andto_*)@t0mdavid-m @JHKru @MaxGreil