Re: [Rdkit-discuss] aromatic ring that contain sulfur atom
Open-Source Cheminformatics and Machine Learning
Brought to you by:
glandrum
|
From: Taka S. <ser...@gm...> - 2015-03-01 13:21:24
|
Dear Greg. Thank you for your quick and kindful reply. I'm interested in morph approach. http://www.ncbi.nlm.nih.gov/pubmed/20481489 I want to test this approach in rdkit. Based on your adivice, I wrote sample script get atoms in aromatic rings that degree < 3. And the script works. Thank you! Takayuki. -----code snippet--- from rdkit import Chem import copy def replace_atom( mol ): res = [] # get atoms , degree <3 aro_idxs = [ atom.GetIdx() for atom in mol.GetAromaticAtoms() if atom.GetDegree() < 3 ] # replace aromatic atoms to carbon, nitrogen, oxygen, sulfur for atm_num in [6, 7, 8, 16]: for idx in aro_idxs: cp_mol = copy.deepcopy( mol ) cp_mol.GetAtomWithIdx(idx).SetAtomicNum( atm_num ) try: Chem.SanitizeMol(cp_mol) res.append( cp_mol ) except: pass return res def recursive_replace(mols, res = [], check = set([])): for mol in mols: replaced_mols = replace_atom( mol ) res.extend(replaced_mols) for mol in res: check.add( Chem.MolToSmiles( mol ) ) if len(res) <= len(check): recursive_replace( res, res=res, check=check ) else: return [ Chem.MolFromSmiles(mol) for mol in check ] On Sun, Mar 1, 2015 at 3:16 PM Greg Landrum <gre...@gm...> wrote: > Hi Takayuki, > > When doing this, you have to be careful how you change the valence of the > atom. The sanitization step is going to attempt to Kekulize the aromatic > ring (i.e. convert all the aromatic bonds to either single or double) and > this isn't possible for all atom patterns. > > When you change atom 2 to a nitrogen, you end up creating a three > coordinate aromatic nitrogen. During kekulization, both aromatic bonds to > this atom must be converted to single bonds; this leads to a pattern that > does not allow the rest of the ring to be kekulized. > > There's a similar problem when you replace a two-coordinate carbon with a > sulfur. > > Replacing the three-coordinate carbon with a sulfur, on the other hand, is > different: the RDKit allows the three coordinate sulfur to have an > additional double bond added. The result ring is ok, but it's not aromatic: > > In [13]: mol = Chem.MolFromSmiles('COc1ccccc1') > In [14]: mol.GetAtomWithIdx(2).SetAtomicNum( 16 ) > In [15]: Chem.SanitizeMol(mol) > Out[15]: rdkit.Chem.rdmolops.SanitizeFlags.SANITIZE_NONE > In [16]: print Chem.MolToSmiles(mol,True) > COS1=CC=CC=C1 > > Does that make sense? > > -greg > > > On Sat, Feb 28, 2015 at 3:11 PM, Taka Seri <ser...@gm...> wrote: > >> Dear rdkitter. >> I have a question about aromatic rings. >> So, I want to change atoms in aromatic ring. >> For example code is following. >> Convert aromatic carbon to nitrogen. >> mol = Chem.MolFromSmiles('COc1ccccc1') >> mol.GetAtomWithIdx(3).SetAtomicNum( 7 ) >> Chem.SanitizeMol(mol) >> Work Fine. >> >> mol.GetAtomWithIdx(2).SetAtomicNum( 7 ) >> Chem.SanitizeMol(mol) >> ValueError. >> >> mol = Chem.MolFromSmiles('COc1ccccc1') >> mol.GetAtomWithIdx(2).SetAtomicNum( 7 ) >> Chem.SanitizeMol(mol) >> ValueError. >> >> Next, I tried to convert aromatic carbon to sulfur. >> mol = Chem.MolFromSmiles('COc1ccccc1') >> mol.GetAtomWithIdx(3).SetAtomicNum( 16 ) >> Chem.SanitizeMol(mol) >> ValueError. OK >> >> mol = Chem.MolFromSmiles('COc1ccccc1') >> mol.GetAtomWithIdx(2).SetAtomicNum( 16 ) >> Chem.SanitizeMol(mol) >> This case, work fine. ??? >> Why this case work ? >> Any advice or information you could provide would be greatly appreciated. >> Thanks. >> Takayuki >> >> ------------------------------------------------------------ >> ------------------ >> Dive into the World of Parallel Programming The Go Parallel Website, >> sponsored >> by Intel and developed in partnership with Slashdot Media, is your hub >> for all >> things parallel software development, from weekly thought leadership >> blogs to >> news, videos, case studies, tutorials and more. Take a look and join the >> conversation now. http://goparallel.sourceforge.net/ >> _______________________________________________ >> Rdkit-discuss mailing list >> Rdk...@li... >> https://lists.sourceforge.net/lists/listinfo/rdkit-discuss >> >> > |