#!/usr/local2/bin/python import os, string from openeye.oechem import * ifs = oemolistream() ifs.open('a_aa_outofkegg.sdf') ifs2 = oemolistream() ofs_3 = oemolostream() ofs_3.open('g_create_dp.smi') ofs_3.SetFormat(OEFormat_SMI) ofs_4 = oemolostream() ofs_4.open('g_create_dp.sdf') ofs_4.SetFormat(OEFormat_SDF) # Reaction 1: Formation of a peptide bond (OE doesn't handle stereochem) # with explicit hydrogens #libgen = OELibraryGen("[N:1][C:2][C:3](=[O:4])[O].[N:101]([H:106])([H])[C:102][C:103](=[O:104])[O:105]>>[N:1][C:2][C:3](=[O:4])[N:101]([H:106])[C:102][C:103](=[O:104])[O:105]") # or with Implicit hydrogens # libgen = OELibraryGen("[N:1][C:2][C:3](=[O:4])[O].[N:101][C:102][C:103](=[O:104])[O:105]>>[N:1][C:2][C:3](=[O:4])[Nh1:101][C:102][C:103](=[O:104])[O:105]") #libgen.SetExplicitHydrogens(False) # or with automatic valence correction #libgen = OELibraryGen("[N:1][C:2][C:3](=[O:4])[O].[N:101][C:102][C:103](=[O:104])[O:105]>>[N:1][C:2][C:3](=[O:4])[N:101][C:102][C:103](=[O:104])[O:105]") libgen = OELibraryGen("[C:3](=[O:4])[O].[Nh3,Nh2,Nh1&R:101][Ch1:102]>>[C:3](=[O:4])[N:101][C:102]") libgen.SetExplicitHydrogens(False) libgen.SetValenceCorrection(True) # Kein Parsing des Smiles, da sonst Verlust der Stereochemistry information # (dafuer 5-bindiger Bug in Aromatischen Systemen->filter.py) # mol_s = OEGraphMol() title_list = [] for aa in ifs.GetOEMols(): ifs2.open('a_aa_outofkegg.sdf') for aa2 in ifs2.GetOEMols(): libgen.SetStartingMaterial(aa, 0) libgen.SetStartingMaterial(aa2, 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) OEWriteMolecule(ofs_4, products) ifs.open('a_aa_outofkegg.sdf') libgen2 = OELibraryGen("[C:3](=[O:4])[O].[Nh3,Nh2:101][Ch2&!R:102]>>[C:3](=[O:4])[N:101][C:102]") libgen2.SetExplicitHydrogens(False) libgen2.SetValenceCorrection(True) # Kein Parsing des Smiles, da sonst Verlust der Stereochemistry information # (dafuer 5-bindiger Bug in Aromatischen Systemen->filter.py) # mol_s = OEGraphMol() for aa in ifs.GetOEMols(): ifs2.open('a_aa_outofkegg.sdf') for aa2 in ifs2.GetOEMols(): libgen2.SetStartingMaterial(aa, 0) libgen2.SetStartingMaterial(aa2, 1) for products in libgen2.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) OEWriteMolecule(ofs_4, products) ofs_3.close() ofs_4.close() ifs.close()