When trying to convert PDB files to CML files (to test the CMLFileDescriber...) the underlying jumbo classes complained about adding bonds that had already been added (cdk bug 204663).
Turns out, it was a problem with the PDBReader, which wasn't handling CONECT records properly. Oddly, CONECT are fully redundant, so atom 10 and atom 50 are both "CONECT 10 50" and "CONECT 50 10".
The fix I used was to store the bonds from CONECT in a list, but checking each time to see if it was alread there. It wasn't possible to use "bondA == bondB", as that checks refs, and each bond is a new object.
I should say, though, that maybe it's not worth worrying about problems with reading PDB files (an old format) in CDK (dedicated to chemical data). PDB files are horrible to read, anyway.
Turns out, it was a problem with the PDBReader, which wasn't handling CONECT records properly. Oddly, CONECT are fully redundant, so atom 10 and atom 50 are both "CONECT 10 50" and "CONECT 50 10".
The fix I used was to store the bonds from CONECT in a list, but checking each time to see if it was alread there. It wasn't possible to use "bondA == bondB", as that checks refs, and each bond is a new object.
I should say, though, that maybe it's not worth worrying about problems with reading PDB files (an old format) in CDK (dedicated to chemical data). PDB files are horrible to read, anyway.
Comments