fd.writelines(l) fd.close() l_xtics = [] l_sort.sort() for average,s_col,s in l_sort: print s ## l_xtics += [s.split('\t')[-1].strip()] l_xtics += [s_col] l_xtics.reverse() for method in ['alpha','heavy','chi1',]: prefix = 'rmsd_statistics_%s_%s' %(protein,method,) gnuplot.histogram( prefix, d[method], l_xtics, ylabel = '%s RMSD' %(method), ## ymax = 5, ## bool_remove = False, ) ## ## statistics, excluding cross effects ## for prop,l_col1,l_col2, in [ ['author',[5,7,11,],[10,9,12,4,],], ['model',[5,10,],[11,4,],], ['spacegroup',['sameSG',],['diffSG',],], ['A_spacegroup',[4,5,7,8,9,10,11,12,],[3,],], ['B_all_excl_special',range(3,6)+range(7,13),[],], ['C_all',range(2,13),[],], ]: for method in ['alpha','heavy','chi1',]:
def main( self, l_wts, d_pred, l_xtics, ): import os, sys sys.path.append('/home/people/tc/svn/tc_sandbox/misc/') import gnuplot, statistics ## parse experimental data d_exp = self.dic2csv(l_xtics) ## get cwd dir_main = os.getcwd() l_r = [] for pdb in l_wts: print pdb, l_wts.index(pdb) if not os.path.isdir('%s/%s' % (dir_main, pdb)): os.mkdir('%s/%s' % (dir_main, pdb)) os.chdir('%s/%s' % (dir_main, pdb)) self.pre_whatif(pdb) if pdb in [ '2vb1', '1vdp', ]: os.system('cp %s_monomer.pdb %s_protonated.pdb' % (pdb, pdb)) ## else: ## self.whatif(pdb) ## self.calculate_chemical_shifts(pdb) ## parse computational predictions d_pred = self.parse_chemical_shifts(pdb, d_pred) ## calculate correlation coefficients l_exp = [] l_pred = [] for titgrp in d_exp.keys(): res_number = int(titgrp[1:]) res_symbol = titgrp[0] res_name = self.d_ressymbol2resname[res_symbol] for nucleus in d_exp[titgrp].keys(): cs_exp = d_exp[titgrp][nucleus] l_exp += [cs_exp] index = nucleus.index('N-HN') cs_pred = d_pred['%s%i' % (res_name, res_number)][nucleus[:index]][-1] l_pred += [cs_pred] r = statistics.correlation(l_exp, l_pred) l_r += [r] ## print titgrp,r ## print sum(l_r)/len(l_r), min(l_r), max(l_r) ## change from local dir to main dir os.chdir(dir_main) ## plots for titgrp1 in d_exp.keys() + ['E35']: res_number = int(titgrp1[1:]) res_symbol = titgrp1[0] res_name = self.d_ressymbol2resname[res_symbol] titgrp3 = '%s%i' % (res_name, res_number) prefix = 'delta_cs_%s' % (titgrp3) ylabel = '{/Symbol D}{/Symbol w}_H' title = titgrp3 gnuplot.histogram( d_pred[titgrp3], prefix, l_xtics, ylabel=ylabel, title=title, ## l_plotdatafiles=['E34.txt'], ) return
def main( self,l_wts,d_pred,l_xtics, ): import os, sys sys.path.append('/home/people/tc/svn/tc_sandbox/misc/') import gnuplot, statistics ## parse experimental data d_exp = self.dic2csv(l_xtics) ## get cwd dir_main = os.getcwd() l_r = [] for pdb in l_wts: print pdb, l_wts.index(pdb) if not os.path.isdir('%s/%s' %(dir_main,pdb)): os.mkdir('%s/%s' %(dir_main,pdb)) os.chdir('%s/%s' %(dir_main,pdb)) self.pre_whatif(pdb) if pdb in ['2vb1','1vdp',]: os.system('cp %s_monomer.pdb %s_protonated.pdb' %(pdb,pdb)) ## else: ## self.whatif(pdb) ## self.calculate_chemical_shifts(pdb) ## parse computational predictions d_pred = self.parse_chemical_shifts(pdb,d_pred) ## calculate correlation coefficients l_exp = [] l_pred = [] for titgrp in d_exp.keys(): res_number = int(titgrp[1:]) res_symbol = titgrp[0] res_name = self.d_ressymbol2resname[res_symbol] for nucleus in d_exp[titgrp].keys(): cs_exp = d_exp[titgrp][nucleus] l_exp += [cs_exp] index = nucleus.index('N-HN') cs_pred = d_pred['%s%i' %(res_name,res_number)][nucleus[:index]][-1] l_pred += [cs_pred] r = statistics.correlation(l_exp,l_pred) l_r += [r] ## print titgrp,r ## print sum(l_r)/len(l_r), min(l_r), max(l_r) ## change from local dir to main dir os.chdir(dir_main) ## plots for titgrp1 in d_exp.keys()+['E35']: res_number = int(titgrp1[1:]) res_symbol = titgrp1[0] res_name = self.d_ressymbol2resname[res_symbol] titgrp3 = '%s%i' %(res_name,res_number) prefix = 'delta_cs_%s' %(titgrp3) ylabel = '{/Symbol D}{/Symbol w}_H' title = titgrp3 gnuplot.histogram( d_pred[titgrp3],prefix,l_xtics, ylabel=ylabel,title=title, ## l_plotdatafiles=['E34.txt'], ) return