On Sun, Jul 31, 2011 at 10:54 PM, Richard Ball <[email protected]> wrote:
> Thanks Mike. The problem I want to provide a solution for (assuming there is
> one) is: if someone has/gets a .mol file with a complex multi-stereocenter
> molecule how can they get the R/S assignment for the particular atoms in the
> .mol file while retaining the identity of those atoms.
The CDK can do this starting from SMILES with @ and @@ annotation.
I have used code like this (using Groovy, a Java dialect):
IMolecule mol = sp.parseSmiles(smiles)
Iterable<IStereoElement> stereos = mol.stereoElements()
Map<IAtom,ILigancyFourChirality> stereoList = new
HashMap<IAtom,ILigancyFourChirality>();
for (IStereoElement stereo : stereos) {
if (stereo instanceof ILigancyFourChirality) {
ILigancyFourChirality ligancy = (ILigancyFourChirality)stereo;
stereoList.put(ligancy.getChiralAtom(), ligancy);
}
}
print "mol " + id + ": "
try {
for (IAtom atom : mol.atoms()) {
if (stereoList.containsKey(atom)) {
rsChirality = CIPTool.getCIPChirality(mol, stereoList.get(atom));
print "" + rsChirality + " "
}
}
} catch (StackOverflowError e) {
print "StackOverflow";
// e.printStackTrace()
}
Egon
--
Dr E.L. Willighagen
Postdoctoral Researcher
Institutet för miljömedicin
Karolinska Institutet (http://ki.se/imm)
Homepage: http://egonw.github.com/
LinkedIn: http://se.linkedin.com/in/egonw
Blog: http://chem-bla-ics.blogspot.com/
PubList: http://www.citeulike.org/user/egonw/tag/papers
------------------------------------------------------------------------------
Got Input? Slashdot Needs You.
Take our quick survey online. Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users