Re: [Rdkit-discuss] setting valence of choice to S and P atoms in rdkit

2017-06-21 Thread Janusz Petkowski
Hi Ling (and Paolo earlier),

Thank you very much for your answers, both work very well.

All the best and happy coding!


Dr Janusz Petkowski

Research Fellow at MIT EAPS<https://eapsweb.mit.edu/people/jjpetkow>

Tel:  +1 (617) 258 - 6910<tel:%28857%29%20777-6977>


From: Ling Chan [lingtrek...@gmail.com]
Sent: Tuesday, June 20, 2017 9:51 PM
To: Janusz Petkowski
Cc: rdkit-discuss@lists.sourceforge.net
Subject: Re: [Rdkit-discuss] setting valence of choice to S and P atoms in rdkit

Hello Janusz,

Perhaps you have answered your own question? You can start with Smiles like 
"[H][SH3](C)[SH5]".

Otherwise you could use the SetNumExplicitHs() function. For example,

  m = Chem.MolFromSmiles('CS')
  m.GetAtomWithIdx(1).SetNumExplicitHs(5)
  AllChem.SanitizeMol(m)
  print Chem.AddHs(m).GetNumAtoms()

will inform you that there is a total of 10 atoms. But if you comment out the 
line with SetNumExplicitHs, it will inform you that the total number of atoms 
is 6.

The above seems to work without the SanitizeMol() function but I think it is 
better to call it for safety, to clean up the molecule.

Ling Chan




On Tue, Jun 20, 2017 at 7:37 AM, Janusz Petkowski 
<jjpet...@mit.edu<mailto:jjpet...@mit.edu>> wrote:
Dear RDKit Community,

I have a quick question regarding a possibility of setting valence of an atom 
in rdkit.

Let's say that I have a molecule like this (smiles notation): PPC or SSC and I 
would like to change the valence of one or more S or P atoms from default II 
for S or III for P to let's say SIV or SVI and PV. As a result I would like to 
have the following molecules (as an example): [H][SH3](C)[SH5], [H][SH2]SC, 
[H][SH3](C)[SH3] or [H][PH3]PC, [H][PH3][PH3]C

Is it possible to output such molecules using SSC or PPC molecules as inputs, 
using one of rdkit methods (modules)?

Thank you very much for your help,

Best regards,

Dr Janusz Petkowski

Research Fellow at MIT EAPS<https://eapsweb.mit.edu/people/jjpetkow>

Tel:  +1 (617) 258 - 6910<tel:%28857%29%20777-6977>

--
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<mailto: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


Re: [Rdkit-discuss] setting valence of choice to S and P atoms in rdkit

2017-06-21 Thread Paolo Tosco
(CC'ing the list as I hadn't in my original reply)

Dear Janusz,

this is what I would do:

>>> from rdkit import Chem
>>> mol = Chem.MolFromSmiles('SSC')
>>> print Chem.MolToSmiles(mol)
CSS
>>> print Chem.MolToSmiles(mol, allHsExplicit=True)
[CH3][S][SH]
>>> a = mol.GetAtomWithIdx(1)
>>> print (a.GetTotalValence())
2
>>> desiredValence = 4
>>> a.SetNumExplicitHs(desiredValence - a.GetTotalValence())
>>> a.UpdatePropertyCache()
>>> print (a.GetTotalValence())
4
>>> print Chem.MolToSmiles(mol, allHsExplicit=True)
[CH3][SH2][SH]

Cheers,
p.

> On 06/20/17 15:37, Janusz Petkowski wrote:
> Dear RDKit Community,
> 
> I have a quick question regarding a possibility of setting valence of an atom 
> in rdkit. 
> 
> Let's say that I have a molecule like this (smiles notation): PPC or SSC and 
> I would like to change the valence of one or more S or P atoms from default 
> II for S or III for P to let's say SIV or SVI and PV. As a result I would 
> like to have the following molecules (as an example): [H][SH3](C)[SH5], 
> [H][SH2]SC, [H][SH3](C)[SH3] or [H][PH3]PC, [H][PH3][PH3]C
> 
> Is it possible to output such molecules using SSC or PPC molecules as inputs, 
> using one of rdkit methods (modules)?
> 
> Thank you very much for your help,
> 
> Best regards,
> 
> Dr Janusz Petkowski
> Research Fellow at MIT EAPS
> Tel:  +1 (617) 258 - 6910
> 
> 
> --
> 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


Re: [Rdkit-discuss] setting valence of choice to S and P atoms in rdkit

2017-06-20 Thread Ling Chan
Hello Janusz,

Perhaps you have answered your own question? You can start with Smiles like
"[H][SH3](C)[SH5]".

Otherwise you could use the SetNumExplicitHs() function. For example,

  m = Chem.MolFromSmiles('CS')
  m.GetAtomWithIdx(1).SetNumExplicitHs(5)
  AllChem.SanitizeMol(m)
  print Chem.AddHs(m).GetNumAtoms()

will inform you that there is a total of 10 atoms. But if you comment out
the line with SetNumExplicitHs, it will inform you that the total number of
atoms is 6.

The above seems to work without the SanitizeMol() function but I think it
is better to call it for safety, to clean up the molecule.

Ling Chan




On Tue, Jun 20, 2017 at 7:37 AM, Janusz Petkowski  wrote:

> Dear RDKit Community,
>
> I have a quick question regarding a possibility of setting valence of an
> atom in rdkit.
>
> Let's say that I have a molecule like this (smiles notation): PPC or SSC
> and I would like to change the valence of one or more S or P atoms from
> default II for S or III for P to let's say SIV or SVI and PV. As a result I
> would like to have the following molecules (as an example):
> [H][SH3](C)[SH5], [H][SH2]SC, [H][SH3](C)[SH3] or [H][PH3]PC, [H][PH3][PH3]C
>
> Is it possible to output such molecules using SSC or PPC molecules as
> inputs, using one of rdkit methods (modules)?
>
> Thank you very much for your help,
>
> Best regards,
>
> Dr Janusz Petkowski
>
> Research Fellow at MIT EAPS 
>
> Tel:  +1 (617) 258 - 6910 <%28857%29%20777-6977>
>
> 
> --
> 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