Hi RDKitters,
I have dabbled with calling RDKit from Oracle and have succeeded. It is
done via an Oracle cartridge that makes it possible to call Python
scripts from Oracle. The cartridge is not nearly as sophisticated as
Postgres' support for Python, but it gets the job done.
The cartridge is open source, BSD-licensed, and can be downloaded from here:
http://biochemfusion.com/downloads/pypl_2014-02-27.zip - Yes, it's only
an 8.3 KB download.
The cartridge was created on a Linux machine with CentOS 6.2 and Oracle
11g. It shouldn't be too hard to make it compile on Windows too, but I
haven't had the need yet.
With the cartridge we can create Oracle functions like below that
operate on MDL molfiles, returning SMILES and LogP values:
create function mol_to_smiles(molfile in clob) return varchar2
is
begin
return pypl.run_script(
'from rdkit import Chem' || Chr(10) ||
'from rdkit.Chem import Descriptors' || Chr(10) ||
'molfile = """' || molfile || '"""' || Chr(10) ||
'result = Chem.MolToSmiles(Chem.MolFromMolBlock(molfile))', 'result');
end;
/
create function mol_logp(molfile in clob) return number
is
begin
return to_number(pypl.run_script(
'from rdkit import Chem' || Chr(10) ||
'from rdkit.Chem import Descriptors' || Chr(10) ||
'molfile = """' || molfile || '"""' || Chr(10) ||
'result = str(Descriptors.MolLogP(Chem.MolFromMolBlock(molfile)))',
'result'));
end;
/
If we have a COMPOUNDS table where the STRUCTURE column has the molecule
stored in Accelrys Direct format, we can then do the following select:
select
id,
mol_to_smiles(molfile(structure)) as smiles,
mol_logp(molfile(structure)) as logp
from compounds
where id <= 3;
*ID* *SMILES* *LOGP*
1 O=C(O)c1ccccc1 1.3848
2 CCC(=O)OCCOc1ccccc1 2.0186
3 CC1=CC(=O)C=CC1=O 0.6407
[The molfile() function is an Accelrys Direct function that produces a
molfile CLOB from the STUCTURE BLOB column.]
There you have it - RDKit functionality directly in an Oracle database.
Hope that you will find this useful.
Cheers
-- Jan
------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss