forlilab / Meeko

Interfacing RDKit and AutoDock
GNU Lesser General Public License v2.1
182 stars 43 forks source link

Perhaps an API change in RDKit #9

Closed everburstSun closed 2 years ago

everburstSun commented 2 years ago

I encountered a problem when using meeko with RDKit 2021.09.4. In this version of RDKit, the API to get residue number has been named as GetResidueNumber(), while in line 46 of meeko/utils/rdkitutils.py used GetResidueNum() instead, which caused an AttributeError.

AttributeError: 'AtomPDBResidueInfo' object has no attribute 'GetResidueNum'

Maybe you can fix this problem in the next update.

diogomart commented 2 years ago

Thanks for reporting, fixed in 1a88de4bd5d6f56e330b9e1f2157e2b6cc45c9c2

Just a note: if you are reading PDB files with RDKit, it is possible that RDKit assumes all bonds are single. I think it has to do with missing CONECT records in the PDB file.

everburstSun commented 2 years ago

Indeed! When working with those PDB files without CONECT records, I usually convert them to MOL file with OpenBabel, in which way the bonds will be automatically rebuilt according to atom type and distance (including double bonds and triple bonds). After converting the MOL files back to PDB, you will get the repaired PDB files with all CONECT records.

Just a note: if you are reading PDB files with RDKit, it is possible that RDKit assumes all bonds are single. I think it has to do with missing CONECT records in the PDB file.

diogomart commented 2 years ago

OpenBabel may also fail with that approach, e.g. with nitrobenzene.

$ obabel -:"c1ccccc1[N+](=O)[O-]" -o pdb --gen3d -p 7 | grep HETATM > nitrobenzene.pdb
$ obabel  nitrobenzene.pdb -O nitrobenzene.sdf
$ mk_prepare_ligand.py -i nitrobenzene.sdf -
[10:54:37] Explicit valence for atom # 6 N, 4, is greater than permitted
[10:54:37] ERROR: Could not sanitize molecule ending on line 34
[10:54:37] ERROR: Explicit valence for atom # 6 N, 4, is greater than permitted