#!/usr/local2/bin/python2.3 # Just splits phosphat_THIO_ester in parts and marks the connecting atom to the phosphorus with a copper (will be removed later) from openeye.oechem import * import os, string, sys ifs = oemolistream() ifs.open('ORG_BRENDA_MOL_FILES_PREP/a4_brenda_031306.ism') ofs = oemolostream() ofs.open('bb9.1_thio_pes_parts_split_1.ism') copper = OEGraphMol() OEParseSmiles(copper, '[Cu]') # Can't handle Phosphates in rings yet! libgen1 = OELibraryGen("[O&!H1&!-,N&!-,S&!H1&!-:3][P&!r:2](=[S:1])([*:4])[*:5].[Cu:11].[Cu:12].[Cu:13]>>[Cu:11][A:3].[P:2]=[S:1].[Cu:12][*:4].[Cu:13][*:5]") for mol in ifs.GetOEMols(): libgen1.AddStartingMaterial(mol, 0) libgen1.AddStartingMaterial(copper, 1) libgen1.AddStartingMaterial(copper, 2) libgen1.AddStartingMaterial(copper, 3) mol.Clear() copper.Clear() title_list = [] for products in libgen1.GetProducts(): if products.NumAtoms() < 76: num = 1 title = products.GetTitle()+'_Z'+str(num) while title in title_list: num+=1 title = products.GetTitle()+'_Z'+str(num) products.SetTitle(title) OEWriteMolecule(ofs, products) # print OECreateIsoSmiString(products) ofs.close() ifs.close()