Re: [Open Babel] stereo config question

2013-12-04 Thread Noel O'Boyle
Let me just answer the original question as this is getting somewhat
out of hand. :-)

Open Babel stores tetrahedral stereochemistry in a Config object. A
typical Config object associated with a tetrahedral center may have
the following fields and values:
winding: "Clockwise"
center: 2
from: 1
refs: 3 4 5

This means that looking from atom 1 towards 2, the atoms 3, 4, 5
should be arranged clockwise. I hope you agree that this perfectly
specifies the stereochemistry at atom 2.

- Noel


On 4 December 2013 03:44, Yoel  wrote:
> Hum! I’m pretty confident with what I know but the issue here is that
> you answer isn’t contributing to clarifying the question. The question
> is how to we determine the chirality of a centre regardless of how you
> may choose to represent it at a later point. And this problem
> inevitable will come down to applying the CIP rules. Do you disagree
> with that?
>
> On 3 December 2013 22:34, Craig James  wrote:
>> On Tue, Dec 3, 2013 at 1:11 PM, Yoel  wrote:
>>>
>>> Craig,
>>>
>>> Thanks a lot for this. I do not know the smile notation in details
>>> however as a chemist I’m pretty sure I understand chirality. If I
>>> understood your article I see that explains how chirality is
>>> represented in smile notations but I still don’t see how do you know
>>> what chirality to represent starting from a mol file lets say.
>>
>>
>> The reason that Dave Weininger invented SMILES' way of representing
>> chirality is that it's much more sensible from a
>> mathematical/graph-theoretical perspective than R/S and E/Z representation.
>> R/S and E/Z are potentially time-consuming to compute.  They are usually
>> illustrated with trivial examples, such as Cl/C=C/Cl, where it's obvious
>> that it's trans.  But what is CCC/C(\CCO)=C(/CCCl)\CCBr -- E or Z?  There is
>> a formal definition, but most chemists probably couldn't tell you at a
>> glance whether this molecule should be called E or Z.  The same goes for R/S
>> naming conventions.  With SMILES, the algorithm only has to look out one
>> atom from the chiral center, or one atom out from the double-bonded atoms,
>> to figure out how to write the SMILES (with the caveat that it first has to
>> do a symmetry analysis).
>>
>> Cheers,
>> Craig
>>
>
> --
> Sponsored by Intel(R) XDK
> Develop, test and display web and hybrid apps with a single code base.
> Download it for free now!
> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Bindings - first and last molecule option

2013-12-04 Thread Maciek Wójcikowski
This only proves, that I really want to use it. Is the proof.py script
working correctly for anybody (attached in previous mail)? It should ouptut
molecules no. 5-10 out of 100 in proof.sdf


Pozdrawiam,  |  Best regards,
Maciek Wójcikowski
mac...@wojcikowski.pl


2013/12/3 Chris Morley 

> > On 2013-12-03 04:28, Maciek Wójcikowski wrote:
> >> You're probably right, C also has to read therm, but other than
> recognizing
> the beginning and the end of the molecule it wouldn't do anything
> especially
> kekulization and bonding etc.
> >
> On 03/12/2013 18:11, Geoffrey Hutchison wrote:
> > Actually no. Indeed this would be a useful "lazy" optimization, but is
> not
> > currently implemented this way. The C++ library does in fact read the
> file,
> > but the molecules go through the parsers, which means that things like
> > kekulization, bond perception, etc. are generally done.
>
> In fact it is implemented this way for most common multi-molecule file
> formats. The molecules before the one specified by the -f option are
> skipped without being parsed. (The format's virtual SkipObjects()
> function is used.)
>
> Chris
>
>
> --
> Sponsored by Intel(R) XDK
> Develop, test and display web and hybrid apps with a single code base.
> Download it for free now!
>
> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] stereo config question

2013-12-04 Thread Yoel
Thanks Noel,

Sure I agree and thanks for answering the original question. For
Dimitri and I that are looking for assigning R and S your original
answer was also the correct one since this winding property bears no
relation to R/S because there are no guarantees that atom 1 is the
smallest in priority. If 1 was the smallest in priority then clockwise
would correspond to S because we are looking in the direction from 1
to 2.

