Re: [Rdkit-discuss] transformation of an atom or group of atoms by atom indices

2017-11-09 Thread James T. Metz via Rdkit-discuss
Jason,


Exactly what I need to do.  Thank you for your example code.  Much 
appreciated.


Regards,
Jim Metz





-Original Message-
From: Jason Biggs 
To: James T. Metz 
Cc: RDKit Discuss 
Sent: Thu, Nov 9, 2017 3:28 pm
Subject: Re: [Rdkit-discuss] transformation of an atom or group of atoms by 
atom indices



Something along these lines?





mol = Chem.MolFromSmiles('')
emol = Chem.EditableMol(mol)
emol.ReplaceAtom(3, Chem.Atom(1))
mol = emol.GetMol()





In [12]:


Chem.MolToSmiles(mol)





Out[12]:

'[H]CCC'




In [13]:


Chem.MolToSmiles(Chem.RemoveHs(mol))





Out[13]:

'CCC'










Jason Biggs




On Thu, Nov 9, 2017 at 3:12 PM, James T. Metz via Rdkit-discuss 
 wrote:

RDKit Discussion Group,


Suppose I have a molecule



smiles1 = ''


The carbon atoms will be assigned indices 0, 1, 2, and 3.



Suppose I want to specifically change carbon 3 to a hydrogen.
Is this possible using RDkit?


I am aware of using SMARTS to match a pattern and then change

that group of atoms.  In my example, I would like to be able to
change an atom or group of atoms based on the atom indices, not
a SMARTS pattern which might be problematic for molecules with
local symmetry.


Regards,

Jim Metz






--
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] transformation of an atom or group of atoms by atom indices

2017-11-09 Thread Jason Biggs
Something along these lines?

mol = Chem.MolFromSmiles('')emol =
Chem.EditableMol(mol)emol.ReplaceAtom(3, Chem.Atom(1))mol =
emol.GetMol()

In [12]:

Chem.MolToSmiles(mol)

Out[12]:

'[H]CCC'

In [13]:

Chem.MolToSmiles(Chem.RemoveHs(mol))

Out[13]:

'CCC'




Jason Biggs


On Thu, Nov 9, 2017 at 3:12 PM, James T. Metz via Rdkit-discuss <
rdkit-discuss@lists.sourceforge.net> wrote:

> RDKit Discussion Group,
>
> Suppose I have a molecule
>
> smiles1 = ''
>
> The carbon atoms will be assigned indices 0, 1, 2, and 3.
>
> Suppose I want to specifically change carbon 3 to a hydrogen.
> Is this possible using RDkit?
>
> I am aware of using SMARTS to match a pattern and then change
> that group of atoms.  In my example, I would like to be able to
> change an atom or group of atoms based on the atom indices, not
> a SMARTS pattern which might be problematic for molecules with
> local symmetry.
>
> Regards,
> Jim Metz
>
>
>
> 
> --
> 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] transformation of an atom or group of atoms by atom indices

2017-11-09 Thread James T. Metz via Rdkit-discuss
RDKit Discussion Group,


Suppose I have a molecule



smiles1 = ''


The carbon atoms will be assigned indices 0, 1, 2, and 3.



Suppose I want to specifically change carbon 3 to a hydrogen.
Is this possible using RDkit?


I am aware of using SMARTS to match a pattern and then change

that group of atoms.  In my example, I would like to be able to
change an atom or group of atoms based on the atom indices, not
a SMARTS pattern which might be problematic for molecules with
local symmetry.


Regards,

Jim Metz





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