Jan Halborg Jensen
2017-05-27 13:11:21 UTC
The code below protonates select nitrogen atoms using ReplaceSubstructs but in some cases the chirality is changed, despite the fact that I used MolToSmiles(xx,isomericSmiles=True)
Any help appreciated
Output
C[C@]1(c2cc(NC(=O)c3ccc(C#N)cn3)ccc2F)N=C(N)OCC1(F)F [NX2;H0] [NH+] C[C@@]1(c2cc(NC(=O)c3ccc(C#N)cn3)ccc2F)[NH+]=C(N)OCC1(F)F
C[C@]1(c2cc(NC(=O)c3ccc(C#N)cn3)ccc2F)N=C(N)OCC1(F)F [nX2;H0] [NH+] C[C@]1(c2cc(NC(=O)c3ccc(C#N)c[nH+]3)ccc2F)N=C(N)OCC1(F)F
code:
from rdkit import Chem
from rdkit.Chem import AllChem
smartsref = ( ('[NX2;H1]','[NH2+]'),
('[NX2;H0]','[NH+]'),
('[nX2;H0]','[NH+]'))
smiles = "C[C@]1(c2cc(NC(=O)c3ccc(C#N)cn3)ccc2F)N=C(N)OCC1(F)F"
m = Chem.MolFromSmiles(smiles)
for (smarts1, smiles2) in smartsref:
patt1 = Chem.MolFromSmarts(smarts1)
patt2 = Chem.MolFromSmiles(smiles2)
if(m.HasSubstructMatch(patt1)):
newmol = AllChem.ReplaceSubstructs(m, patt1, patt2)
for ion in newmol:
ion = Chem.MolToSmiles(ion,isomericSmiles=True)
print smiles,smarts1,smiles2,ion
Any help appreciated
Output
C[C@]1(c2cc(NC(=O)c3ccc(C#N)cn3)ccc2F)N=C(N)OCC1(F)F [NX2;H0] [NH+] C[C@@]1(c2cc(NC(=O)c3ccc(C#N)cn3)ccc2F)[NH+]=C(N)OCC1(F)F
C[C@]1(c2cc(NC(=O)c3ccc(C#N)cn3)ccc2F)N=C(N)OCC1(F)F [nX2;H0] [NH+] C[C@]1(c2cc(NC(=O)c3ccc(C#N)c[nH+]3)ccc2F)N=C(N)OCC1(F)F
code:
from rdkit import Chem
from rdkit.Chem import AllChem
smartsref = ( ('[NX2;H1]','[NH2+]'),
('[NX2;H0]','[NH+]'),
('[nX2;H0]','[NH+]'))
smiles = "C[C@]1(c2cc(NC(=O)c3ccc(C#N)cn3)ccc2F)N=C(N)OCC1(F)F"
m = Chem.MolFromSmiles(smiles)
for (smarts1, smiles2) in smartsref:
patt1 = Chem.MolFromSmarts(smarts1)
patt2 = Chem.MolFromSmiles(smiles2)
if(m.HasSubstructMatch(patt1)):
newmol = AllChem.ReplaceSubstructs(m, patt1, patt2)
for ion in newmol:
ion = Chem.MolToSmiles(ion,isomericSmiles=True)
print smiles,smarts1,smiles2,ion