Re: [Rdkit-discuss] how to append conformer number to molecule name in SDF output file?

2017-06-15 Thread Greg Landrum
Sure you can do this by setting the molecule's "_Name" property before each
call to SDWriter.write().
Here's a short example:

In [15]: sio = StringIO()

In [16]: w = Chem.SDWriter(sio)

In [17]: basen = m.GetProp('_Name')

In [18]: for conf in m.GetConformers():
...: cid = conf.GetId()
...: nm = "{}-{}".format(basen,cid)
...: m.SetProp('_Name',nm)
...: w.write(m,confId=cid)
...:

In [19]: w.flush()

In [20]: print(sio.getvalue()[:20])
mol1-0
 RDKit

This just adds a conformation ID to the end of whatever the molecule's name
starts out as.

Hope this helps,
-greg



On Wed, Jun 14, 2017 at 5:00 AM, Francois BERENGER <
beren...@bioreg.kyushu-u.ac.jp> wrote:

> Hello,
>
> I am generating conformers.
>
> When I write them out, I'd like that they are named like this:
>
> molName_001
> molName_002
> ...
>
> So that, down the line, I know with which conformer of which molecule
> I am working with.
>
> So: "parent" molecule name followed by one '_' then the conformer Id
> in a fixed format.
>
> Is it possible to do so with a Chem.SDWriter?
>
> Thanks a lot,
> Francois.
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


[Rdkit-discuss] how to append conformer number to molecule name in SDF output file?

2017-06-13 Thread Francois BERENGER

Hello,

I am generating conformers.

When I write them out, I'd like that they are named like this:

molName_001
molName_002
...

So that, down the line, I know with which conformer of which molecule
I am working with.

So: "parent" molecule name followed by one '_' then the conformer Id
in a fixed format.

Is it possible to do so with a Chem.SDWriter?

Thanks a lot,
Francois.

--
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss