Example #1
0
def _linksToDownloads(sample, assembler):
    div_id = "collapseDownload" + sample.name()
    with h.div(class_="accordion-group"):
        with h.div(class_="accordion-heading"):
            h.a("Downloads",
                href="#" + div_id,
                class_="accordion-toggle",
                data_toggle="collapse")
        with h.div(class_="accordion-body collapse in", id=div_id):
            with h.div(class_="accordion-inner"):
                with h.div(class_="row-fluid", id="downloadPane"):
                    with h.div(class_="row-fluid"):
                        with h.div(class_="span12"):
                            h.p("Download all your assembly result files.")
                            with h.div(style="padding-top:5px"):
                                with h.p():
                                    index = 0
                                    downloads = sample.downloads(assembler)
                                    for descr, url in downloads.items():
                                        rurl = os.path.relpath(url, DIRNAME)
                                        index += 1
                                        if index % 5 != 1:
                                            h.UNESCAPED(("  |"
                                                         "  "))
                                        h.UNESCAPED("<a target='_blank' "
                                                    "href='%s'>"
                                                    "<i class='icon-download'>"
                                                    "</i>%s</a>" %
                                                    (rurl, descr))
                                        if index % 5 == 0:
                                            h.br()
Example #2
0
def generateReport(samples, assembler):
    css_path = "/pluginMedia/AssemblerSPAdes/css/"
    css = [
        "kendo.common.min.css", "kendo.default.min.css", "kendo.ir.css",
        "ir.css", "app.css", "bootstrap.css", "bootstrap-custom.css",
        "bootstrap-select.css"
    ]
    less = ["app.less"]

    js_path = "/pluginMedia/AssemblerSPAdes/js/"
    js = [
        "less-1.4.1.min.js", "jquery-1.8.2.min.js", "bootstrap-select.min.js",
        "bootstrap.min.js"
    ]

    with h.html5() as root:
        with h.head():
            h.title("AssemblerSPAdes Plugin")
            h.meta(name="viewport",
                   content="width=device-width, initial-scale=1.0")
            for css_fn in css:
                h.link(href=css_path + css_fn, rel="stylesheet")
            for less_fn in less:
                h.link(href=css_path + less_fn, rel="stylesheet/less")

        with h.body():
            for js_fn in js:
                h.script('', src=js_path + js_fn)
            with h.script():
                h.UNESCAPED("function showSample(sample) { \n"
                            "  var str = sample.replace(/\./g, '\\\\.') \n"
                            "  $('div.row-fluid.sample').hide() \n"
                            "  $('div#'+str+'.row-fluid.sample').show() \n"
                            "}")
            with h.div(class_="main"):
                with h.div(class_="main-content clearfix"):
                    with h.div(class_="container-fluid"):
                        _alertAboutAssemblerWebsite(assembler)
                        if len(samples) > 1:
                            _sampleSelector(samples)
                        for i, sample in enumerate(samples):
                            display = "display:" + ("none"
                                                    if i > 0 else "block")
                            if sample._info.get('spades'):
                                with h.div(name=sample.name(),
                                           id=sample.name(),
                                           class_="row-fluid sample",
                                           style=display):
                                    with h.div(class_="span12"):
                                        with h.div(style="padding:0 19px"):
                                            _linksToDownloads(
                                                sample, assembler)
                                            with h.div(
                                                    style="padding-top:10px"):
                                                _assemblyStats(
                                                    sample, assembler)
    return str(root)
Example #3
0
def _alertAboutAssemblerWebsite(assembler):
    link = ASSEMBLER_LINKS[assembler]
    with h.div(id="alertUser", class_="row-fluid"):
        with h.div(class_="span12"):
            with h.div(class_="alert alert-info"):
                h.button("x", class_="close", data_dismiss="alert",
                         type="button")
                h.UNESCAPED(("Assemblies were performed using %s. If you have "
                            "questions on the quality of the assembly please "
                            "refer to the %s site.") % (link, link))
Example #4
0
 def _assemblyMetricsTable(kind):
     with h.table(class_="table table-condensed"):
         with h.tr():
             h.th("Metric")
             with h.th():
                 h.UNESCAPED("Large " + kind + "s (&ge; 500bp)")
             h.th("All " + kind + 's')
         for metric, value in sample.metrics(assembler, kind).items():
             if len(value) == 1:
                 h.tr(h.td(metric), h.td(value[0], colspan='2'))
             else:
                 h.tr(h.td(metric), h.td(value[0]), h.td(value[1]))