def readoutresults(reslall, resnall, pickthese, DeltaOmegaParametersBoundaries, savstatdir, namresults, conditions, k23max): """ reads global fitting results from file. reslall: list of all residues possibly used for the results output, with a letter in front indicating whether this is referring to the folded (A), random coil (B) or dimer(C) peak. resnall: same list as reslall, without the letter pickthese: list pointing to the residues in reslall, resnall actually used for the output DeltaOmegaParametersBoundaries: boundaries for delta omegas, this is a dummy variable in most case. format: [residue1, residue2, ...]; residue1= [site A, site B, site C]; site A: [min, max boundary] namresults: name of results file. typically has an err_ suffix when referring to the error calculations based on a corresponding file without the suffix results files have the .dill file extension. DEL? conditions: list of fitting conditions, not important (dummy) format will me explained later. subject to removal First, a collection of Property Axes is triggered. Containing informations about possible magnetic fields, temperatures, sites, concentrations, B1 fields, experiment types, TROSY type, residues Then a ParameterCollection object based on the params class, using the PropertyAxesColl object, is generated. All relaxation dispersion fitting data are loaded into a variety of variables. The resultcoll variable contains the actual results. costs are extracted. The resulting parameters are transferred to the ParameterCollection object. The ParameterCollection object is re-sorted in order of increasing fitting cost. Important variables including a list of fitting conditions saved in the results file are returned. Also resultcoll, cost list, the resorted Parameter Collection and Property Axes Collection. """ PropAxesColl=mainfuncts.GeneratePropertyAxesCollection([x for y,x in \ enumerate(reslall) if y in pickthese],[x for y,x in enumerate(resnall)\ if y in pickthese]) ParameterColl=mainfuncts.parammake(PropAxesColl,0,[x for y,x in enumerate\ (DeltaOmegaParametersBoundaries) if y in pickthese],1,10000,100,900,1,k23max,0.005,0.5) #2 or 900 #DEL?#setparameters2=['combo10l.dat','C:\\Users\\Hans\\Desktop\\TRANSFER\\2020Feb\\',[[x for y,x in enumerate(reslall) if y in pickthese]],conditions,namresults] #DEL?#namresults=namresults+str(resnall[0])+'_'+str(nn)+'_' #A variety of pre-calculated data is loaded with this command. Not all of #them are in use, so no need to understand every sirngle variable here. poscoll,resnam,allsetcoll,resultcoll,relaxrat0,relaxrat,lookatratio,\ results,relaxrat1,relaxrat2,relaxrat_1,relaxrat_2,intdiffcorr, intcorr,\ intmin,ac,oc,rateconstpre,cond=hkio2.loadeverything(savstatdir,[namresults],0,decoupl=0) costcoll = [i.cost for i in resultcoll] #resultcoll=[resultcoll[np.argsort(costcoll)[0]]] ParameterColl2 = mainfuncts.resc2param(PropAxesColl, ParameterColl, resultcoll, 2) ParameterColl2 = [ParameterColl2[i] for i in np.argsort(costcoll)] costcoll = [costcoll[i] for i in np.argsort(costcoll)] return PropAxesColl, ParameterColl2, costcoll, resultcoll, cond
#namresults='multix13_NEW_pfr_M2_err_' #%% namresultslist = [ 'FINAL_stage3_indiv_', 'FINAL_stage3_23_indiv_', 'FINAL_stage3_indiv_restrkp_', 'FINAL_stage3_indiv_restrall_' ] zx = [] for x in namresultslist: z = [] for y in np.arange(15): namresults = x + str(y) + '_0_' #print namresults poscoll,resnam,allsetcoll,resultcoll,relaxrat0,relaxrat,lookatratio,\ results,relaxrat1,relaxrat2,relaxrat_1,relaxrat_2,intdiffcorr, intcorr,\ intmin,ac,oc,rateconstpre,cond=hkio2.loadeverything(savstatdir,[namresults],0,decoupl=0) z.append(np.round(resultcoll[0].cost, 2)) zx.append(z) print np.average(z) from matplotlib import pyplot as plt reslall = [ 'A29', 'A30', 'A31', 'A32', 'A33', 'A34', 'A52', 'A53', 'A54', 'A78', 'A81', 'A82', 'A83', 'A84', 'A86' ] #fullnamlist=['Ser','Gly', 'Trp', 'Val', 'Trp', 'Asn', 'Gln', 'Phe', 'Phe', 'Val', 'Ile', 'Glu', 'Glu', 'Tyr', 'Thr', 'Gly', 'Pro', 'Asp', 'Pro', 'Val', 'Leu', 'Val', 'Gly', 'Arg', 'Leu', 'His', 'Ser', 'Asp', 'Ile', 'Asp', 'Ser', 'Gly', 'Asp', 'Gly', 'Asn', 'Ile', 'Lys', 'Tyr', 'Ile', 'Leu', 'Ser', 'Gly', 'Glu', 'Gly', 'Ala', 'Gly', 'Thr', 'Ile', 'Phe', 'Val', 'Ile', 'Asp', 'Asp', 'Lys', 'Ser', 'Gly', 'Asn', 'Ile', 'His', 'Ala', 'Thr', 'Lys', 'Thr', 'Leu', 'Asp', 'Arg', 'Glu', 'Glu', 'Arg', 'Ala', 'Gln', 'Tyr', 'Thr', 'Leu', 'Met', 'Ala', 'Gln', 'Ala', 'Val', 'Asp', 'Arg', 'Asp', 'Thr', 'Asn', 'Arg', 'Pro', 'Leu', 'Glu', 'Pro', 'Pro', 'Ser', 'Glu', 'Phe', 'Ile', 'Val', 'Lys', 'Val', 'Gln', 'Asp'] plt.rcParams.update({'font.size': 14}) lab = [ 'Asp29', 'Ser30', 'Gly31', 'Asp32', 'Gly33', 'Asn34', 'Asp52', 'Lys53', 'Ser54', 'Val78', 'Asp81', 'Thr82', 'Asn83', 'Arg84', 'Leu86' ]
def produceindivplots(path2020, savstatdir, datafile, namresults, reslallx, resnallx, parbdslistaxallfx, namout, mode, k121, k122, k131, k132, k231, k232, errruns): #print 'a' for pickthis in np.arange(len(reslallx)): # print 'b' reslall = [reslallx[pickthis]] resnall = [resnallx[pickthis]] pickthese = [0] # print 'c' PropAxesColl = mainfuncts.GeneratePropertyAxesCollection( [x for y, x in enumerate(reslall) if y in pickthese], [x for y, x in enumerate(resnall) if y in pickthese]) parbdslistaxallf = [parbdslistaxallfx[pickthis]] #paramsxx=mainfuncts.parammake(PropAxesColl,0,[x for y,x in enumerate(parbdslistaxallf) if y in pickthese],1,8000,100,900,k231,k232,0.005,0.1) #paramsxx=mainfuncts.parammake(PropAxesColl,0,[x for y,x in enumerate(parbdslistaxallf) if y in pickthese],3000,4000,600,700,k231,k232,0.01,0.02) paramsxx = mainfuncts.parammake( PropAxesColl, 0, [x for y, x in enumerate(parbdslistaxallf) if y in pickthese], k121, k122, k131, k132, k231, k232, 0.01, 0.02) ##conditions=[0,[1,0,0,5,5]] #individual nitrogen fits conditions = [0, [1, 0, 0, 10, 5]] #individualproton fits #setparameters2=['combo10l.dat','C:\\Users\\Hans\\Desktop\\TRANSFER\\2020Feb\\',[[x for y,x in enumerate(reslall) if y in pickthese]],conditions,namresults] if namresults == []: ParameterColl6 = paramsxx else: poscoll, resnam, allsetcoll, resultcoll, relaxrat0, relaxrat, lookatratio, results, relaxrat1, relaxrat2, relaxrat_1, relaxrat_2, intdiffcorr, intcorr, intmin, ac, oc, rateconstpre, cond = hkio2.loadeverything( savstatdir, [namresults], 0, decoupl=0) costcoll = [i.cost for i in resultcoll] resultcoll = [resultcoll[np.argsort(costcoll)[0]]] ParameterColl6 = mainfuncts.resc2param(PropAxesColl, paramsxx, resultcoll, mode) for nn in [0]: #np.arange(3): namresultsOUT = namout + str(nn) + '_' setparameters3 = [ datafile, path2020, [[x for y, x in enumerate(reslall) if y in pickthese]], conditions, namresultsOUT, 0 ] hkfit2.parallelfit3(path2020, savstatdir, setparameters3, 0, ParameterColl6[nn], PropAxesColl) dataname = datafile setparameters2 = [ dataname, path2020, [x for y, x in enumerate(reslall) if y in pickthese], conditions, namresultsOUT ] #,'A34' #'/home/hanskoss/data/Cadherin/nmrCad/procandcoll/TSnewsort/2020Feb/ selset = 0 ss = hkfit2.evaluaterdfit(path2020, savstatdir, PropAxesColl, setparameters2, 1, ParameterColl6[selset], 0) hkio2.savss(savstatdir, ss, namresultsOUT) for errc in np.arange(errruns): setparameters3 = [ datafile, path2020, [[x for y, x in enumerate(reslall) if y in pickthese]], conditions, namresultsOUT + 'err_' + str(errc) + '_', namresultsOUT ] hkfit2.parallelfit3(path2020, savstatdir, setparameters3, 0, ParameterColl6[nn], PropAxesColl) setparameters3 = [ 'combo10l.dat', path2020, [[x for y, x in enumerate(reslall) if y in pickthese]], conditions, 'FINAL_stage4_23_', 'FINAL_stage3_23x_' + str(runnum) ] p = multiprocessing.Process(target=hkfit2.parallelfit3, args=(path2020, savstatdir, setparameters3, outnum * numrep + runnum, ParameterColl6[runnum], PropAxesColl))