def create_html(dataset, output_di, config): import paplot.subcode.tools as tools import paplot.prep as prep import os chart_txt = "" js_txt = "" for i in range(len(dataset["plots"])): js_txt += html_js_template.format(i=str(i), chart_id=dataset["plots"][i]) if dataset["plots"][i] == "chart_brush": chart_txt += '<p class="muted pull-left" style="margin-right: 15px;">Select a range to zoom in</p>\n' js_txt += html_js_brushed_template.format(i=str(i)) chart_txt += html_chart_template.format(chart_id=dataset["plots"][i]) f_template = open(os.path.dirname(os.path.abspath(__file__)) + "/templates/graph_qc.html") html_template = f_template.read() f_template.close() f_html = open(output_di["dir"] + "/" + output_di["html"], "w") f_html.write( html_template.format(project=output_di["project"], title=output_di["title"], data_js=output_di["js"], version=prep.version_text(), date=tools.now_string(), charts=chart_txt, js_add_div=js_txt, style="../style/%s" % os.path.basename(tools.config_getpath(config, "style", "path", "default.js")), )) f_html.close()
def create_html(dataset, params, config): import os import paplot.subcode.tools as tools import paplot.prep as prep html_div_template = "<div style='float: left;' id='div_pm{id}'></div>\n" html_add_template = "msig_draw.add_div('div_pm{id}');\n" div_text = "" add_text = "" for i in range(dataset["sig_num"]): div_text += html_div_template.format(id=i) add_text += html_add_template.format(id=i) integral_text = "" if dataset["intergral"] is True: integral_text = html_integral_template f_template = open( os.path.dirname(os.path.abspath(__file__)) + "/templates/graph_pmsignature.html") html_template = f_template.read() f_template.close() sig_num_sift = 0 if tools.config_getboolean(config, "result_format_pmsignature", "background"): sig_num_sift = 1 f_html = open(params["dir"] + "/" + dataset["html"], "w") f_html.write( html_template.format( project=params["project"], title="%s(#sig %d)" % (params["title"], dataset["sig_num"] + sig_num_sift), data_js=dataset["js"], version=prep.version_text(), date=tools.now_string(), divs=div_text, add_divs=add_text, integral=integral_text, style="../style/%s" % os.path.basename( tools.config_getpath(config, "style", "path", "default.js")), )) f_html.close()
def create_html(dataset, output_di, config): import os import paplot.subcode.tools as tools import paplot.prep as prep sub1_text = "" sub2_text = "" set_sub_add_text = "" set_sub_select_text = "" for i in range(len(dataset["subdata"])): sub_text = subplot_template.format( i=i, title=dataset["subdata"][i]["title"]) if dataset["subdata"][i]["pos"] == 1: sub1_text += sub_text set_sub_add_text += js_set_sub_add.format(i=i, type=1) else: sub2_text += sub_text set_sub_add_text += js_set_sub_add.format(i=i, type=2) set_sub_select_text += js_set_sub_select.format(i=i) f_template = open( os.path.dirname(os.path.abspath(__file__)) + "/templates/graph_mutation.html") html_template = f_template.read() f_template.close() f_html = open(output_di["dir"] + "/" + output_di["html"], "w") f_html.write( html_template.format( project=output_di["project"], title=output_di["title"], data_js=output_di["js"], version=prep.version_text(), date=tools.now_string(), sub1=sub1_text, sub2=sub2_text, set_sub_add=set_sub_add_text, set_sub_select=set_sub_select_text, style="../style/%s" % os.path.basename( tools.config_getpath(config, "style", "path", "default.js")), )) f_html.close()
def create_html(dataset, output_di, config): import os import paplot.prep as prep div_txt = "" call_txt = "" detail_txt = "" for i in range(len(dataset["id_list"])): div_txt += li_template.format(id=str(i), title=dataset["id_list"][i]) detail_txt += detail_template.format(id=str(i), title=dataset["id_list"][i]) call_txt += call_template.format(id=str(i), title=dataset["id_list"][i]) # if i >= 50: # if i == 50: # call_txt += call_later_header # call_txt += call_later_template.format(id = str(i), title = dataset["id_list"][i]) # else: # call_txt += call_template.format(id = str(i), title = dataset["id_list"][i]) f_template = open( os.path.dirname(os.path.abspath(__file__)) + "/templates/graph_ca.html") html_template = f_template.read() f_template.close() f_html = open(output_di["dir"] + "/" + output_di["html"], "w") f_html.write( html_template.format( project=output_di["project"], title=output_di["title"], data_js=output_di["js"], version=prep.version_text(), date=tools.now_string(), div_list=div_txt, call_list=call_txt, details=detail_txt, style="../style/%s" % os.path.basename( tools.config_getpath(config, "style", "path", "default.js")), )) f_html.close()
def create_html(dataset, output_di, config): """ Create HTML file for CA Parameters ---------- dataset: dict: {"id_list" : [id column values], "group_list": [group names], "color" : [group colors]} output_di: dict: {"dir" : project directory full path, "data" : filenames for formatted data "js" : JavaScript file name "html" : HTML file name "project": Project name given by user on command line "title" : Report title. The default is "CA graphs"} config: configparser.RawConfigParser Return ------ None """ import os import paplot.prep as prep import paplot.subcode.tools as tools # Create strings of thumbnails to embed in HTML div_txt = "" call_txt = "" detail_txt = "" for i in range(len(dataset["id_list"])): div_txt += li_template.format(id=str(i), title=dataset["id_list"][i]) # Rough thumbnail detail_txt += detail_template.format(id=str(i), title=dataset["id_list"][i]) # Detailed thumbnail call_txt += call_template.format(id=str(i), title=dataset["id_list"][i]) # Drawing rough thumbnail # if i >= 50: # if i == 50: # call_txt += call_later_header # call_txt += call_later_template.format(id = str(i), title = dataset["id_list"][i]) # else: # call_txt += call_template.format(id = str(i), title = dataset["id_list"][i]) # Overlay overlay_txt = overlay_template.format(id=str(len(dataset["id_list"]))) # Get HTML template f_template = open(os.path.dirname(os.path.abspath(__file__)) + "/templates/graph_ca.html") # ./templates/graph_ca.html html_template = f_template.read() f_template.close() # Create HTML file f_html = open(output_di["dir"] + "/" + output_di["html"], "w") # Create a file under the project directory f_html.write( html_template.format( project=output_di["project"], # Project name title=output_di["title"], # Report title data_js=output_di["js"], # JavaScript file version=prep.version_text(), # Paplot version date=tools.now_string(), # Cuurent time div_list=div_txt, # Rough thumbnail details=detail_txt, # Detailed thumbnail overlay=overlay_txt, # Overlay thumbnail call_list=call_txt, # Drawing rough thumbnail style="../style/%s" % os.path.basename(tools.config_getpath(config, "style", "path", "default.js")), # ./style/default.js )) f_html.close()