[Rdkit-discuss] SD Tag Reording

2014-02-27 Thread Matthew Lardy
Hi all,

I've noticed that I am unable to reorder SD tags in RDKit.  It appears that
no matter what I try, they get reordered in alphabetical order.  Is anyone
else experiencing this behaviour?

Thanks!
Matt
--
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=126839071iu=/4140/ostg.clktrk___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] Announce: RDKit in Oracle - via pypl cartridge.

2014-02-27 Thread Jan Holst Jensen

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)c1c1  1.3848
2   CCC(=O)OCCOc1c1 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=126839071iu=/4140/ostg.clktrk___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] SD Tag Reording

2014-02-27 Thread Greg Landrum
Dear Matt,

On Thu, Feb 27, 2014 at 8:09 PM, Matthew Lardy mla...@gmail.com wrote:


 I've noticed that I am unable to reorder SD tags in RDKit.  It appears
 that no matter what I try, they get reordered in alphabetical order.  Is
 anyone else experiencing this behaviour?


Here's the default behavior, which is what you describe:

In [1]: from rdkit import Chem
In [2]: from StringIO import StringIO
In [3]: m1 = Chem.MolFromSmiles('C')
In [4]: m1.SetProp('CProp','c')
In [5]: m1.SetProp('BProp','b')
In [6]: m1.SetProp('AProp','a')
In [7]: sio=StringIO()
In [8]: w = Chem.SDWriter(sio)
In [9]: w.write(m1)
In [10]: w.flush()
In [11]: print sio.getvalue()

 RDKit

  1  0  0  0  0  0  0  0  0  0999 V2000
0.0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
M  END
  AProp  (1)
a

  BProp  (1)
b

  CProp  (1)
c




You can, however provide a list of property names to be written out. If you
do this, your order will be obeyed:

In [17]: sio=StringIO()
In [18]: w = Chem.SDWriter(sio)
In [19]: w.SetProps(('BProp','CProp','AProp'))
In [20]: w.write(m1)
In [21]: w.flush()
In [22]: print sio.getvalue()

 RDKit

  1  0  0  0  0  0  0  0  0  0999 V2000
0.0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
M  END
  BProp  (1)
b

  CProp  (1)
c

  AProp  (1)
a




I hope this helps,
-greg
--
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=126839071iu=/4140/ostg.clktrk___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss