Thanks for your help! The way the flag is used in the pharmaceutical industry, the only real way to determine the setting is by assertion. We are not trying to track so much wether a given center is stereogenic, as whether, in a given sample, the stereochemistry is known in an absolute or relative sense. That information is not knowable from first principles, only from the sample originator. So if the input format is mol or sdf, I would propagate the setting that is there. Not sure what other formats track the same concept.
I agree it is difficult decision with other formats. Many utilities will set the flag ON if, for example, a SMILES string contains any '@' symbols, but that leads to errors in the other direction (too many flags, rather than too few). In previous work, I relied on conventions within the SMILES name to track the concept. Hmm -- I didn't see any api calls in the documentation. $obmol->SetChiral(1), $obmol->SetChiral(0), $obmol->GetChiral() to allow manipulation. On the last, you must distinguish whether you're asking if the molecule contains any stereogenic centers, or whether it's stereochemistry is in a known state for a given sample. I'm afraid I'm still just a perl hacker -- need to understand OB much better to even try to contribute code :-( -- David S. Nunn, PhD Office: 845-512-8359 Cell: 845-480-1346 [email protected] On Sun, Jun 5, 2011 at 11:43 AM, Noel O'Boyle <[email protected]> wrote: > You're right. We just set that to zero whatever the input. Open Babel > does not have code to determine whether a molecule is chiral or not. > > - Noel > > On 5 June 2011 02:19, dave.nunn <[email protected]> wrote: > > Am I missing an option, or is OB tromping on my chiral flag? > > Using Open Babel 2.3.0, as the script below shows, a mol file > > with chiral flag set is read in, but when written out, it is gone? > > > > -- Dave Nunn > > > > #!/usr/bin/perl > > use strict; > > use Chemistry::OpenBabel; > > undef($/); > > my $molfile = <DATA>; > > my $obmol = new Chemistry::OpenBabel::OBMol; > > my $obconversion = new Chemistry::OpenBabel::OBConversion; > > $obconversion->SetInAndOutFormats('sdf', 'sdf'); > > $obconversion->ReadString($obmol, $molfile); > > print $obconversion->WriteString($obmol); > > __END__ > > (S)-2-butanol > > OpenBabel06041121052D > > > > 6 5 0 0 1 0 0 0 0 0999 V2000 > > -1.7321 1.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > > -1.7321 0.0000 0.0000 C 0 0 2 0 0 0 0 0 0 0 0 0 > > -2.2321 -0.8660 0.0000 H 0 0 0 0 0 0 0 0 0 0 0 0 > > -2.7321 0.0000 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0 > > -0.8660 -0.5000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > > 0.0000 -0.0000 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0 > > 1 2 1 0 0 0 0 > > 2 3 1 6 0 0 0 > > 2 4 1 0 0 0 0 > > 2 5 1 0 0 0 0 > > 5 6 1 0 0 0 0 > > M END > > >
------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Discover what all the cheering's about. Get your free trial download today. http://p.sf.net/sfu/quest-dev2dev2
_______________________________________________ OpenBabel-scripting mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openbabel-scripting
