User 21371533d0
06-11-2006 19:17:19
I have some code that reads compounds in SMILES, then creates new Molecules and saves them back in SMILES. I came across some compounds where Marvin failed to preserve the correct chirality. Here is an example:
This dumps
as the new SMILES. I tested this with MarvinBeans 3.5.8, 4.0.6, and 4.1.2 under Linux Fedora Core 4 running kernel 2.6.12 and Java 1.5.0_04, and they all gave the same result.
Finally, I loaded the original smiles
to MarvinViewer (Version 4.1.2). Please see the attached 3D view. According to the SMILES, looking from H the other three neighbors N, S and Cl should be in anticlockwise order. But they are drawn in clockwise order which is wrong. Note that MarvinViewer 4.0.6 draws the correct 3D view!
Code: |
public static void main(String[] args) throws Exception { Molecule mol = MolImporter.importMol("[H][C@](N)(S)Cl"); Molecule newMolecule = new Molecule(); for (int atomIndex= 0; atomIndex < mol.getAtomCount(); atomIndex++) { MolAtom atom = mol.getAtom(atomIndex); MolAtom newAtom = new MolAtom(atom.getAtno()); newAtom.setFlags(atom.getFlags()); newMolecule.add(newAtom); } for (int bondIndex= 0; bondIndex < mol.getBondCount(); bondIndex++) { MolBond bond = mol.getBond(bondIndex); MolBond newBond = new MolBond(newMolecule.getAtom(mol.indexOf(bond.getAtom1())), newMolecule.getAtom(mol.indexOf(bond.getAtom2())), bond.getType()); newMolecule.add(newBond); } mol.clean(2, null); newMolecule.clean(2, null); for (int atomIndex= 0; atomIndex < mol.getAtomCount(); atomIndex++) { if (mol.getChirality(atomIndex) > 0) { newMolecule.setChirality(atomIndex, mol.getChirality(atomIndex)); } } System.err.println("New smiles: " + newMolecule.toFormat("smiles")); } |
This dumps
Quote: |
[H][C@@](N)(S)Cl |
Finally, I loaded the original smiles
Quote: |
[H][C@](N)(S)Cl |