def htmlSummaryPhaser(self): """ Create HTML/php files for autoindex/strategy output results. """ if self.verbose: self.logger.debug('AutoMolRep::htmlSummaryPhaser') try: sl = 'jon_summary_cell.html' if self.gui: sl = sl.replace('html', 'php') jon_summary = open(sl, 'w') jon_summary.write(Utils.getHTMLHeader(self, 'phaser')) jon_summary.write('%6s$(document).ready(function() {\n' % '') #jon_summary.write("%8s$('#accordion').accordion({\n"%'') #jon_summary.write('%11scollapsible: true,\n%11sactive: false });\n'%('','')) if self.cell_summary: jon_summary.write("%8s$('#phaser-cell').dataTable({\n" % '') jon_summary.write( '%11s"bPaginate": false,\n%11s"bFilter": false,\n%11s"bInfo": false,\n%11s"bSort": false,\n%11s"bAutoWidth": false});\n' % (5 * ('', ))) if self.pdb_summary: jon_summary.write("%8s$('#phaser-pdb').dataTable({\n" % '') jon_summary.write( '%11s"bPaginate": false,\n%11s"bFilter": false,\n%11s"bInfo": false,\n%11s"bSort": false,\n%11s"bAutoWidth": false});\n' % (5 * ('', ))) #Style the button jon_summary.write('%8s$("button").button();\n' % '') if self.tooltips: jon_summary.writelines(self.tooltips) jon_summary.write( '%6s});\n%4s</script>\n%2s</head>\n%2s<body id="dt_example">\n' % (4 * ('', ))) if self.cell_summary: jon_summary.writelines(self.cell_summary) if self.pdb_summary: jon_summary.writelines(self.pdb_summary) """ jon_summary.write('%4s<div id="container">\n%5s<div class="full_width big">\n%6s<div id="demo">\n'%(3*('',))) jon_summary.write("%7s<h1 class='Results'>RAPD Logfile</h1>\n%6s</div>\n%5s</div>\n"%(3*('',))) jon_summary.write('%5s<div id="accordion">\n%6s<h3><a href="#">Click to view log</a></h3>\n%6s<div>\n%7s<pre>\n'%(4*('',))) jon_summary.write('%7s</pre>\n%6s</div>\n%5s</div>\n%4s</div>\n%2s</body>\n</html>\n'%(5*('',))) """ jon_summary.write('%2s</body>\n</html>\n' % '') jon_summary.close() #copy html file to working dir shutil.copy(sl, self.working_dir) except: self.logger.exception('**ERROR in AutoMolRep.htmlSummaryPhaser**')
def html_summary(self): """ Create HTML/php files for autoindex/strategy output results. """ if self.verbose: self.logger.debug("PDBQuery::html_summary") try: if self.gui: jon_summary = open("jon_summary_cell.php", "w") else: jon_summary = open("jon_summary_cell.html", "w") #jon_summary.write(xutils.getHTMLHeader(self,"phaser")) jon_summary.write(xutils.getHTMLHeader(self, "pdbquery")) jon_summary.write("%6s$(document).ready(function() {\n" % "") if self.gui: jon_summary.write("%8s$('button').button(); \n" % "") if self.cell_summary: jon_summary.write("%8s$('#pdbquery-cell').dataTable({\n" % "") jon_summary.write( '%11s"bPaginate": false,\n%11s"bFilter": false,\n%11s"bInfo": false,\n%11s"bSort": false,\n%11s"bAutoWidth": false });\n' % (5 * ("", ))) if self.search_common: jon_summary.write("%8s$('#pdbquery-cc').dataTable({\n" % "") jon_summary.write( '%11s"bPaginate": false,\n%11s"bFilter": false,\n%11s"bInfo": false,\n%11s"bSort": false,\n%11s"bAutoWidth": false });\n' % (5 * ("", ))) if self.pdb_summary: jon_summary.write("%8s$('#pdbquery-pdb').dataTable({\n" % "") jon_summary.write( '%11s"bPaginate": false,\n%11s"bFilter": false,\n%11s"bInfo": false,\n%11s"bSort": false,\n%11s"bAutoWidth": false });\n' % (5 * ("", ))) if self.tooltips: jon_summary.writelines(self.tooltips) jon_summary.write( '%6s});\n%4s</script>\n%2s</head>\n%2s<body id="dt_example">\n' % (4 * ("", ))) if self.cell_summary: jon_summary.writelines(self.cell_summary) if self.pdb_summary: jon_summary.writelines(self.pdb_summary) jon_summary.write("%2s</body>\n</html>\n" % "") jon_summary.close() except: self.logger.exception("**ERROR in PDBQuery.html_summary**") # Print attributions self.print_info()
def html_summary_xtriage(self): """ Create HTML/php files for xtriage output results. """ if self.verbose: self.logger.debug("AutoStats::html_summary_xtriage") try: if self.xtriage_summary: if self.gui: sl = "jon_summary_xtriage.php" else: sl = "jon_summary_xtriage.html" jon_summary = open(sl, "w") jon_summary.write(Utils.getHTMLHeader(self, "xtriage")) jon_summary.write("%6s$(document).ready(function() {\n" % "") jon_summary.write("%8s$('#accordion-xtriage').accordion({\n%11scollapsible: true,\n%11sactive: false });\n" % (3*("", ))) jon_summary.write("%8s$('#xtriage-auto2').dataTable({\n" % "") jon_summary.write('%11s"bPaginate": false,\n%11s"bFilter": false,\n%11s"bInfo": false,\n%11s"bSort": false,\n%11s"bAutoWidth": false });\n' % (5*("", ))) jon_summary.write("%8s$('#xtriage_pat').dataTable({\n" % "") jon_summary.write('%11s"bPaginate": false,\n%11s"bFilter": false,\n%11s"bInfo": false,\n%11s"bSort": false,\n%11s"bAutoWidth": false });\n' % (5*("", ))) if self.pts: jon_summary.write("%8s$('#xtriage_pts').dataTable({\n" % "") jon_summary.write('%11s"bPaginate": false,\n%11s"bFilter": false,\n%11s"bInfo": false,\n%11s"bSort": false,\n%11s"bAutoWidth": false });\n' % (5*("", ))) if self.twin: jon_summary.write("%8s$('#xtriage_twin').dataTable({\n" % "") jon_summary.write('%11s"bPaginate": false,\n%11s"bFilter": false,\n%11s"bInfo": false,\n%11s"bSort": false,\n%11s"bAutoWidth": false });\n' % (5*("", ))) jon_summary.write('%6s});\n%4s</script>\n%2s</head>\n%2s<body id="dt_example">\n' % (4*("", ))) jon_summary.writelines(self.xtriage_summary) jon_summary.write('%4s<div id="container">\n%5s<div class="full_width big">\n%6s<div id="demo">\n' % (3*("", ))) jon_summary.write("%7s<h1 class='Results'>Xtriage Output</h1>\n%6s</div>\n%5s</div>\n" % (3*("", ))) jon_summary.write('%5s<div id="accordion-xtriage">\n' % "") jon_summary.write('%6s<h3><a href="#">Click to view Xtriage log</a></h3>\n%6s<div>\n%7s<pre>\n' % (3*("", ))) if self.xtriage_log: for line in self.xtriage_log: jon_summary.write(line) else: jon_summary.write("---------------Xtriage FAILED---------------\n") jon_summary.write("%7s</pre>\n%6s</div>\n%5s</div>\n%4s</div>\n%2s</body>\n</html>\n" %(5*("", ))) jon_summary.close() else: Utils.failedHTML(self, ("jon_summary_xtriage", "Input data could not be analysed, probably because resolution was too low.")) except: self.logger.exception("**ERROR in AutoStats.html_summary_xtriage**")
def html_summary_molrep(self): """ Create HTML/php files for Molrep output results. """ if self.verbose: self.logger.debug("AutoStats::html_summary_molrep") try: if self.molrep_summary: molrep_log = self.molrep_results.get("Molrep results").get("Molrep log") if self.gui: sl = "jon_summary_molrep.php" else: sl = "jon_summary_molrep.html" jon_summary = open(sl, "w") jon_summary.write(Utils.getHTMLHeader(self)) jon_summary.write("%6s$(document).ready(function() {\n" % "") jon_summary.write("%8s$('#accordion-molrep').accordion({\n" % "") jon_summary.write('%11scollapsible: true,\n%11sactive: false });\n' % ("", "")) if self.molrep_summary: jon_summary.write("%8s$('#molrep').dataTable({\n" % "") jon_summary.write('%11s"bPaginate": false,\n%11s"bFilter": false,\n%11s"bInfo": false,\n%11s"bSort": false,\n%11s"bAutoWidth": false});\n' % (5*("", ))) jon_summary.write('%6s});\n%4s</script>\n%2s</head>\n%2s<body id="dt_example">\n' % (4*("", ))) if self.molrep_summary: jon_summary.writelines(self.molrep_summary) else: jon_summary.write("%7s<h2 class='Results'>Error in molrep analysis</h1>\n" % "") jon_summary.write('%4s<div id="container">\n%5s<div class="full_width big">\n%6s<div id="demo">\n' % (3*("", ))) jon_summary.write("%7s<h1 class='Results'>Molrep Output</h1>\n%6s</div>\n%5s</div>\n" % (3*("", ))) jon_summary.write('%5s<div id="accordion-molrep">\n' % "") jon_summary.write('%6s<h3><a href="#">Click to view Molrep log</a></h3>\n%6s<div>\n%7s<pre>\n\n' % (3*("", ))) if molrep_log: for line in open(molrep_log, "r").readlines(): jon_summary.write(line) else: jon_summary.write("---------------Molrep FAILED---------------\n") jon_summary.write("%7s</pre>\n%6s</div>\n%5s</div>\n%4s</div>\n%2s</body>\n</html>\n" % (5*("", ))) jon_summary.close() else: Utils.failedHTML(self, "jon_summary_molrep") except: self.logger.exception("**ERROR in AutoStats.html_summary_molrep**")
def htmlSummaryPhaser(self): """ Create HTML/php files for autoindex/strategy output results. """ if self.verbose: self.logger.debug('AutoMolRep::htmlSummaryPhaser') try: sl = 'jon_summary_cell.html' if self.gui: sl = sl.replace('html','php') jon_summary = open(sl,'w') jon_summary.write(Utils.getHTMLHeader(self,'phaser')) jon_summary.write('%6s$(document).ready(function() {\n'%'') #jon_summary.write("%8s$('#accordion').accordion({\n"%'') #jon_summary.write('%11scollapsible: true,\n%11sactive: false });\n'%('','')) if self.cell_summary: jon_summary.write("%8s$('#phaser-cell').dataTable({\n"%'') jon_summary.write('%11s"bPaginate": false,\n%11s"bFilter": false,\n%11s"bInfo": false,\n%11s"bSort": false,\n%11s"bAutoWidth": false});\n'%(5*('',))) if self.pdb_summary: jon_summary.write("%8s$('#phaser-pdb').dataTable({\n"%'') jon_summary.write('%11s"bPaginate": false,\n%11s"bFilter": false,\n%11s"bInfo": false,\n%11s"bSort": false,\n%11s"bAutoWidth": false});\n'%(5*('',))) #Style the button jon_summary.write('%8s$("button").button();\n'%'') if self.tooltips: jon_summary.writelines(self.tooltips) jon_summary.write('%6s});\n%4s</script>\n%2s</head>\n%2s<body id="dt_example">\n'%(4*('',))) if self.cell_summary: jon_summary.writelines(self.cell_summary) if self.pdb_summary: jon_summary.writelines(self.pdb_summary) """ jon_summary.write('%4s<div id="container">\n%5s<div class="full_width big">\n%6s<div id="demo">\n'%(3*('',))) jon_summary.write("%7s<h1 class='Results'>RAPD Logfile</h1>\n%6s</div>\n%5s</div>\n"%(3*('',))) jon_summary.write('%5s<div id="accordion">\n%6s<h3><a href="#">Click to view log</a></h3>\n%6s<div>\n%7s<pre>\n'%(4*('',))) jon_summary.write('%7s</pre>\n%6s</div>\n%5s</div>\n%4s</div>\n%2s</body>\n</html>\n'%(5*('',))) """ jon_summary.write('%2s</body>\n</html>\n'%'') jon_summary.close() #copy html file to working dir shutil.copy(sl,self.working_dir) except: self.logger.exception('**ERROR in AutoMolRep.htmlSummaryPhaser**')
def html_summary(self): """ Create HTML/php files for autoindex/strategy output results. """ if self.verbose: self.logger.debug("PDBQuery::html_summary") try: if self.gui: jon_summary = open("jon_summary_cell.php", "w") else: jon_summary = open("jon_summary_cell.html", "w") #jon_summary.write(xutils.getHTMLHeader(self,"phaser")) jon_summary.write(xutils.getHTMLHeader(self, "pdbquery")) jon_summary.write("%6s$(document).ready(function() {\n" % "") if self.gui: jon_summary.write("%8s$('button').button(); \n" % "") if self.cell_summary: jon_summary.write("%8s$('#pdbquery-cell').dataTable({\n" % "") jon_summary.write('%11s"bPaginate": false,\n%11s"bFilter": false,\n%11s"bInfo": false,\n%11s"bSort": false,\n%11s"bAutoWidth": false });\n' % (5*("", ))) if self.search_common: jon_summary.write("%8s$('#pdbquery-cc').dataTable({\n" % "") jon_summary.write('%11s"bPaginate": false,\n%11s"bFilter": false,\n%11s"bInfo": false,\n%11s"bSort": false,\n%11s"bAutoWidth": false });\n' % (5*("", ))) if self.pdb_summary: jon_summary.write("%8s$('#pdbquery-pdb').dataTable({\n" % "") jon_summary.write('%11s"bPaginate": false,\n%11s"bFilter": false,\n%11s"bInfo": false,\n%11s"bSort": false,\n%11s"bAutoWidth": false });\n' % (5*("", ))) if self.tooltips: jon_summary.writelines(self.tooltips) jon_summary.write('%6s});\n%4s</script>\n%2s</head>\n%2s<body id="dt_example">\n'%(4*("",))) if self.cell_summary: jon_summary.writelines(self.cell_summary) if self.pdb_summary: jon_summary.writelines(self.pdb_summary) jon_summary.write("%2s</body>\n</html>\n" % "") jon_summary.close() except: self.logger.exception("**ERROR in PDBQuery.html_summary**") # Print attributions self.print_info()
def html_summary_pp(self): """ Create HTML/php files for Labelit.precession_photo output results. """ if self.verbose: self.logger.debug("LabelitPP::html_summary_pp") try: l = ["0KL", "H0L", "HK0"] if self.gui: sl = "jon_summary_pp.php" else: sl = "jon_summary_pp.html" jon_summary = open(sl, "w") jon_summary.write(Utils.getHTMLHeader(self)) jon_summary.write("%4s$(function() {\n%6s$('.tabs').tabs();\n%4s});\n" % (3*("", ))) jon_summary.write("%4s</script>\n%2s</head>\n%2s<body>\n%4s<table>\n%6s<tr>\n" % (5*("", ))) jon_summary.write('%8s<td width="100%%">\n%10s<div class="tabs">\n%12s<ul>\n' % (3*("", ))) for i in range(len(l)): jon_summary.write('%14s<li><a href="#tabs-54%s">%s</a></li>\n' % ("", i, l[i])) jon_summary.write("%12s</ul>\n" % "") for i in range(len(l)): jon_summary.write('%12s<div id="tabs-54%s">\n' % ("", i)) if self.labelitpp_results.get("LabelitPP results").get("%s jpg" % l[i]) == None: jon_summary.write("%14s<p>The precession photo for this plane did not work.</p>\n" % "") else: if self.gui: jon_summary.write("%14s<div id='pp%s_jpg' style='text-align:center'></div>\n" % ("", i)) else: jon_summary.write('%14s<IMG SRC="%s">\n' % ("", self.labelitpp_results.get("LabelitPP results").get("%s jpg" % l[i]))) jon_summary.write("%12s</div>\n" % "") jon_summary.write("%10s</div>\n%8s</td>\n%6s</tr>\n%4s</table>\n%2s</body>\n</html>\n" % (5*("", ))) jon_summary.close() except: self.logger.exception("**ERROR in LabelitPP.html_summary_pp**")
def plot_xtriage(self): """ generate plots html/php file """ if self.verbose: self.logger.debug("AutoStats::plot_xtriage") try: anom = self.xtriage_results.get("Xtriage results").get("Xtriage anom plot") intensity = self.xtriage_results.get("Xtriage results").get("Xtriage int plot") nz = self.xtriage_results.get("Xtriage results").get("Xtriage nz plot") l_test = self.xtriage_results.get("Xtriage results").get("Xtriage l-test plot") if self.ncs_results: cid0 = self.ncs_results.get("PhaserNCS results").get("CID").get("before", False) cid1 = self.ncs_results.get("PhaserNCS results").get("CID").get("after", False) #List of params for parsing later. l = [["Intensity", "Mean I vs. Resolution", "Resolution(A)", "M e a n   I", intensity, ("< I > smooth", "< I > binning", "< I > expected")], #["Z scores", "Data Sanity and Completeness check", "Resolution(A)", "Z   S c o r e", "z", #("Z_score", "Completeness")], ["Anom_Signal", "Anomalous Measurability", "Resolution(A)", "", anom, ("Obs_anom_meas", "Smoothed")], #["I/sigI", "Signal to Noise vs. Resolution", "Resolution(A)", "I / S i g I", "i", #("Signal_to_Noise",)], ["NZ_Test", "NZ Test", "z", "", nz, ("Acen_obs", "Acen_untwinned", "Cen_obs", "Cen_untwinned")], ["L_Test", "L-Test", "|I|", "", l_test, ("Obs", "Acen_th_untwinned", "Acen_th_perfect_twin")], ["CID0", "CID before Anisotropic and tNCS correction", "Z", "", cid0, ("Acen_theo", "Acen_twin", "Acen_obs", "Cen_theo", "Cen_obs")], ["CID1", "CID after Anisotropic and tNCS correction", "Z", "", cid1, ("Acen_theo", "Acen_twin", "Acen_obs", "Cen_theo", "Cen_obs")] ] e = len(l) - 2 if self.ncs_results: #If job is killed early, it will only have the before CID. if cid0: e += 1 if cid1: e += 1 if nz != "None": xtriage_plot = "" xtriage_plot += Utils.getHTMLHeader(self, "plots") xtriage_plot += "%4s$(function() {\n%6s$('.tabs').tabs();\n%4s});\n" % (3*("", )) xtriage_plot += "%4s</script>\n%2s</head>\n%2s<body>\n%4s<table>\n%6s<tr>\n" % (5*("", )) xtriage_plot += '%8s<td width="100%%">\n%10s<div class="tabs">\n%12s<ul>\n' % (3*("", )) for i in range(e): xtriage_plot += '%14s<li><a href="#tabs-44%s">%s</a></li>\n' % ("", i, l[i][0]) xtriage_plot += "%12s</ul>\n" % "" for i in range(e): xtriage_plot += '%12s<div id="tabs-44%s">\n%14s<div class=title><b>%s</b></div>\n' % ("", i, "", l[i][1]) xtriage_plot += '%14s<div id="chart%s_div3" style="width:750px;height:550px;margin-left:20;"></div>\n' % ("", i) xtriage_plot += '%14s<div class=x-label>%s</div>\n%14s<span class=y-label>%s</span>\n%12s</div>\n' % ("", l[i][2], "", l[i][3], "") xtriage_plot += "%10s</div>\n%8s</td>\n%6s</tr>\n%4s</table>\n" % (4*("", )) xtriage_plot += '%4s<script id="source" language="javascript" type="text/javascript">\n' % "" xtriage_plot += "%6s$(function () {\n" % "" s = "\n%8svar " % "" for i in range(e): l1 = [] l2 = [] label = ["%10s[\n" % ""] s1 = s for x in range(len(l[i][4][0])-1): var = "%s%s" % (l[i][0].upper(), x) s1 += "%s=[],"%var label.append('%12s{ data: %s, label:"%s" },\n' % ("", var, l[i][5][x])) for y in range(len(l[i][4])): if l[i][0] == "Anom_Signal": l2.append(float(l[i][4][y][0])) if l[i][0] in ("Intensity", "Anom_Signal"): l1.append("%8s%s.push([-%s,%s]);\n" % ("", var, l[i][4][y][0], l[i][4][y][x+1])) else: l1.append("%8s%s.push([%s,%s]);\n" % ("", var, l[i][4][y][0], l[i][4][y][x+1])) if l[i][0] == "Anom_Signal": xtriage_plot += "%s,mark=[];\n" % s1[:-1] label.append('%12s{ data: mark, label:"min level for anom signal" },\n' % "") else: xtriage_plot += "%s;\n" % s1[:-1] label.append("%10s],\n" % "") l[i].append(label) for line in l1: xtriage_plot += line if l[i][0] == "Anom_Signal": xtriage_plot += "%8sfor (var i = -%s; i < -%s; i +=0.25)\n%8smark.push([i,0.05]);\n" % ("", max(l2), min(l2), "") for i in range(e): xtriage_plot += "%8svar plot%s = $.plot($(" for line in l[i][-1]: xtriage_plot += line xtriage_plot += "%10s{ lines: { show: true},\n%12spoints: { show: true },\n" % ("", "") xtriage_plot += "%12sselection: { mode: 'xy' },\n%12sgrid: { hoverable: false, clickable: false },\n" % ("", "") if l[i][0] in ("Intensity", "Anom_Signal"): xtriage_plot += "%12sxaxis: { transform: function (v) { return Math.log(-v); },\n" % "" xtriage_plot += "%21sinverseTransform: function (v) { return Math.exp(-v); },\n" % "" xtriage_plot += "%21stickFormatter: ( function negformat(val,axis){return -val.toFixed(axis.tickDecimals);} ) },\n" % "" else: xtriage_plot += "%12sxaxis: {min:0},\n" % "" xtriage_plot += "%12syaxis: {min:0},\n%10s});\n\n" % ("", "") xtriage_plot += "%6s});\n%4s</script>\n%2s</body>\n</html>\n" % (3*("", )) if xtriage_plot: if self.gui: sp = "plots_xtriage.php" else: sp = "plots_xtriage.html" xtriage_plot_file = open(sp, "w") xtriage_plot_file.writelines(xtriage_plot) xtriage_plot_file.close() else: Utils.failedHTML(self, "plots_xtriage") except: self.logger.exception("**ERROR in AutoStats.plot_xtriage**") Utils.failedHTML(self, "plots_xtriage")
def plotXtriage(self): """ generate plots html/php file """ if self.verbose: self.logger.debug('AutoStats::plotXtriage') try: #cid0 = False #cid1 = False anom = self.xtriage_results.get('Xtriage results').get( 'Xtriage anom plot') intensity = self.xtriage_results.get('Xtriage results').get( 'Xtriage int plot') #xtriage_i = self.xtriage_results.get('Xtriage results').get('Xtriage i plot') nz = self.xtriage_results.get('Xtriage results').get( 'Xtriage nz plot') l_test = self.xtriage_results.get('Xtriage results').get( 'Xtriage l-test plot') #xtriage_z = self.xtriage_results.get('Xtriage results').get('Xtriage z plot') if self.NCS_results: cid0 = self.NCS_results.get('PhaserNCS results').get( 'CID').get('before', False) cid1 = self.NCS_results.get('PhaserNCS results').get( 'CID').get('after', False) #List of params for parsing later. l = [ [ 'Intensity', 'Mean I vs. Resolution', 'Resolution(A)', 'M e a n   I', intensity, ("< I > smooth", "< I > binning", "< I > expected") ], #['Z scores','Data Sanity and Completeness check','Resolution(A)','Z   S c o r e','z', #('Z_score','Completeness')], [ 'Anom_Signal', 'Anomalous Measurability', 'Resolution(A)', '', anom, ('Obs_anom_meas', 'Smoothed') ], #['I/sigI','Signal to Noise vs. Resolution','Resolution(A)','I / S i g I','i', #('Signal_to_Noise',)], [ 'NZ_Test', 'NZ Test', 'z', '', nz, ('Acen_obs', 'Acen_untwinned', 'Cen_obs', 'Cen_untwinned') ], [ 'L_Test', 'L-Test', '|I|', '', l_test, ('Obs', 'Acen_th_untwinned', 'Acen_th_perfect_twin') ], [ 'CID0', 'CID before Anisotropic and tNCS correction', 'Z', '', cid0, ('Acen_theo', 'Acen_twin', 'Acen_obs', 'Cen_theo', 'Cen_obs') ], [ 'CID1', 'CID after Anisotropic and tNCS correction', 'Z', '', cid1, ('Acen_theo', 'Acen_twin', 'Acen_obs', 'Cen_theo', 'Cen_obs') ] ] e = len(l) - 2 if self.NCS_results: #If job is killed early, it will only have the before CID. if cid0: e += 1 if cid1: e += 1 """ if self.NCS_results: e = len(l) else: e = len(l) - 2 """ if nz != 'None': xtriage_plot = '' xtriage_plot += Utils.getHTMLHeader(self, 'plots') xtriage_plot += "%4s$(function() {\n%6s$('.tabs').tabs();\n%4s});\n" % ( 3 * ('', )) xtriage_plot += "%4s</script>\n%2s</head>\n%2s<body>\n%4s<table>\n%6s<tr>\n" % ( 5 * ('', )) xtriage_plot += '%8s<td width="100%%">\n%10s<div class="tabs">\n%12s<ul>\n' % ( 3 * ('', )) for i in range(e): xtriage_plot += '%14s<li><a href="#tabs-44%s">%s</a></li>\n' % ( '', i, l[i][0]) xtriage_plot += "%12s</ul>\n" % '' for i in range(e): xtriage_plot += '%12s<div id="tabs-44%s">\n%14s<div class=title><b>%s</b></div>\n' % ( '', i, '', l[i][1]) xtriage_plot += '%14s<div id="chart%s_div3" style="width:750px;height:550px;margin-left:20;"></div>\n' % ( '', i) xtriage_plot += '%14s<div class=x-label>%s</div>\n%14s<span class=y-label>%s</span>\n%12s</div>\n' % ( '', l[i][2], '', l[i][3], '') xtriage_plot += "%10s</div>\n%8s</td>\n%6s</tr>\n%4s</table>\n" % ( 4 * ('', )) xtriage_plot += '%4s<script id="source" language="javascript" type="text/javascript">\n' % '' xtriage_plot += "%6s$(function () {\n" % '' s = '\n%8svar ' % '' for i in range(e): l1 = [] l2 = [] label = ['%10s[\n' % ''] s1 = s for x in range(len(l[i][4][0]) - 1): var = '%s%s' % (l[i][0].upper(), x) s1 += '%s=[],' % var label.append('%12s{ data: %s, label:"%s" },\n' % ('', var, l[i][5][x])) for y in range(len(l[i][4])): if l[i][0] == 'Anom_Signal': l2.append(float(l[i][4][y][0])) if l[i][0] in ('Intensity', 'Anom_Signal'): l1.append("%8s%s.push([-%s,%s]);\n" % ('', var, l[i][4][y][0], l[i][4][y][x + 1])) else: l1.append("%8s%s.push([%s,%s]);\n" % ('', var, l[i][4][y][0], l[i][4][y][x + 1])) if l[i][0] == 'Anom_Signal': xtriage_plot += '%s,mark=[];\n' % s1[:-1] label.append( '%12s{ data: mark, label:"min level for anom signal" },\n' % '') else: xtriage_plot += '%s;\n' % s1[:-1] label.append('%10s],\n' % '') l[i].append(label) for line in l1: xtriage_plot += line if l[i][0] == 'Anom_Signal': xtriage_plot += "%8sfor (var i = -%s; i < -%s; i +=0.25)\n%8smark.push([i,0.05]);\n" % ( '', max(l2), min(l2), '') for i in range(e): xtriage_plot += '%8svar plot%s = $.plot($("#chart%s_div3"),\n' % ( '', i, i) for line in l[i][-1]: xtriage_plot += line xtriage_plot += "%10s{ lines: { show: true},\n%12spoints: { show: true },\n" % ( '', '') xtriage_plot += "%12sselection: { mode: 'xy' },\n%12sgrid: { hoverable: false, clickable: false },\n" % ( '', '') if l[i][0] in ('Intensity', 'Anom_Signal'): xtriage_plot += "%12sxaxis: { transform: function (v) { return Math.log(-v); },\n" % '' xtriage_plot += "%21sinverseTransform: function (v) { return Math.exp(-v); },\n" % '' xtriage_plot += "%21stickFormatter: ( function negformat(val,axis){return -val.toFixed(axis.tickDecimals);} ) },\n" % '' else: xtriage_plot += "%12sxaxis: {min:0},\n" % '' xtriage_plot += "%12syaxis: {min:0},\n%10s});\n\n" % ('', '') """ xtriage_plot += "%8sfunction showTooltip(x, y, contents) {\n"%'' xtriage_plot += "%10s$('<div id=\"tooltip\">' + contents + '</div>').css( {\n"%'' xtriage_plot += "%12sposition: 'absolute',\n%12sdisplay: 'none',\n"%('','') xtriage_plot += "%12stop: y + 5,\n%12sleft: x + 5,\n%12sborder: '1px solid #fdd',\n"%(3*('',)) xtriage_plot += "%12spadding: '2px',\n%12s'background-color': '#fee',\n"%('','') xtriage_plot += '%12sopacity: 0.80\n%10s}).appendTo("body").fadeIn(200);\n'%('','') xtriage_plot += "%8s}\n%6s});\n%4s</script>\n%2s</body>\n</html>\n"%(4*('',)) """ xtriage_plot += "%6s});\n%4s</script>\n%2s</body>\n</html>\n" % ( 3 * ('', )) if xtriage_plot: if self.gui: sp = 'plots_xtriage.php' else: sp = 'plots_xtriage.html' xtriage_plot_file = open(sp, 'w') xtriage_plot_file.writelines(xtriage_plot) xtriage_plot_file.close() else: Utils.failedHTML(self, 'plots_xtriage') except: self.logger.exception('**ERROR in AutoStats.plotXtriage**') Utils.failedHTML(self, 'plots_xtriage')
def htmlSummaryXOalign(self): """ Create the html/php results file for XOalign. """ if self.verbose: self.logger.debug('RunStac::htmlSummaryXOalign') try: if self.xoalign_failed == False: if self.gui: jon_summary = open('jon_summary_xoalign.php','w') else: jon_summary = open('jon_summary_xoalign.html','w') jon_summary.write(Utils.getHTMLHeader(self,'strat')) jon_summary.write("%6s$(document).ready(function() {\n%8s$('#accordion2').accordion({\n"%('','')) jon_summary.write('%11scollapsible: true,\n%11sactive: false });\n'%('','')) if self.auto1_summary: jon_summary.write("%8s$('#xoalign-auto').dataTable({\n"%'') jon_summary.write('%11s"bPaginate": false,\n%11s"bFilter": false,\n%11s"bInfo": false,\n%11s"bAutoWidth": false });\n'%(4*('',))) if self.xoalign_summary: jon_summary.write("%8sXOalignTable = $('#xoalign').dataTable({\n"%'') jon_summary.write('%11s"bPaginate": false,\n%11s"bFilter": false,\n%11s"bInfo": false,\n%11s"bAutoWidth": false });\n'%(4*('',))) jon_summary.write('%8s//Tooltips\n'%'') jon_summary.write("%8s$('#xoalign thead th').each(function(){\n"%'') jon_summary.write("%11sif ($(this).text() == 'V1') {\n"%'') jon_summary.write("%16sthis.setAttribute('title','The crystal vector to be aligned parallel to the spindle axis');\n%11s}\n"%('','')) jon_summary.write("%11selse if ($(this).text() == 'V2') {\n"%'') jon_summary.write("%16sthis.setAttribute('title','The crystal vector describing the plane including the spindle and beam axes');\n%11s}\n%8s});\n"%(3*('',))) jon_summary.write("%8s// Handler for click events on the XOalign table\n"%'') jon_summary.write('%8s$("#xoalign tbody tr").click(function(event) {\n'%'') jon_summary.write("%11s//take highlight from other rows\n"%'') jon_summary.write("%11s$(XOalignTable.fnSettings().aoData).each(function (){\n"%'') jon_summary.write("%14s$(this.nTr).removeClass('row_selected');\n%11s});\n"%('','')) jon_summary.write("%11s//highlight the clicked row\n"%'') jon_summary.write("%11s$(event.target.parentNode).addClass('row_selected');\n%8s});\n"%('','')) jon_summary.write('%8s$("#xoalign tbody tr").dblclick(function(event) {\n'%'') jon_summary.write("%11s//Get the current data of the clicked-upon row\n"%'') jon_summary.write("%11saData = XOalignTable.fnGetData(this);\n"%'') jon_summary.write("%11s//Use the values from the line to fill the form\n"%'') jon_summary.write('%11svar omega = aData[3];\n%11svar kappa = aData[4];\n%11svar phi = aData[5];\n'%(3*('',))) jon_summary.write('%11s$.ajax({\n%16stype: "POST",\n%16surl: "d_add_minikappa.php",\n'%(3*('',))) jon_summary.write('%16sdata: { omega:omega,\n%23skappa:kappa,\n%23sphi:phi,\n'%(3*('',))) jon_summary.write('%23sip_address:my_ip,\n%23sbeamline:my_beamline }\n%11s});\n'%(3*('',))) jon_summary.write("%11s//Popup the success dialog\n"%'') jon_summary.write('%11sPopupSuccessDialog("Minikappa settings sent to beamline");\n%8s});\n'%('','')) jon_summary.write('%6s});\n%4s</script>\n\n%2s</head>\n'%(3*('',))) jon_summary.write('%2s<body id="dt_example">\n'%'') jon_summary.write('%4s<div id="container">\n%5s<div class="full_width big">\n%6s<div id="demo">\n'%(3*('',))) jon_summary.write('%7s<h1 class="results">Cell and SG summary for:</h1>\n'%'') jon_summary.write("%7s<h2 class='results'>Image: %s</h2>\n"%('',self.header.get('fullname'))) if self.header2: jon_summary.write("%7s<h2 class='results'>Image: %s</h2>\n"%('',self.header2.get('fullname'))) if self.auto1_summary: jon_summary.writelines(self.auto1_summary) jon_summary.write('%4s<div id="container">\n%5s<div class="full_width big">\n%6s<div id="demo">\n'%(3*('',))) if self.xoalign_summary: jon_summary.writelines(self.xoalign_summary) jon_summary.write('%4s<div id="container">\n%5s<div class="full_width big">\n%6s<div id="demo">\n'%(3*('',))) jon_summary.write("%7s<h1 class='Results'>XOalign Logfile</h1>\n"%'') jon_summary.write('%6s</div>\n%5s</div>\n%5s<div id="accordion2">\n'%(3*('',))) jon_summary.write('%6s<h3><a href="#">Click to view log</a></h3>\n%6s<div>\n%7s<pre>\n'%(3*('',))) jon_summary.write('\n---------------XOALIGN RESULTS---------------\n\n') if self.xoalign_log: for line in self.xoalign_log: jon_summary.write(line) else: jon_summary.write('---------------XOALIGN FAILED---------------\n') jon_summary.write('%7s</pre>\n%6s</div>\n%5s</div>\n%4s</div>\n%2s</body>\n</html>\n'%(5*('',))) jon_summary.close() else: Utils.failedHTML(self('jon_summary_stac','You MUST select a successful solution and NOT another XOalign alignment')) except: self.logger.exception('**Error in stac.htmlSummaryXOalign**')
def plotXtriage(self): """ generate plots html/php file """ if self.verbose: self.logger.debug('AutoStats::plotXtriage') try: #cid0 = False #cid1 = False anom = self.xtriage_results.get('Xtriage results').get('Xtriage anom plot') intensity = self.xtriage_results.get('Xtriage results').get('Xtriage int plot') #xtriage_i = self.xtriage_results.get('Xtriage results').get('Xtriage i plot') nz = self.xtriage_results.get('Xtriage results').get('Xtriage nz plot') l_test = self.xtriage_results.get('Xtriage results').get('Xtriage l-test plot') #xtriage_z = self.xtriage_results.get('Xtriage results').get('Xtriage z plot') if self.NCS_results: cid0 = self.NCS_results.get('PhaserNCS results').get('CID').get('before',False) cid1 = self.NCS_results.get('PhaserNCS results').get('CID').get('after',False) #List of params for parsing later. l = [['Intensity','Mean I vs. Resolution','Resolution(A)','M e a n   I',intensity, ("< I > smooth","< I > binning","< I > expected")], #['Z scores','Data Sanity and Completeness check','Resolution(A)','Z   S c o r e','z', #('Z_score','Completeness')], ['Anom_Signal','Anomalous Measurability','Resolution(A)','',anom, ('Obs_anom_meas','Smoothed')], #['I/sigI','Signal to Noise vs. Resolution','Resolution(A)','I / S i g I','i', #('Signal_to_Noise',)], ['NZ_Test','NZ Test','z','',nz,('Acen_obs','Acen_untwinned','Cen_obs','Cen_untwinned')], ['L_Test','L-Test','|I|','',l_test,('Obs','Acen_th_untwinned','Acen_th_perfect_twin')], ['CID0','CID before Anisotropic and tNCS correction','Z','',cid0, ('Acen_theo','Acen_twin','Acen_obs','Cen_theo','Cen_obs')], ['CID1','CID after Anisotropic and tNCS correction','Z','',cid1, ('Acen_theo','Acen_twin','Acen_obs','Cen_theo','Cen_obs')] ] e = len(l) - 2 if self.NCS_results: #If job is killed early, it will only have the before CID. if cid0: e += 1 if cid1: e += 1 """ if self.NCS_results: e = len(l) else: e = len(l) - 2 """ if nz != 'None': xtriage_plot = '' xtriage_plot += Utils.getHTMLHeader(self,'plots') xtriage_plot +="%4s$(function() {\n%6s$('.tabs').tabs();\n%4s});\n"%(3*('',)) xtriage_plot +="%4s</script>\n%2s</head>\n%2s<body>\n%4s<table>\n%6s<tr>\n"%(5*('',)) xtriage_plot +='%8s<td width="100%%">\n%10s<div class="tabs">\n%12s<ul>\n'%(3*('',)) for i in range(e): xtriage_plot += '%14s<li><a href="#tabs-44%s">%s</a></li>\n'%('',i,l[i][0]) xtriage_plot += "%12s</ul>\n"%'' for i in range(e): xtriage_plot += '%12s<div id="tabs-44%s">\n%14s<div class=title><b>%s</b></div>\n'%('',i,'',l[i][1]) xtriage_plot += '%14s<div id="chart%s_div3" style="width:750px;height:550px;margin-left:20;"></div>\n'%('',i) xtriage_plot += '%14s<div class=x-label>%s</div>\n%14s<span class=y-label>%s</span>\n%12s</div>\n'%('',l[i][2],'',l[i][3],'') xtriage_plot +="%10s</div>\n%8s</td>\n%6s</tr>\n%4s</table>\n"%(4*('',)) xtriage_plot += '%4s<script id="source" language="javascript" type="text/javascript">\n'%'' xtriage_plot += "%6s$(function () {\n"%'' s = '\n%8svar '%'' for i in range(e): l1 = [] l2 = [] label = ['%10s[\n'%''] s1 = s for x in range(len(l[i][4][0])-1): var = '%s%s'%(l[i][0].upper(),x) s1 += '%s=[],'%var label.append('%12s{ data: %s, label:"%s" },\n'%('',var,l[i][5][x])) for y in range(len(l[i][4])): if l[i][0] == 'Anom_Signal': l2.append(float(l[i][4][y][0])) if l[i][0] in ('Intensity','Anom_Signal'): l1.append("%8s%s.push([-%s,%s]);\n"%('',var,l[i][4][y][0],l[i][4][y][x+1])) else: l1.append("%8s%s.push([%s,%s]);\n"%('',var,l[i][4][y][0],l[i][4][y][x+1])) if l[i][0] == 'Anom_Signal': xtriage_plot += '%s,mark=[];\n'%s1[:-1] label.append('%12s{ data: mark, label:"min level for anom signal" },\n'%'') else: xtriage_plot += '%s;\n'%s1[:-1] label.append('%10s],\n'%'') l[i].append(label) for line in l1: xtriage_plot += line if l[i][0] == 'Anom_Signal': xtriage_plot += "%8sfor (var i = -%s; i < -%s; i +=0.25)\n%8smark.push([i,0.05]);\n"%('',max(l2),min(l2),'') for i in range(e): xtriage_plot += '%8svar plot%s = $.plot($("#chart%s_div3"),\n'%('',i,i) for line in l[i][-1]: xtriage_plot += line xtriage_plot += "%10s{ lines: { show: true},\n%12spoints: { show: true },\n"%('','') xtriage_plot += "%12sselection: { mode: 'xy' },\n%12sgrid: { hoverable: false, clickable: false },\n"%('','') if l[i][0] in ('Intensity','Anom_Signal'): xtriage_plot += "%12sxaxis: { transform: function (v) { return Math.log(-v); },\n"%'' xtriage_plot += "%21sinverseTransform: function (v) { return Math.exp(-v); },\n"%'' xtriage_plot += "%21stickFormatter: ( function negformat(val,axis){return -val.toFixed(axis.tickDecimals);} ) },\n"%'' else: xtriage_plot += "%12sxaxis: {min:0},\n"%'' xtriage_plot += "%12syaxis: {min:0},\n%10s});\n\n"%('','') """ xtriage_plot += "%8sfunction showTooltip(x, y, contents) {\n"%'' xtriage_plot += "%10s$('<div id=\"tooltip\">' + contents + '</div>').css( {\n"%'' xtriage_plot += "%12sposition: 'absolute',\n%12sdisplay: 'none',\n"%('','') xtriage_plot += "%12stop: y + 5,\n%12sleft: x + 5,\n%12sborder: '1px solid #fdd',\n"%(3*('',)) xtriage_plot += "%12spadding: '2px',\n%12s'background-color': '#fee',\n"%('','') xtriage_plot += '%12sopacity: 0.80\n%10s}).appendTo("body").fadeIn(200);\n'%('','') xtriage_plot += "%8s}\n%6s});\n%4s</script>\n%2s</body>\n</html>\n"%(4*('',)) """ xtriage_plot += "%6s});\n%4s</script>\n%2s</body>\n</html>\n"%(3*('',)) if xtriage_plot: if self.gui: sp = 'plots_xtriage.php' else: sp = 'plots_xtriage.html' xtriage_plot_file = open(sp,'w') xtriage_plot_file.writelines(xtriage_plot) xtriage_plot_file.close() else: Utils.failedHTML(self,'plots_xtriage') except: self.logger.exception('**ERROR in AutoStats.plotXtriage**') Utils.failedHTML(self,'plots_xtriage')