#!/usr/local2/bin/python2.3 import os, string from openeye.oechem import * rxn = 3 ifs = oemolistream() ifs.open('a_kegg_filter_1.sdf') ofs_1 = oemolostream() ofs_1.open('b_react_ti_3_ln.ism') ofs_2 = oemolostream() ofs_2.open('b_react_ti_3_ln.sdf') mol_wat = OEGraphMol() mol_hyd = OEGraphMol() OEParseSmiles(mol_hyd, "[OH-]") # Reaction 3: OH-H nucleophilic attack at N-C=X (X(not CvO) endocyclic or chain member) (amidine, guanidine) NON_AROMATIC # leaving amine not protonated libgen1 = OELibraryGen("[H,A:4][C:1]([N:2])=[!C&!O:3].[O-:100][H:99]>>[H,A:4][C:1]([N:2])([O-:100])[*:3][H:99]") 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: 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() 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() rxn_n+=1 for products in libgen1.GetProducts(): if products.NumAtoms() < 76: 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_1, products) OEWriteMolecule(ofs_2, products) ofs_1.close() ofs_2.close() ifs.close()