Hi Markus,

On Fri, Oct 16, 2009 at 2:40 PM, markus kossner <[email protected]> wrote:
> Hi there,
> I recently noticed some unexpected behavior of the PropertyMol.
> Note that I have installed the Q1_2009 installation currently.
> Look at that:
>>>> from rdkit import Chem
>>>> mol=Chem.MolFromSmiles('c1ccccc1')
>>>> mol.SetProp('_Name','benzene')
>>>> w=Chem.SDWriter('test.sdf')
>>>> w.write(mol)
>>>> from Chem.PropertyMol import *
>>>> pm=PropertyMol(mol)
>>>> w.write(pm)
>>>> exit()
>
> Everything works fine, but when I look at the produced sd file,
> only the first of the two entries has the string 'benzene' in the header
> line.

Nice catch. The problem is fixed in subversion (and in the release,
which I be completed this weekend). Here's an explanation of the
problem, if you are interested: PropertyMol is a python object and the
extra functionality I added to capture properties such that they could
be pickled was only updating the python object. So when you called a
C++ function (SDWriter.write), it wasn't getting the new properties. I
modified the PropertyMol object so that it places the properties in
the C++ object as well.

A shortcoming to the current fix is that if you pickle a PropertyMol
and *then* write it into an SD file, the properties don't go into the
file. Since the PropertyMol is a bit of a hack, there are going to be
a lot of these edge cases. I'll enter a bug against this one and fix
it sometime in the near future, but it won't be in this release.


> !-!-!-!-!-!-!-!-!-!-!
>        Script: test_list.py.  Failed 1 (of 15) tests in 27.15 seconds
>                (GraphMol): python test_list.py

If you want some more detail about what failed, switch to the
Code/GraphMol directory and run python test_list.py in there. Then
you'll see the failing tests.

> And b.t.w. why does my RDKit work fairly well despite the failed
> GraphMol things? :-)

you aren't using the broken bits. ;-)

-greg

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to