On 2014-07-29 12:17, acanada wrote:
Hello,
I have a postgres table with compound names and other info. I want to save also
.mol or .sdf information associated to this compounds. I'm getting the
structure information from the chebi web service and I assume that I have to
save this info in some way in order to enable the substructural search and
other searching options
I have searched for information in "The RDKit database cartridge" but I cannot find an
explanation for my purposes. I'm searching a "type" for saving structures, and the way to
tell the table some options (tautomers, repeated molecules...etc) when saving the data.
Can anybody tell me where to find information, how-to or tutorial for what I'm
trying to do?
My apologizes if this is a too simple question.
Thank you very much,
Andrés
Hi Andrés,
The type you are looking for is "mol" - an RDKit molecule type column
which can be indexed for substructure searches.
To convert a molfile to the "mol" type, use the cartridge
mol_from_ctab() function.
So e.g. create a table like this:
create table mols (
id serial,
molecule mol
);
and to insert molecules into it:
insert into mols (molecule) values ('CCN');
SMILES text will be automatically converted to "mol" type. Assuming that
you have a variable "molfile" that holds a molfile as text do this:
insert into mols (molecule) values (mol_from_ctab(molfile::cstring));
Note that the molfile string has to be cast to "cstring". You probably
also want to register it like this:
insert into mols (molecule) values (mol_from_ctab(molfile::cstring,
true));
The additional boolean parameter controls whether the coordinates of the
original molfile are retained in the database. The default is "false"
meaning that molfile coordinates are not retained. If you want to be
able to export the structures as-they-were you want to set the parameter
to "true".
To get back the molfiles, use the mol_to_ctab() function:
select id, mol_to_ctab(molecule) from mols;
Hope this gets you started.
Cheers
-- Jan
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss