Noel O'Boyle wrote:
> 2009/11/18 Craig A. James <cja...@emolecules.com>:
>> Tim,
>>
>> I've run into a problem: OpenBabel add a hydrogen to any potentially-chiral 
>> carbon that doesn't have four bonds, for example, when it parses "ClC(Br)I" 
>> (but not "ClC(Cl)Br" since it can't be chiral).  I'm pretty sure it's the 
>> new stereo code that's doing this, but I haven't dug into it yet.
> 
> I don't think this is right:
> 
>>>> mol = pybel.readstring("smi", "ClC(Br)I")
>>>> mol.OBMol.NumAtoms()
> 4
> 
> No hydrogen present. ?? Do I misunderstand?

   echo "C(Cl)(Br)I" | /usr/local/openbabel/bin/babel -i smi -o can -xh
   Cl[CH](Br)I

It's the "-xh" option, if you do "babel -Hcan" you'll see this:

   h  explict hydrogen form, e.g. [CH3][CH3]

We added this specifically so that you can carry hydrogens through from a 
user's drawing to a SMARTS expression.  It's a hack, for sure, but incredibly 
useful in real life.

In Python, you'd have to set the "-xh" option for the SMILES writer, using 
whatever function pybel offers for that.

Craig

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to