you can try use razi:
http://razi.readthedocs.org/en/latest/database_creation_tutorial.html
pozdrawiam
Adrian
2014-02-26 18:34 GMT+01:00 Greg Landrum <greg.land...@gmail.com>:
> Hi Hari,
>
> You can use "mol_from_pkl()". Here's a quick demo:
> In [20]: m = Chem.MolFromSmiles('c1cnccc1')
>
> In [21]: pkl = buffer(m.ToBinary())
>
> In [22]: curs.execute('select mol_from_pkl(%s)',(pkl,))
>
> In [23]: curs.fetchone()
> Out[23]: ('c1ccncc1',)
>
> Is that enough to get you started?
> -greg
>
>
>
> On Tue, Feb 25, 2014 at 8:28 PM, hari jayaram <hari...@gmail.com> wrote:
>
>> Hi ,
>> I am a newbie to postgres and the rdkit postgres database cartridge.
>>
>> I have gotten the cartridge installed and can query sub-structure
>> similarity and do other things as documented in the cartridge documentation
>> page.
>>
>> To create a molecule from the cartridge the documentation
>> <http://www.rdkit.org/docs/Cartridge.html>recommends something like:
>>
>>
>> >>> curs.execute('select molregno,mol_send(m) from rdk.mols where m@
>> >%s',('c1cccc2c1nncc2',))
>> >>> row = curs.fetchone()
>> >>> row
>> (9830, <read-only buffer for 0x...>)
>>
>> Then the pickled output of mol_send will be used to create a new molecule
>>
>> >>> from rdkit import Chem
>> >>> m = Chem.Mol(str(row[1]))
>> >>> Chem.MolToSmiles(m,True)
>> 'CC(C)Sc1ccc(CC2CCN(C3CCN(C(=O)c4cnnc5ccccc54)CC3)CC2)cc1'
>>
>>
>> My question is : how about the other way .Is the only way to use the
>> smiles and do an sql insert with the smiles and the mol_from_smiles
>> function as in :
>>
>> insert into compounds (smiles,rdkit_mol,internal,external) VALUES
>> ('CCCCC',mol_from_smiles('CCCCC);'ID-1111111','EI-2222222');
>>
>> Is there a way to insert the python rdkit mol object into the database
>> rdkit "mol" column directly.
>>
>> This is in some ways connected to a question I just asked ( django
>> related) on stack
>> overflow.<http://stackoverflow.com/questions/22022163/how-to-handle-map-custom-postgresql-type-to-django-model>
>>
>> Thanks a tonne for your help in advance
>> Hari
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Flow-based real-time traffic analytics software. Cisco certified tool.
>> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
>> Customize your own dashboards, set traffic alerts and generate reports.
>> Network behavioral analysis & security monitoring. All-in-one tool.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
>> _______________________________________________
>> Rdkit-discuss mailing list
>> Rdkit-discuss@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>>
>>
>
>
> ------------------------------------------------------------------------------
> Flow-based real-time traffic analytics software. Cisco certified tool.
> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
> Customize your own dashboards, set traffic alerts and generate reports.
> Network behavioral analysis & security monitoring. All-in-one tool.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
> _______________________________________________
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
>
------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss