hello,
I am "translating" smiles strings output in a csv file from another program
into RDKit canonical strings with this code.
If there is something that I am doing incorrectly I would appreciate the input.
thanks
brian bennion
The original smiles string
"OC[C@@H]1O[C@H](Cn2c(N3CCCC3)nnc2[C@@H]2OCCC2)CC1"
after conversion with rdkit
"OC[C@H]1CC[C@@H](Cn2c([C@H]3CCCO3)nnc2N2CCCC2)O1"
my code is below.
protn_pat = re.compile(r'\[([IBnN])\+(@*)(H[1234]*)*\]')
line = inFile.readline()
while len(line) != 0:
fields = line.replace('","',' ').split()
mol_name = fields[2]
molMOE = fields[3].replace('"','')
mol1check = protn_pat.search(molMOE)
if mol1check is not None:
print("Found crazy MOE string",mol1check,molMOE)
mol1 = protn_pat.sub(r'[\1\3\2+]',molMOE)
else:
mol1 = molMOE
try:
mol = Chem.MolFromSmiles(mol1)
except:
mol = None
if mol is None:
print('mol failed:'+molMOE+' '+mol1+' '+str(count)+'\n')
else:
rdkitsmichiout.write('\"'+Chem.MolToSmiles(mol,
isomericSmiles=True)+'\",')
rdkitsmichiout.write('\"'+Chem.inchi.MolToInchi(mol,options='/FixedH')+'\",')
rdkitsmichiout.write('\"'+(Chem.inchi.InchiToInchiKey(Chem.inchi.MolToInchi(mol,options='/FixedH')))+'\"\n')
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss