Re: [Rdkit-discuss] warnings when exporting pandas tables with molecules to hdf

2019-02-21 Thread Jose Manuel Gally
Hi Greg, thanks for your input, this is quite faster! Cheers, Jose Manuel On 21.02.19 09:48, Greg Landrum wrote: This is a nice solution to the problem. Thanks for sharing it! I think there is, however a minor mistake. This line: df['mol'] = df['mol'].map(lambda x:

Re: [Rdkit-discuss] warnings when exporting pandas tables with molecules to hdf

2019-02-21 Thread Greg Landrum
This is a nice solution to the problem. Thanks for sharing it! I think there is, however a minor mistake. This line: df['mol'] = df['mol'].map(lambda x: base64.b64encode(pickle.dumps(x)).decode()) should be: df['mol'] = df['mol'].map(lambda x: base64.b64encode(x.ToBinary()).decode()) You

Re: [Rdkit-discuss] warnings when exporting pandas tables with molecules to hdf

2019-02-18 Thread Jose Manuel Gally
Dear all, in case this is helpful for others, here is the solution I came up with by combining 2 snippets of code [1, 2]: # init import base64 from rdkit import Chem n_records = 10 file='/tmp/test.hdf' key='test' df = pd.DataFrame({'mol': [Chem.MolFromSmiles('C1C1')] * n_records}) #

Re: [Rdkit-discuss] warnings when exporting pandas tables with molecules to hdf

2019-02-15 Thread Jose Manuel Gally
Dear Peter, thank you for your reply. That might work for me, I'll look into it. As a side note, if I convert the Mol into RWMol, I don't get the warning anymore (but then I cannot read the molecules anymore...) Cheers, Jose Manuel On 15.02.19 17:14, Peter St. John wrote: you might be

Re: [Rdkit-discuss] warnings when exporting pandas tables with molecules to hdf

2019-02-15 Thread Peter St. John
you might be better off not storing the molecule RDkit objects themselves in the hdf file; but rather some other representation of the molecule. If you need 3D atom coordinates, you could call MolToMolBlock() on each of the rdkit mols, and then MolFromMolBlock later to regenerate them. If you

[Rdkit-discuss] warnings when exporting pandas tables with molecules to hdf

2019-02-15 Thread Jose Manuel Gally
Hi all, I am working on some molecules in a pandas DataFrame and have to export them to a hdf file. This works just fine but I get a warning about Performance due to mixed types. (1) Why are RDKIT Mol objects causing this warning in the first place? Am I doing something wrong? Please