bugBKChem - Bugs: bug #26614, Feature Request: Multiple molecule...


bug #26614: Feature Request: Multiple molecule and whole scene handling in oasa.cdml

Submitter:  None
Submitted:  Tue 19 May 2009 01:46:07 PM UTC
Category:  None Severity:  3 - Normal
Item Group:  None Status:  In Progress
Privacy:  Public Assigned to:  beda
Open/Closed:  Open
* Mandatory Fields

Add a New Comment Rich Markup

Tue 19 May 2009 03:13:27 PM UTC, comment #3: 

Never mind.. found an answer in the source. It's working now. Thanks!


Tue 19 May 2009 02:33:19 PM UTC, comment #2: 

Thanks for your reply! I see that it can be done using bkchem, still I would prefer to be able to use it like a library. I tried to adjust that example script to use PNG(Cairo), but it fails:
 $ bkchem -b ~/Desktop/svg2png.py pydna.svg
Traceback (most recent call last):
  File "/usr/lib64/python2.5/site-packages/bkchem/bkchem.py", line 138, in <module>
    myapp.process_batch( opts)
  File "//usr/lib64/python2.5/site-packages/bkchem/main.py", line 1487, in process_batch
    execfile( plugin, the_globals)
  File "/home/reinis/Desktop/svg2png.py", line 18, in <module>
    convert_file( arg)
  File "/home/reinis/Desktop/svg2png.py", line 7, in convert_file
    if App.plugin_export( plugin, filename=outname):
  File "//usr/lib64/python2.5/site-packages/bkchem/main.py", line 1094, in plugin_export
    plugin = self.plugins[ pl_id]
KeyError: 'cairo_png'

Are the syntax for available plugins listed somewhere?


Tue 19 May 2009 01:58:15 PM UTC, comment #1: 

It is possible to do a batch conversion from CDML to cairo using a batch script for BKChem. It is described here:


you just need to rename the plugin to your desired output.
OASA will never be able to support the same output, because it handles only molecules - no graphics, text, etc. This is added on top of it in BKChem. You are right that the import of multiple molecules should be handled though - I am adding it to my long to-do list :)


Beda Kosata <beda>
Group administrator
Tue 19 May 2009 01:46:07 PM UTC, original submission:  

It would be really useful to be able to export whole BKChem scene with multiple molecules, text and other objects to graphics (cairo) from Python script so it looks the same as it would be exported from BKChem.

Right now it even doesn't handle gracefully multiple molecules in one file (crashes when trying to remap atom ids; OASA-0.13.0):
In [73]: mol = oasa.cdml.file_to_mol(g)
KeyError                                  Traceback (most recent call last)

/home/reinis/Hack/XML/PyDOM/<ipython console> in <module>()

/usr/lib64/python2.5/site-packages/oasa/cdml.pyc in file_to_mol(f)
    111 def file_to_mol( f):
--> 112   return text_to_mol( f.read())
    114 def text_to_mol( text):

/usr/lib64/python2.5/site-packages/oasa/cdml.pyc in text_to_mol(text)
    115   gen = read_cdml( text)
    116   try:
--> 117     mol = gen.next()
    118   except StopIteration:
    119     return None

/usr/lib64/python2.5/site-packages/oasa/cdml.pyc in read_cdml(text)
     78         continue
     79       v1 = atom_id_remap[ bond_el.getAttribute( 'start')]
---> 80       v2 = atom_id_remap[ bond_el.getAttribute( 'end')]
     81       e = bond( order=int( type[1]), type=type[0])
     82       mol.add_edge( v1, v2, e=e)

KeyError: u'atom16912'



(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by beda (Posted a comment)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-05-19 beda StatusNone In Progress
        Assigned toNone beda

    Back to the top

    Powered by Savane 3.12