From: Andreas M. <an...@ma...> - 2004-11-29 19:33:02
|
Hi, with the following code I read in a SMILES, build a molecule out of it and reencode it as a string: ----------------- BEGIN CODE -------------------------------- import joelib.molecule.*; import joelib.smiles.*; public class SmilesCanonifier { public String canonify(String smiles) { JOEMol mol=new JOEMol(); JOEMol2Smi m2s = new JOEMol2Smi(); m2s.init(); StringBuffer smilesb = new StringBuffer(1000); // create mol object out of this smiles string JOESmilesParser.smiToMol(mol, smiles, smiles); // create mol to smiles converter m2s.init(); // do some correction m2s.correctAromaticAmineCharge(mol); // String buffer to hold the canonified string m2s.createSmiString(mol, smilesb); return smilesb.toString(); } public static void main(String args[]) { String smiles = args[0]; System.out.println(smiles); SmilesCanonifier sc = new SmilesCanonifier(); System.out.println(sc.canonify(smiles)); } } ----------------- END CODE ---------------------------------- When I try this on a SMILES s0 I get an equivalent output smiles s1. When I try it on s1, I get an equivalent output smiles s2, which is different from s1. When I try it on s2, I get an equivalent output smiles s3, which is the same as s1, s3=s1. When I try it on s3=s1, I get an equivalent output smiles s4, which is the same as s2, s4=s2. The process repeats from now on, switching between two SMILES versions. Is there no canonical version? Otherwise, how can I get one? Greetings, Andi |