#!/usr/bin/python # Just replaces the marker atoms (one at a time, otherwise conformation gets screwed) # for non-thio - phosphateesters from openeye.oechem import * import os, string, sys try: ifs = oemolistream() ifs.open('b7.3'+sys.argv[1]+'_ln.sdf') ofs_1 = oemolostream() ofs_1.open('b7.4'+sys.argv[1]+'_ln_nocorina.sdf') #ofs_2 = oemolostream() #ofs_2.open('b8.4_parts_connect_2_lp.sdf') except IndexError: print '\nUsage: b7.4_parts_connect_2.py file-identifier(e.g. _mol_32007)\n' raise SystemExit() #leaving group rxn_Mg = OEUniMolecularRxn("[*:41][Mg:1][P:2]([OH1:3])([Li:4])([Zn:5])[O-:6]>>[*:41][P:2]([OH1:3])([Li:4])([Zn:5])[O-:6]") #non hydrolysed rest 1 (negatively charged) rxn_Li_1 = OEUniMolecularRxn("[P:2]([OH1:3])([Li:4][O-,N-,S-:42])([Zn:5])[O-:6]>>[P:2]([OH1:3])([*-:42])([Zn:5])[O-:6]") #non hydrolysed rest 1 (neutral) rxn_Li_2 = OEUniMolecularRxn("[P:2]([OH1:3])([Li:4][Ov2,Nv3,Sv2,Cv4,F:42])([Zn:5])[O-:6]>>[P:2]([OH1:3])([*:42])([Zn:5])[O-:6]") #non hydrolysed rest 2 (negatively charged) rxn_Zn_1 = OEUniMolecularRxn("[P:2]([OH1:3])([Zn:5][O-,N-,S-:43])[O-:6]>>[P:2]([OH1:3])([*-:43])[O-:6]") #non hydrolysed rest 2 (neutral) rxn_Zn_2 = OEUniMolecularRxn("[P:2]([OH1:3])([Zn:5][Ov2,Nv3,Sv2,Cv4,F:43])[O-:6]>>[P:2]([OH1:3])([*:43])[O-:6]") li_minus = OESubSearch() li_minus.Init('[P][Li:4][N-,S-,O-]') zn_minus = OESubSearch() zn_minus.Init('[P][Zn:4][N-,S-,O-]') for mol in ifs.GetOEMols(): rxn_Mg(mol) if li_minus.SingleMatch(mol) == 1: rxn_Li_1(mol) else: rxn_Li_2(mol) if zn_minus.SingleMatch(mol) == 1: rxn_Zn_1(mol) else: rxn_Zn_2(mol) OEWriteMolecule(ofs_1, mol) ofs_1.close() ifs.close() #ifs.open('b8.3_parts_connect_1_lp_corina.sdf') #for mol in ifs.GetOEMols(): # rxn_Mg(mol) # if li_minus.SingleMatch(mol) == 1: # rxn_Li_1(mol) # else: # rxn_Li_2(mol) # if zn_minus.SingleMatch(mol) == 1: # rxn_Zn_1(mol) # else: # rxn_Zn_2(mol) # OEWriteMolecule(ofs_2, mol) #ofs_2.close() #ifs.close() # corina for database (incl. ringconf + stereo) os.system('corina -d errorfile=b7.4'+sys.argv[1]+'_ln_err.sdf,r2d,wh,stergen,msc=5,msi=13,names,preserve,rc,flapn,mc=10,sc -t tracefile=b7.4'+sys.argv[1]+'_ln_corina_trace.trc -i t=sdf -o t=sdf b7.4'+sys.argv[1]+'_ln_nocorina.sdf b7.4'+sys.argv[1]+'_ln_out.sdf') print '\nNow run(on bjork)\nb7.5_ionizer.py '+sys.argv[1]+'\n'