bkchem-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bkchem-user] OASA cannot depict multifragment molecules


From: Beda Kosata
Subject: Re: [Bkchem-user] OASA cannot depict multifragment molecules
Date: Wed, 11 Mar 2009 09:58:00 +0100
User-agent: Thunderbird 2.0.0.19 (X11/20081209)

Hello Istvan,

this is indeed a limitation of OASA, however not fatal. cairo_out simply
counts on all molecules being connected. You can fix your code by replacing:

cairo_out.mol_to_cairo( mol,...

with

cairo_out.mols_to_cairo( mol.get_disconnected_subgraphs(),...

This should take care of this problem in oasa-0.13.0

I will do something like this in the background in the next release, so
it will be no longer necessary to use this workaround.
Thanks for pointing this problem out.

Best regards

        Beda


Vágó István wrote:
> Hello,
> I have problem depicting mulifragment mol files with OASA cairo_out. It
> breaks with AssertionError.
> Is it a limitation of OASA, or I do something wrong? Here is the
> traceback I got:
> 
> Traceback (most recent call last):
>   File "tetttt.py", line 22, in ?
>     cairo_out.mol_to_cairo( mol, "mol.png",
> format="png",show_hydrogens_on_hetero=True,line_width=1,font_size=8,bond_width=3)
> 
>   File "/home/zope/lib/python2.4/site-packages/oasa/cairo_out.py", line
> 785, in mol_to_cairo
>     c.mol_to_cairo( mol, filename, format=format)
>   File "/home/zope/lib/python2.4/site-packages/oasa/cairo_out.py", line
> 257, in mol_to_cairo
>     return self.mols_to_cairo( [mol], filename, format=format)
>   File "/home/zope/lib/python2.4/site-packages/oasa/cairo_out.py", line
> 222, in mols_to_cairo
>     [self.draw_mol( mol) for mol in mols]
>   File "/home/zope/lib/python2.4/site-packages/oasa/cairo_out.py", line
> 162, in draw_mol
>     self._draw_edge( e)
>   File "/home/zope/lib/python2.4/site-packages/oasa/cairo_out.py", line
> 387, in _draw_edge
>     for ring in self.molecule.get_smallest_independent_cycles():
>   File "/home/zope/lib/python2.4/site-packages/oasa/graph/graph.py",
> line 373, in get_smallest_independent_cycles
>     return map( self.edge_subgraph_to_vertex_subgraph,
> self.get_smallest_independent_cycles_e())
>   File "/home/zope/lib/python2.4/site-packages/oasa/graph/graph.py",
> line 472, in get_smallest_independent_cycles_e
>     assert self.is_connected()
> AssertionError
> 
> And one molfile:
> 
>   -ISIS-  03090914072D
> 
>  19 18  0  0  0  0  0  0  0  0999 V2000
>     4.5792    0.4375    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>     4.5792   -0.3875    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>     5.2912   -0.7958    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>     6.0032   -0.3875    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>     6.0032    0.4375    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>     5.2912    0.8542    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>     5.2912   -1.6208    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>     6.0057   -2.0333    0.0000 C   0  0  3  0  0  0  0  0  0  0  0  0
>     6.0057   -2.8583    0.0000 N   0  0  0  0  0  0  0  0  0  0  0  0
>     6.7201   -1.6208    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>     7.4346   -2.0333    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
>     2.2417   -0.2833    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>     2.9561    0.1292    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
>     1.5272    0.1292    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
>     2.2417   -1.1083    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>     1.5272   -1.5208    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>     1.5272   -2.3458    0.0000 C   0  0  0  0  0  0  0  0  0  0  0  0
>     0.8127   -2.7583    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
>     2.2417   -2.7583    0.0000 O   0  0  0  0  0  0  0  0  0  0  0  0
>   8  9  1  0  0  0  0
>   1  6  1  0  0  0  0
>   8 10  1  0  0  0  0
>   2  3  2  0  0  0  0
>  10 11  1  0  0  0  0
>   3  4  1  0  0  0  0
>   4  5  1  0  0  0  0
>  12 13  2  0  0  0  0
>   5  6  1  0  0  0  0
>  12 14  1  0  0  0  0
>  12 15  1  0  0  0  0
>   3  7  1  0  0  0  0
>  15 16  2  0  0  0  0
>  16 17  1  0  0  0  0
>   7  8  1  0  0  0  0
>  17 18  2  0  0  0  0
>   1  2  1  0  0  0  0
>  17 19  1  0  0  0  0
> M  END
> 
> UI: Stripping salts with openbabel solves the issue, but it would be
> more elegant to do it without stripping.
> 
> Istvan
> 


-- 
Bedrich Kosata
Laboratory of Informatics and Chemistry
ICT Prague
Czech Republic

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]