I apologise to Craig and Geoff and to the readers for my contribution
to the confusion.

On 4 December 2013 04:32, Noel O'Boyle [via Open Babel]
 wrote:
> Let me just answer the original question as this is getting somewhat
> out of hand. :-)
>
> Open Babel stores tetrahedral stereochemistry in a Config object. A
> typical Config object associated with a tetrahedral center may have
> the following fields and values:
> winding: "Clockwise"
> center: 2
> from: 1
> refs: 3 4 5
>
> This means that looking from atom 1 towards 2, the atoms 3, 4, 5
> should be arranged clockwise. I hope you agree that this perfectly
> specifies the stereochemistry at atom 2.
>
> - Noel
>
>
> On 4 December 2013 03:44, Yoel <[hidden email]> wrote:
>
>> Hum! I’m pretty confident with what I know but the issue here is that
>> you answer isn’t contributing to clarifying the question. The question
>> is how to we determine the chirality of a centre regardless of how you
>> may choose to represent it at a later point. And this problem
>> inevitable will come down to applying the CIP rules. Do you disagree
>> with that?
>>
>> On 3 December 2013 22:34, Craig James <[hidden email]> wrote:
>>> On Tue, Dec 3, 2013 at 1:11 PM, Yoel <[hidden email]> wrote:

 Craig,

 Thanks a lot for this. I do not know the smile notation in details
 however as a chemist I’m pretty sure I understand chirality. If I
 understood your article I see that explains how chirality is
 represented in smile notations but I still don’t see how do you know
 what chirality to represent starting from a mol file lets say.
>>>
>>>
>>> The reason that Dave Weininger invented SMILES' way of representing
>>> chirality is that it's much more sensible from a
>>> mathematical/graph-theoretical perspective than R/S and E/Z
>>> representation.
>>> R/S and E/Z are potentially time-consuming to compute.  They are usually
>>> illustrated with trivial examples, such as Cl/C=C/Cl, where it's obvious
>>> that it's trans.  But what is CCC/C(\CCO)=C(/CCCl)\CCBr -- E or Z?  There
>>> is
>>> a formal definition, but most chemists probably couldn't tell you at a
>>> glance whether this molecule should be called E or Z.  The same goes for
>>> R/S
>>> naming conventions.  With SMILES, the algorithm only has to look out one
>>> atom from the chiral center, or one atom out from the double-bonded
>>> atoms,
>>> to figure out how to write the SMILES (with the caveat that it first has
>>> to
>>> do a symmetry analysis).
>>>
>>> Cheers,
>>> Craig
>>>
>>
>>
>> --
>> Sponsored by Intel(R) XDK
>> Develop, test and display web and hybrid apps with a single code base.
>> Download it for free now!
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
>> ___
>> OpenBabel-discuss mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
> --
> Sponsored by Intel(R) XDK
> Develop, test and display web and hybrid apps with a single code base.
> Download it for free now!
> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
> ___
> OpenBabel-discuss mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>
> 
> If you reply to this email, your message will be added to the discussion
> below:
> http://forums.openbabel.org/stereo-config-question-tp4656879p4657010.html
> To unsubscribe from stereo config question, click here.
> NAML




--
View this message in context: 
http://forums.openbabel.org/stereo-config-question-tp4656879p4657012.html
Sent from the General discussion mailing list archive at Nabble.com.

--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] stereo config question

2013-12-04 Thread Craig James
On Wed, Dec 4, 2013 at 5:27 AM, Yoel  wrote:

> Thanks Noel,
>
> Sure I agree and thanks for answering the original question. For
> Dimitri and I that are looking for assigning R and S your original
> answer was also the correct one since this winding property bears no
> relation to R/S because there are no guarantees that atom 1 is the
> smallest in priority. If 1 was the smallest in priority then clockwise
> would correspond to S because we are looking in the direction from 1
> to 2.
>
> I apologise to Craig and Geoff and to the readers for my contribution
> to the confusion.
>

