#!/usr/local2/bin/python2.3 import os, string from openeye.oechem import * rxn = 5 ifs = oemolistream() ifs.open('a_kegg_filter_1.sdf') ofs_3 = oemolostream() ofs_3.open('b_react_ti_'+str(rxn)+'_not_filtered_ln.sdf') ofs_3.SetFormat(OEFormat_SDF) mol_wat = OEGraphMol() OEParseSmiles(mol_wat, "[OH]") # Reaction 5 (s. 3): OH-H nucleophilic attack at N-C=X (X(not CvO) endocyclic or chain member) (amidine, guanidine) (AROMATIC) # leaving group (amine) neutral (haette fuer a:3 auch gleich n:3 schreiben koennen libgen = OELibraryGen("[a:4][c:1]([N:2])[a&!#8&!#6&!#16:3].[O:100][H:99]>>[*:4][C:1]([N:2])([O-:100])[A:3][H:99]") for mol in ifs.GetOEMols(): libgen.AddStartingMaterial(mol, 0) libgen.AddStartingMaterial(mol_wat, 1) mol.Clear() mol_wat.Clear() title_list = [] rxn_n = 1 while rxn_n < rxn: try: old_title_file = open('b_react_ti_'+str(rxn_n)+'_ln.ism','r') for title in old_title_file.readlines(): title_list.append(string.split(title)[1]) old_title_file.close() except IOError: pass try: old_title_file = open('b_react_ti_'+str(rxn_n)+'_lp.ism','r') for title in old_title_file.readlines(): title_list.append(string.split(title)[1]) old_title_file.close() except IOError: pass rxn_n+=1 for products in libgen.GetProducts(): num = 1 title = products.GetTitle()+str(num) while title in title_list: num+=1 title = products.GetTitle()+str(num) title_list.append(title) products.SetTitle(title) OEWriteMolecule(ofs_3, products) ofs_3.close() ifs.close()