User 870ab5b546
02-07-2012 18:37:26
The code:
public static List<Molecule> enumerateStereo(Molecule cpd) {
final String SELF = "StereoFunctions.enumerateStereo: ";
convert0DTo2D(cpd);
debugPrint(SELF + "after converting 0D to 2D: ", cpd);
allWavyToCrissCross(cpd);
debugPrint(SELF + "after converting wavy bonds to crisscross bonds: ", cpd);
List<Molecule> stereoisomers = null;
try {
final StereoisomerPlugin plugin = new StereoisomerPlugin();
plugin.setMolecule(cpd);
plugin.setStereoisomerismType(StereoisomerPlugin.BOTH);
plugin.setProtectTetrahedralStereo(true);
plugin.setProtectDoubleBondStereo(true);
plugin.run();
final Molecule[] molArray = plugin.getStereoisomers();
stereoisomers = Utils.molArrayToList(molArray);
} catch (PluginException e) {
Utils.alwaysPrint(SELF + "caught PluginException while "
+ "generating stereoisomers of ", cpd);
stereoisomers = new ArrayList<Molecule>();
stereoisomers.add(cpd);
} // try
debugPrint(SELF + "enumerated ", stereoisomers.size(),
" stereoisomer(s) from ", cpd, ": ", stereoisomers);
return stereoisomers;
} // enumerateStereo(Molecule)
The log:
StereoFunctions.enumerateStereo: after converting 0D to 2D: C[CH:1]1[CH:2]=[CH:3][CH2:4][CH2:5][CH:6]1C=O
StereoFunctions.enumerateStereo: after converting wavy bonds to crisscross bonds: C[CH:1]1[CH:2]=[CH:3][CH2:4][CH2:5][CH:6]1C=O
StereoFunctions.enumerateStereo: enumerated 4 stereoisomer(s) from C[CH:1]1[CH:2]=[CH:3][CH2:4][CH2:5][CH:6]1C=O: [C[C@H]1C=CCC[C@@H]1C=O.C[C@@H]1C=CCC[C@@H]1C=O.C[C@H]1C=CCC[C@H]1C=O.C[C@@H]1C=CCC[C@H]1C=O]
Note that the atom numbers disappeared when the stereoisomers were enumerated. I would like them to be preserved.