#!/usr/local2/bin/python2.3 import string, os, shutil from openeye.oechem import * ##### Looks for identical molecules - and removes them (time consuming, but safe -> Paranoia to loose sth ifs = oemolistream() ofs_1 = oemolostream() ofs_2 = oemolostream() ofs_1.open('bb1-7_ln.ism') ofs_2.open('bb1-7_lp.ism') log = open('bb1-7_doubles.log', 'a') ism_mol_dir = {} rxn = 0 while rxn < 7: rxn+=1 if os.path.exists('bb'+str(rxn)+'_ln.ism'): ifs.open('bb'+str(rxn)+'_ln.ism') for mol in ifs.GetOEMols(): # if mol.NumAtoms() < 71: # DB2-rule ism = OECreateIsoSmiString(mol) if ism_mol_dir.has_key(ism): log.write(mol.GetTitle()+' is equal to '+ism_mol_dir[ism]+'\n') else: ism_mol_dir[ism] = mol.GetTitle() OEWriteMolecule(ofs_1, mol) # else: # continue ifs.close() else: pass if os.path.exists('bb'+str(rxn)+'_lp.ism'): ifs.open('bb'+str(rxn)+'_lp.ism') for mol in ifs.GetOEMols(): # if mol.NumAtoms() < 76: ism = OECreateIsoSmiString(mol) if ism_mol_dir.has_key(ism): log.write(mol.GetTitle()+' is equal to '+ism_mol_dir[ism]+'\n') else: ism_mol_dir[ism] = mol.GetTitle() OEWriteMolecule(ofs_2, mol) # else: # continue ifs.close() else: pass log.close() ofs_1.close() ofs_2.close()