#!/usr/local2/bin/python2.3 import os, string from openeye.oechem import * rxn = 7 ifs = oemolistream() ifs.open('ORG_BRENDA_MOL_FILES_PREP/a4_brenda_031306.ism') ofs_1 = oemolostream() ofs_1.open('bb'+str(rxn)+'.1_ln.ism') mol_hyd = OEGraphMol() OEParseSmiles(mol_hyd, "[OH]") # Reaction 7: OH-H nucleophilic attack at x-c=n (x is not C) endocyclic or chain member) (Imine) (rxn6 - AROMATIC - wrong annot. in Kegg) # nothing protonated - will create doubles with rxn 4 # # NH # || # c #aromatisch in KEGG-sdf # / \ # libgen1 = OELibraryGen("[a:4][c:1](=[N:2])[a&!#6:3].[O:100][H:99]>>[*:4][C:1]([N:2][H:99])([O-:100])[A:3]") libgen1.SetExplicitHydrogens(True) libgen1.SetValenceCorrection(False) for mol in ifs.GetOEMols(): libgen1.AddStartingMaterial(mol, 0) libgen1.AddStartingMaterial(mol_hyd, 1) mol.Clear() mol_hyd.Clear() title_list = [] rxn_n = 1 while rxn_n < rxn: try: old_title_file = open('bb'+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: print 'bb'+str(rxn_n)+'_ln.ism not existent\n' try: old_title_file = open('bb'+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: print 'bb'+str(rxn_n)+'_lp.ism not existent\n' rxn_n+=1 for products in libgen1.GetProducts(): num = 1 prot = 0 title = products.GetTitle()+str(num)+'p'+str(prot) while title in title_list: num+=1 title = products.GetTitle()+str(num)+'p'+str(prot) title_list.append(title) products.SetTitle(title) OEWriteMolecule(ofs_1, products) ofs_1.close() ifs.close()