[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bkchem-user] Using BKChem as a library for generation of 2D structu
From: |
Noel O'Boyle |
Subject: |
Re: [Bkchem-user] Using BKChem as a library for generation of 2D structure images |
Date: |
Mon, 21 Apr 2008 16:24:04 +0100 |
I have not yet looked at the development code, but it seems to me that
the current release of OASA does not allow me to specify the
stereochemistry around a double bond, i.e. E/Z or in SMILES, F/C=C\F
vs. F\C=C\F. Is this true?
I must say that the images look very nice. I have one request though -
it should be possible to get back the image itself as a Cairo surface
or even just as a string representing a PNG. At the moment the only
option is to create a PNG file. I want to display the image using
Tkinter so it's better for me if I don't need to write to disk.
Noel
On 28/03/2008, Beda Kosata <address@hidden> wrote:
> You are right, OSRA (http://cactus.nci.nih.gov/osra/) is great, but my
> library is called OASA (as in Obviously Another Stupid Acronym) :)))
> Please let me know if you stumble upon anything strange. The library is
> not very well organized and presently undergoes some changes (mainly
> additions of functionality).
> You might want to try the development sources:
>
> tla register-archive http://bkchem.zirael.org/arch/2004
> tla get -A address@hidden oasa--develop oasa
>
>
> Beda
>
>
> p.s.- please be warned that some of the code might be "write-only".
>
>
> Noel O'Boyle wrote:
> > OSRA looks perfect for the job (particularly example2.py). I will
> > carry out some tests with it over the weekend.
> >
> > Noel
> >
> > On 27/03/2008, Beda Kosata <address@hidden> wrote:
> >> Noel O'Boyle wrote:
> >> >
> >> > Hmm...it seems that it's necessary to start the Application. Do you
> >> > have any plans to separate some of the functionality into a library
> >> > that could be accessed without starting the App? For example, I simply
> >> > want to (1) build a molecule (using the information in the connection
> >> > table of a pybel molecule), (2) generate 2D layout, (3) create an
> >> > image (preferably stored in a string, rather than in a file).
> >>
> >>
> >> The problem here is that the started App lets you measure exact (or
> >> almost exact) text size, thus enabling much nicer output.
> >> Also there is the whole machinery of the App behind you, so you can
> >> relatively easily work with color, fonts, etc.
> >> But its true that it is slow and ineffective.
> >>
> >>
> >> >
> >> > It would be great to have this as a library, not just for Pybel.
> >> > According to today's write up on Depth First, BKChem is one of only 4
> >> > available structure diagram generators...and the only one in Python
> >> > (see
> http://depth-first.com/articles/2008/03/26/five-open-tools-for-2d-structure-layout-aka-structure-diagram-generation)
> >> >
> >>
> >>
> >> Interesting. The 2D coordinate generation is done in the OASA library I
> >> mentioned. This particular part of the library was written some 3 or 4
> >> years ago when I was doing a postdoc in Germany and had plenty of free
> >> time in the evenings. I did not touch the code since and it has some
> >> weak points (such as possible overlaps of atoms in highly branched
> >> structures), etc.
> >>
> >> This brings us nicely to the second option I mentioned - using OASA (the
> >> library that is behind BKChem). I use it on http://inchi.info to
> >> generate pictures in the converter. It is not able to run without
> >> X-windows installed, because it uses cairo for picture generation and
> >> cairo does not work without X installed. However, you don't need X
> >> running. I use it for PNGs now, but cairo is capable of producing PDF's,
> >> EPS's and SVG's as well.
> >> I attach two small scripts that demonstrate what you can do. Just copy
> >> it to the bkchem directory where the oasa library resides and run it. As
> >> you can see the OASA api is not that different from Pybel and it would
> >> be almost no effort to create a bridge between the two (as I intent to
> >> do in neat future :)
> >> The only problem here is that I did not put that much effort into the
> >> cairo output backend, so the result is not that nice. Also there is not
> >> much support for configuration of display options for atoms, fancy
> >> things like sub- and superscripts, etc. (In BKChem you can say "I want
> >> this atom rendered with symbol on and hydrogens on, I also want each
> >> nitrogen atom painted in green"; you cannot do this in OASA (without
> >> some hacking)).
> >> It all depends on what you need.
> >>
> >>
> >> > My other question is how stable is the BKChem API?
> >> >
> >>
> >>
> >> Well, it depends. Some parts of the API are pretty stable, but I don't
> >> hesitate when I need to change something when I need to. I try to
> >> document changes in commit logs, but not very thoroughly because I am
> >> the only one working on BKChem.
> >> Maybe it is better to give an example - there are some batch scripts
> >> that I have created some two years ago that work even with recent
> >> versions. On the other hand there are a few that I had to tweak slightly
> >> because they used things that changed slightly over the time.
> >>
> >> Best regards
> >>
> >>
> >> Beda
> >>
> >>
> >
>
>
>
> --
>
> Bedrich Kosata
> Laboratory of Informatics and Chemistry
> ICT Prague
> Czech Republic
>
>
- Re: [Bkchem-user] Using BKChem as a library for generation of 2D structure images,
Noel O'Boyle <=