No need.  It's an interesting discussion.  One of the disconnects between
computer scientists (that would be me) and chemists is that the fundamental
concepts we use are different.  Computer science is an abstract discipline,
essentially a branch of mathematics.  When you represent a real-world
object as a mathematical construct, the representation is imperfect and
loses information.  It also gains properties in the mathematical world that
aren't present in the real-world object.  We need to discuss these topics
from time to time to have a meeting of the minds.

Craig
--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] stereo config question

2013-12-04 Thread Dimitri Maziuk
On 2013-12-03 22:28, Geoffrey Hutchison wrote:

> Craig's point is not that CIP is impossible, but rather from a
practical implementation side, it's easier to use other local stereo
designations. I might be wrong, but the codes that I can think of with
CIP implementations are all commercial, and as part of structure -> name
features. Both CIP and IUPAC name generation are really painful.

Painful or not, RDKit has CIP. From software dependencies POV I'd prefer 
to not have to use 2 different kits, but until you guys convince your 
peers CIP is sooo last century and everybody changes their data models, 
I'll take what works.

OE has it too, apparently, but they won't let me check their code out 
because I'm in .edu and not a PI. (Plus we're a public database, they 
seem to have an issue with those.)

Dima


--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] stereo config question

2013-12-04 Thread Ana Teixeira
 Hi all,


Interesting discussion. I have been facing this problem recently and I did
not know that RDKit could do it.


I developed an algorithm to classify stereocenters as R/S and double bonds
as E/Z using CIP rules and the information provided by openbabel.  There is
only one CIP rule that for now is not implemented: cases where only
configurational differences between ligands are detected, due to the
ambiguity of this rule, which was also described by Paulina Mata (already
mentioned by Yoel).


In summary, to determine the chirality according to the R-S notation the
steps are: (1) identify the stereocenters, (2) number the atoms in the
molecule skeleton, (3) assign the priority of each ligand according to the
CIP rules, (4) map the ligands into the skeleton groups which results in a
permutation and finally (5) determine the parity of the permutation and
compare it to the initial sense of rotation given by openbabel (clockwise
or anticlockwise) which allows the classification of the stereocenter(s) in
R or S.


 The algorithm is described in detail in the following technical report:
http://docs.di.fc.ul.pt/jspui/bitstream/10455/6894/1/TR_stereo.pdf

and was implemented in a webtool: http://nams.lasige.di.fc.ul.pt/tools.php

source code (in python): https://pypi.python.org/pypi/NAMS/0.9.2

Ana Teixeira


On Wed, Dec 4, 2013 at 3:44 PM, Dimitri Maziuk wrote:

> On 2013-12-03 22:28, Geoffrey Hutchison wrote:
>
> > Craig's point is not that CIP is impossible, but rather from a
> practical implementation side, it's easier to use other local stereo
> designations. I might be wrong, but the codes that I can think of with
> CIP implementations are all commercial, and as part of structure -> name
> features. Both CIP and IUPAC name generation are really painful.
>
> Painful or not, RDKit has CIP. From software dependencies POV I'd prefer
> to not have to use 2 different kits, but until you guys convince your
> peers CIP is sooo last century and everybody changes their data models,
> I'll take what works.
>
> OE has it too, apparently, but they won't let me check their code out
> because I'm in .edu and not a PI. (Plus we're a public database, they
> seem to have an issue with those.)
>
> Dima
>
>
>
> --
> Sponsored by Intel(R) XDK
> Develop, test and display web and hybrid apps with a single code base.
> Download it for free now!
>
> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] stereo config question

2013-12-04 Thread Yoel
Ana this is great! Thanks so much for letting us take peek!

I'll take a closer look later.

Best wishes 
Yoel



--
View this message in context: 
http://forums.openbabel.org/stereo-config-question-tp4656879p4657016.html
Sent from the General discussion mailing list archive at Nabble.com.

--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] stereo config question

2013-12-04 Thread Tim Vandermeersch
The ability to determine CIP rules is a nice feature to have but not really
necessary for most cheminformatics applications. If someone donates this
code it would certainly be considered a valuable addition. I rewrote most
of the sterochemistry code for OB a few years ago and never got around to
implementing CIP since it has limited applications (i.e. naming). The
OpenBabel system was inspired by this paper:

