b0VIM 7.0„ºÔEkå johameatpuppet.ucsf.edu~joha/CYSPROT/cysprot_93rxn_sdf2mol2_mysql_names.py 3210#"! Utpÿfad´`fä·¶Ÿ‚sr#ëÒ…q?ù á ¹   z V < í ì ~ [  ú ê ¼ ¤ ‘ _ R ÿ ð â “ ’ v c í Ö Ñ ´ ¡ ‘ o Z E D úëêÛ¿¥„iJ+ñΟ{T-#óØ×˜+öŸL10 í³fQ?÷é´pfLÛÚp`g ofs.close() OEWriteMol2File(ofs,mol) ofs.open('MOLS/RING_'+ring_path+suffix+'/OH_'+ti_path+'/'+title+'.mol2') os.mkdir('MOLS/RING_'+ring_path+suffix+'/OH_'+ti_path) os.mkdir('MOLS/RING_'+ring_path+suffix) os.mkdir('MOLS') else: os.mkdir('MOLS/RING_'+ring_path+suffix+'/OH_'+ti_path) os.mkdir('MOLS/RING_'+ring_path+suffix) else: os.mkdir('MOLS/RING_'+ring_path+suffix+'/OH_'+ti_path) else: pass if os.path.exists('MOLS/RING_'+ring_path+suffix+'/OH_'+ti_path): if os.path.exists('MOLS/RING_'+ring_path+suffix): if os.path.exists('MOLS'): # Are target folders existent ? raise SystemExit() print 'Error: title', title, 'not in title-list, but in mol folder ???!!!' if os.path.exists('MOLS/RING_'+ring_path+suffix+'/OH_'+ti_path+'/'+title+'.mol2'): mol.SetTitle(title) title_list.append(title) title = create_ntitle(mol.GetTitle(), title_list, '_'+string.lower(ring_path)+'_'+string.lower(ti_path)) # Generate title, evtl new ionization state out of ionizer raise SystemExit() print 'something wrong with the rings!' else: elif count > 1: ring_path = 'MORE' elif count == 1: ring_path = 'ONE' if count == 0: ring_path = 'NO' count, parts = OEDetermineRingSystems(mol) OEGasteigerPartialCharges(mol) OEAssignAromaticFlags(mol) OETriposAtomNames(mol) OETriposBondTypeNames(mol) OETriposAtomTypeNames(mol) OETriposAtomTypes(mol) OEFindRingAtomsAndBonds(mol) OEPerceiveChiral(mol)for mol in ifs.GetOEMols():ifs.open(file)ti_path = 'LN'#Artefact from intermediates generation - not really needed here but keptofs = oemolostream()ifs = oemolistream()title_list = lookup_proc_codes() suffix = ''except IndexError: suffix = '_'+sys.argv[2]try: raise SystemExit() print 'usage: cysprot_93rxn_sdf2mol2_mysql_names.py sdf-file(from corina+ionizer) suffix(for Folders after ring)'except IndexError: file = sys.argv[1]try:#----------------------------------------------------------------------------- return nt db.close() c.close() c.execute('insert into PROC_NAMES (Proc_Name) Values (%s)' , nt) print nt nt = 'CYPR'+ot[4:]+'_p00'+str(counter)+en counter+=1 while nt in titles: nt = 'CYPR'+ot[4:]+'_p00'+str(counter)+en counter = 1 c = db.cursor() db = MySQLdb.connect(host='newelvis.ucsf.edu',passwd='secret',db='joha')def create_ntitle(ot, titles, en):#Creates a new title for a mol#-----------------------------------------------------------------------------#----------------------------------------------------------------------------- return proc_name_list print 'Got Existing File Names' proc_name_list.append(pn) for pn in namet: for namet in mysql_proc_name_tupel: proc_name_list = [] db.close() c.close() mysql_proc_name_tupel = c.fetchall() c.execute('select Proc_Name from PROC_NAMES') c = db.cursor() db = MySQLdb.connect(host='newelvis.ucsf.edu',passwd='secret',db='joha')def lookup_proc_codes():#Creates a list of already created names for mol2-files#-----------------------------------------------------------------------------import MySQLdbfrom openeye.oechem import *import sys, string, os# transform sdfs to mol2 and give new titles#!/usr/local2/bin/python2.3