[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


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