M. Perdih, M. Razinger, Stereochemistry and sequence rules: a proposal for
modification of the Cahn-Ingold-Prelog system, Tetrahedron: Asymmetry,
1994, Volume 5, Issue 5, 835-861


On Wed, Dec 4, 2013 at 5:20 PM, Ana Teixeira wrote:

>  Hi all,
>
>
> Interesting discussion. I have been facing this problem recently and I did
> not know that RDKit could do it.
>
>
> I developed an algorithm to classify stereocenters as R/S and double bonds
> as E/Z using CIP rules and the information provided by openbabel.  There is
> only one CIP rule that for now is not implemented: cases where only
> configurational differences between ligands are detected, due to the
> ambiguity of this rule, which was also described by Paulina Mata (already
> mentioned by Yoel).
>
>
> In summary, to determine the chirality according to the R-S notation the
> steps are: (1) identify the stereocenters, (2) number the atoms in the
> molecule skeleton, (3) assign the priority of each ligand according to the
> CIP rules, (4) map the ligands into the skeleton groups which results in a
> permutation and finally (5) determine the parity of the permutation and
> compare it to the initial sense of rotation given by openbabel (clockwise
> or anticlockwise) which allows the classification of the stereocenter(s) in
> R or S.
>
>
>  The algorithm is described in detail in the following technical report:
> http://docs.di.fc.ul.pt/jspui/bitstream/10455/6894/1/TR_stereo.pdf
>
> and was implemented in a webtool: http://nams.lasige.di.fc.ul.pt/tools.php
>
> source code (in python): https://pypi.python.org/pypi/NAMS/0.9.2
>
> Ana Teixeira
>
>
> On Wed, Dec 4, 2013 at 3:44 PM, Dimitri Maziuk wrote:
>
>> On 2013-12-03 22:28, Geoffrey Hutchison wrote:
>>
>> > Craig's point is not that CIP is impossible, but rather from a
>> practical implementation side, it's easier to use other local stereo
>> designations. I might be wrong, but the codes that I can think of with
>> CIP implementations are all commercial, and as part of structure -> name
>> features. Both CIP and IUPAC name generation are really painful.
>>
>> Painful or not, RDKit has CIP. From software dependencies POV I'd prefer
>> to not have to use 2 different kits, but until you guys convince your
>> peers CIP is sooo last century and everybody changes their data models,
>> I'll take what works.
>>
>> OE has it too, apparently, but they won't let me check their code out
>> because I'm in .edu and not a PI. (Plus we're a public database, they
>> seem to have an issue with those.)
>>
>> Dima
>>
>>
>>
>> --
>> Sponsored by Intel(R) XDK
>> Develop, test and display web and hybrid apps with a single code base.
>> Download it for free now!
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
>> ___
>> OpenBabel-discuss mailing list
>> OpenBabel-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>>
>
>
>
> --
> Sponsored by Intel(R) XDK
> Develop, test and display web and hybrid apps with a single code base.
> Download it for free now!
>
> http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
> ___
> OpenBabel-discuss mailing list
> OpenBabel-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/openbabel-discuss
>
>
--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss


Re: [Open Babel] Bindings - first and last molecule option

2013-12-04 Thread Geoffrey Hutchison
> This only proves, that I really want to use it. Is the proof.py script 
> working correctly for anybody (attached in previous mail)? It should ouptut 
> molecules no. 5-10 out of 100 in proof.sdf

No, it doesn't work.

% python proof.py | wc
 100 1001300

Hmm. Chris, any idea why this wouldn't work from Python?

obconversion = OBConversion()
obconversion.SetInFormat("sdf")
obconversion.AddOption('f', obconversion.GENOPTIONS, "5")
obconversion.AddOption('l', obconversion.GENOPTIONS, "10")
obmol = OBMol()

notatend = obconversion.ReadFile(obmol,"proof.sdf")
while notatend:
print obmol.GetTitle()
obmol = OBMol()
notatend = obconversion.Read(obmol)


--
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk___
OpenBabel-discuss mailing list
OpenBabel-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss