Re: [Rdkit-discuss] molfileAlias

2016-03-19 Thread Jean-Marc Nuzillard

Hi again,

thank you for this efficient answer.

Just one question.
How would have it been possible for me to arrive at this answer
without your help?

Cheers,

Jean-Marc


Le 16/03/2016 17:25, Greg Landrum a écrit :

Hi Jean-Marc,

You use the molFileAlias property like this:


#---
In [9]: m = Chem.MolFromSmiles('CCO')

In [10]: m.GetAtomWithIdx(0).SetProp('molFileAlias','alias 0')

In [11]: m.GetAtomWithIdx(2).SetProp('molFileAlias','the_oxygen')

In [12]: print(Chem.MolToMolBlock(m))

 RDKit

  3  2  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
0.0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
0.0.0. O   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  1  0
  2  3  1  0
A1
alias 0
A3
the_oxygen
M  END
#---

I hope this helps,
-greg


On Wed, Mar 16, 2016 at 8:23 AM, Jean-Marc Nuzillard 
> wrote:


Dear All,

Is there a way, in Python,  to add an alias to an atom in a
molecule so
that is appears
in an "A" line when the molecule is written in an SD file ?
Searching the web, I found an atom attribute named molfileAlias
but how do I practically set/get it?

thanks,

Jean-Marc

--
Jean-Marc Nuzillard
Institut de Chimie Moléculaire de Reims
CNRS UMR 7312
Moulin de la Housse
CPCBAI, Bâtiment 18
BP 1039
51687 REIMS Cedex 2
France

Tel : 03 26 91 82 10
Fax : 03 26 91 31 66
http://www.univ-reims.fr/ICMR

http://www.univ-reims.fr/LSD/
http://www.univ-reims.fr/LSD/JmnSoft/



--
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231=/4140
___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/rdkit-discuss





--
Jean-Marc Nuzillard
Institut de Chimie Moléculaire de Reims
CNRS UMR 7312
Moulin de la Housse
CPCBAI, Bâtiment 18
BP 1039
51687 REIMS Cedex 2
France

Tel : 03 26 91 82 10
Fax : 03 26 91 31 66
http://www.univ-reims.fr/ICMR

http://www.univ-reims.fr/LSD/
http://www.univ-reims.fr/LSD/JmnSoft/

--
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231=/4140___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] molfileAlias

2016-03-19 Thread Greg Landrum
Hi Jean-Marc,

You use the molFileAlias property like this:


#---
In [9]: m = Chem.MolFromSmiles('CCO')

In [10]: m.GetAtomWithIdx(0).SetProp('molFileAlias','alias 0')

In [11]: m.GetAtomWithIdx(2).SetProp('molFileAlias','the_oxygen')

In [12]: print(Chem.MolToMolBlock(m))

 RDKit

  3  2  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
0.0.0. C   0  0  0  0  0  0  0  0  0  0  0  0
0.0.0. O   0  0  0  0  0  0  0  0  0  0  0  0
  1  2  1  0
  2  3  1  0
A1
alias 0
A3
the_oxygen
M  END
#---

I hope this helps,
-greg


On Wed, Mar 16, 2016 at 8:23 AM, Jean-Marc Nuzillard <
jm.nuzill...@univ-reims.fr> wrote:

> Dear All,
>
> Is there a way, in Python,  to add an alias to an atom in a molecule so
> that is appears
> in an "A" line when the molecule is written in an SD file ?
> Searching the web, I found an atom attribute named molfileAlias
> but how do I practically set/get it?
>
> thanks,
>
> Jean-Marc
>
> --
> Jean-Marc Nuzillard
> Institut de Chimie Moléculaire de Reims
> CNRS UMR 7312
> Moulin de la Housse
> CPCBAI, Bâtiment 18
> BP 1039
> 51687 REIMS Cedex 2
> France
>
> Tel : 03 26 91 82 10
> Fax : 03 26 91 31 66
> http://www.univ-reims.fr/ICMR
>
> http://www.univ-reims.fr/LSD/
> http://www.univ-reims.fr/LSD/JmnSoft/
>
>
>
> --
> Transform Data into Opportunity.
> Accelerate data analysis in your applications with
> Intel Data Analytics Acceleration Library.
> Click to learn more.
> http://pubads.g.doubleclick.net/gampad/clk?id=278785231=/4140
> ___
> Rdkit-discuss mailing list
> Rdkit-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
>
--
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231=/4140___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss


Re: [Rdkit-discuss] molfileAlias

2016-03-19 Thread Jean-Marc Nuzillard

Too simple.

Thanks,

Jean-Marc

Le 16/03/2016 19:34, Greg Landrum a écrit :


On Wed, Mar 16, 2016 at 10:58 AM, Jean-Marc Nuzillard 
> wrote:



thank you for this efficient answer.

Just one question.
How would have it been possible for me to arrive at this answer
without your help?


It's a good question. Often the answer to questions like this are 
"only if you read the code", but this is one of those rare instances 
where some documentation actually exists.


This document:
http://www.rdkit.org/docs/RDKit_Book.html
lists the common property tags that the RDKit uses and includes:
molfileAlias 	the mol file alias for an atom (follows A tags), read 
from/written to CTABs


Atom.SetProp() is then the normal way to set properties on atoms.

-greg




--
Jean-Marc Nuzillard
Institut de Chimie Moléculaire de Reims
CNRS UMR 7312
Moulin de la Housse
CPCBAI, Bâtiment 18
BP 1039
51687 REIMS Cedex 2
France

Tel : 03 26 91 82 10
Fax : 03 26 91 31 66
http://www.univ-reims.fr/ICMR

http://www.univ-reims.fr/LSD/
http://www.univ-reims.fr/LSD/JmnSoft/

--
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231=/4140___
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss