Re: [Open Babel] Maintaining cis/trans after fragmentation

2016-12-28 Thread Sam Tonddast-Navaei
Thanks Noel, it works like a charm! On Wed, Dec 28, 2016 at 8:13 AM, Noel O'Boyle wrote: > You have an off-by-one due to a misunderstanding of where the stereo > is stored. For cis-trans stereo, the stereobond is the double bond, > not the up/down single bonds. On top of this, the stereo code us

Re: [Open Babel] Maintaining cis/trans after fragmentation

2016-12-28 Thread Noel O'Boyle
You have an off-by-one due to a misunderstanding of where the stereo is stored. For cis-trans stereo, the stereobond is the double bond, not the up/down single bonds. On top of this, the stereo code uses atom Ids and not atom indices (I can't remember the rationale for this). Anyhoo, here is a work

Re: [Open Babel] Maintaining cis/trans after fragmentation

2016-12-26 Thread Sam Tonddast-Navaei
Dear colleagues, I just realized that if I add "addh()" before printing the SMILES I would get the correct transferred SMILES. - Any clue why that makes it work? - I also realized that in case of cis/trans stereo chemistry only one of the carbons returns "True" when calling HasCisTransStereo(ato

Re: [Open Babel] Maintaining cis/trans after fragmentation

2016-12-26 Thread Sam Tonddast-Navaei
Hi Noel, I made this script: #!/usr/bin/python > import pybel > import openbabel as ob > > mol = pybel.readstring('smi','OC\C=C\Cl') > print 'OC\C=C\Cl' > facade = ob.OBStereoFacade(mol.OBMol) > a = mol.OBMol.NewAtom() > a.SetAtomicNum(9) > > bonds = [] > for bond in ob.OBMolBondIter(mol.OBMol):

Re: [Open Babel] Maintaining cis/trans after fragmentation

2016-12-26 Thread Sam Tonddast-Navaei
Hahaha, I actually do suck and still stuck :) An example script is always helpful and I would really appreciate it if you get a chance to thanks again On Mon, Dec 26, 2016 at 3:38 PM, Noel O'Boyle wrote: > Sorry - I did mean stuck. Maintaining stereo is tricky. > > On 26 Dec 2016 8:34 p.m., "No

Re: [Open Babel] Maintaining cis/trans after fragmentation

2016-12-26 Thread Noel O'Boyle
Sorry - I did mean stuck. Maintaining stereo is tricky. On 26 Dec 2016 8:34 p.m., "Noel O'Boyle" wrote: > If you are still suck, let us know and I'll put an example together. > > On 26 Dec 2016 8:33 p.m., "Noel O'Boyle" wrote: > >> Configs are immutable. You need to create a new config, and the

Re: [Open Babel] Maintaining cis/trans after fragmentation

2016-12-26 Thread Noel O'Boyle
If you are still suck, let us know and I'll put an example together. On 26 Dec 2016 8:33 p.m., "Noel O'Boyle" wrote: > Configs are immutable. You need to create a new config, and then use > setconfig or something like this. > > On 26 Dec 2016 8:09 p.m., "Sam Tonddast-Navaei" > wrote: > >> Thank

Re: [Open Babel] Maintaining cis/trans after fragmentation

2016-12-26 Thread Noel O'Boyle
Configs are immutable. You need to create a new config, and then use setconfig or something like this. On 26 Dec 2016 8:09 p.m., "Sam Tonddast-Navaei" wrote: > Thanks Noel, I figured it out thanks to your hint. Is there a function > that allows to change the refs? It seems that in python Config.

Re: [Open Babel] Maintaining cis/trans after fragmentation

2016-12-26 Thread Sam Tonddast-Navaei
Thanks Noel, I figured it out thanks to your hint. Is there a function that allows to change the refs? It seems that in python Config.ref returns a tuple. I am trying to change the old ref_id to a new one. Thanks for your help. On Sun, Nov 20, 2016 at 5:38 AM, Noel O'Boyle wrote: > Look at the

Re: [Open Babel] Maintaining cis/trans after fragmentation

2016-11-20 Thread Geoffrey Hutchison
> trying to copy the bond property (IsUp or IsDown) and assign it to the new > bonds (bonds assign tot he dummy atoms). However I figured out that both > functions are returning False values. As Noel indicated, OBStereoFacade (and related classes) are used to track stereochemistry. The "Up/Down

Re: [Open Babel] Maintaining cis/trans after fragmentation

2016-11-20 Thread Noel O'Boyle
Look at the docs for OBStereoFacade and related classes. Stereo is stored in a Config object with refs to the four IDs of the atoms connected to the atoms of the double bond. On 19 Nov 2016 11:35 p.m., "Sam Tonddast-Navaei" wrote: > Hello all, > > I am trying to break a molecule into two fragme