Forwarding to list. ---------- Forwarded message ---------- From: Dave Nunn <[email protected]> Date: 6 June 2011 21:14 Subject: Re: [OpenBabel-scripting] Chiral flag lost To: Noel O'Boyle <[email protected]>
When reading in an sdf or mol record, the status of the chiral flag is present, 0 (off) or 1 (on), in the source information, and should be stored as a property of the molecule. For other input formats, the value is probably best thought of as null/unknown. When writing to sdf or mol records, or to InChI with the ChiralFlagON/ChiralFlagOFF options, any known information, either from reading in another sdf/molfile or from an api call that set the flag) should be propagated. The problem, of course, is the case that the input format (e.g., SMILES) has no real concept of chiral flag (such that the information is null/unknown) and the output format (sdf or mol) treats it as a more-or-less required field (should always be 0 or 1). I'm not sure exactly how OB's current IsChiral is defined, but, assuming it returns 1/0 True/False, then it would provide a reasonable guess for the unknown case, though it likely errs on the side of assuming the stereochemistry is absolute. The name (as chosen by MDL for molfile formats) "Chiral Flag" is unfortunate, since it is not generally turned on whenever the structure depicted lacks an internal plane of symmetry, but when the depiction of the sample represented is to be interpreted in an absolute sense, rather than a relative sense. Thus, 1,3-trans-dimethylcyclohexane drawn with the chiral flag on is used to reference a single enantiomer, while the (otherwise) identical molfile with the chiral flag off references the racemate. Though clearly all 1,3-trans-dimethylcyclohexane molecules are chiral, whether they are part of a racemic mixture or not. Not sure if there are any other input or output formats where the chiral flag status really exists. -DSN On Mon, Jun 6, 2011 at 11:58 AM, Noel O'Boyle <[email protected]> wrote: > > And since we're on the topic, what do you do if a sample is racemic? > > So it sounds like you want a Set/Get/HasChiralFlag (or perhaps > HasKnownAbsoluteStereo). If a molecule doesn't have a chiral flag, we > should call IsChiral (as Geoff has done) and use that value. > > - Noel > > On 6 June 2011 17:05, Dave Nunn <[email protected]> wrote: > > 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
