#!/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_3 = oemolostream() ofs_4 = oemolostream() ofs_1.open('b_react_ti_ln_ff.sdf') ofs_2.open('b_react_ti_ln_ff.ism') ofs_3.open('b_react_ti_lp_ff.sdf') ofs_4.open('b_react_ti_lp_ff.ism') log = open('b_react_rm_doubles.log', 'a') ism_mol_dir = {} rxn = 12 while rxn < 15: rxn+=1 if os.path.exists('b_react_ti_'+str(rxn)+'_ln.sdf'): ifs.open('b_react_ti_'+str(rxn)+'_ln.sdf') for mol in ifs.GetOEMols(): if mol.NumAtoms() < 71: 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) OEWriteMolecule(ofs_2, mol) else: continue ifs.close() else: pass if os.path.exists('b_react_ti_'+str(rxn)+'_lp.sdf'): ifs.open('b_react_ti_'+str(rxn)+'_lp.sdf') 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_3, mol) OEWriteMolecule(ofs_4, mol) else: continue ifs.close() else: pass log.close() ofs_1.close() ofs_2.close() ofs_3.close() ofs_4.close()