highlight substructures with pybel

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

highlight substructures with pybel

david.lagorce
Dear all,

By reading Noel O'Boyle's blog, and his post "Portrait of the molecule
as a green substructure"
(http://baoilleach.blogspot.fr/2012/02/portrait-of-molecule-as-green.html),
I understood that it is possible to depict a molecule in svg with obabel
and highlight some substructures in color.
But, is it possible with pybel?

Thank you all

David



------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
OpenBabel-Devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-devel
Reply | Threaded
Open this post in threaded view
|

Re: highlight substructures with pybel

Geoff Hutchison
> But, is it possible with pybel?

Of course. You can set output flags when writing molecules with Pybel.

molecule.write("svg", "test.svg", False, opt)

       opt -- a dictionary of format-specific options
              For format options with no parameters, specify the
              value as None.

Hope that helps,
-Geoff

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
OpenBabel-Devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-devel
Reply | Threaded
Open this post in threaded view
|

Re: highlight substructures with pybel

david.lagorce
Thanks Geoff...
but I still have problem...I tried in svg and png and I have this message:
==============================
*** Open Babel Warning  in PNG Format
  Embedding in InChI format.
Use the -xO (uppercase O) option for a different format
==============================
*** Open Babel Warning  in InChI code
  DB00573 :Omitted undefined stereo



any idea ?

Thank you
Reply | Threaded
Open this post in threaded view
|

Re: highlight substructures with pybel

Noel O'Boyle
Administrator
We added "--highlight" to provide this functionality. This is an
"operation", and is used as follows:

import pybel

mol = pybel.readstring("smi", "CC(=O)Cl")
highlighter = pybel._operations["highlight"]
highlighter.Do(mol.OBMol, "C(=O) green")
mol.write("svg", "tmp.svg", opt={"u":None, "C":None}, overwrite=True)

This is equivalent to:
     obabel -:"CC(=O)Cl" -O tmp.svg -xC -xu --highlight "C(=O) green"

On 8 July 2013 09:43, david.lagorce <[hidden email]> wrote:

> Thanks Geoff...
> but I still have problem...I tried in svg and png and I have this message:
> ==============================
> *** Open Babel Warning  in PNG Format
>   Embedding in InChI format.
> Use the -xO (uppercase O) option for a different format
> ==============================
> *** Open Babel Warning  in InChI code
>   DB00573 :Omitted undefined stereo
>
>
>
> any idea ?
>
> Thank you
>
>
>
>
> --
> View this message in context: http://forums.openbabel.org/highlight-substructures-with-pybel-tp4656468p4656473.html
> Sent from the openbabel-devel mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Windows:
>
> Build for Windows Store.
>
> http://p.sf.net/sfu/windows-dev2dev
> _______________________________________________
> OpenBabel-Devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/openbabel-devel

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
OpenBabel-Devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openbabel-devel
Reply | Threaded
Open this post in threaded view
|

Re: highlight substructures with pybel

david.lagorce
Hi Noel,

thanks a lot...
I am still working with OB 2.2.3 and I think it is not implemented in this version. I will try to migrate to the last version.

Thank you to everyone

David