예제 #1
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))
예제 #2
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))
예제 #3
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()
예제 #4
0
def _sampleSelector(samples):
    with h.div(class_="row-fluid"):
        with h.div(class_="span12", style="padding-top:20px"):
            with h.div(class_="pull-left"):
                h.strong("View Results")
                h.TEXT(":")
                with h.select(style="width:400px",
                              onchange="showSample(this.value)"):
                    for i, sample in enumerate(samples):
                        if i == 0:
                            h.option(sample.name(),
                                     value=sample.name(), selected="selected")
                        else:
                            h.option(sample.name(), value=sample.name())
예제 #5
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(("&nbsp;&nbsp;|"
                                                         "&nbsp;&nbsp;"))
                                        h.UNESCAPED("<a target='_blank' "
                                                    "href='%s'>"
                                                    "<i class='icon-download'>"
                                                    "</i>%s</a>" %
                                                    (rurl, descr))
                                        if index % 5 == 0:
                                            h.br()
예제 #6
0
def _sampleSelector(samples):
    with h.div(class_="row-fluid"):
        with h.div(class_="span12", style="padding-top:20px"):
            with h.div(class_="pull-left"):
                h.strong("View Results")
                h.TEXT(":")
                with h.select(style="width:400px",
                              onchange="showSample(this.value)"):
                    for i, sample in enumerate(samples):
                        if i == 0:
                            h.option(sample.name(),
                                     value=sample.name(), selected="selected")
                        else:
                            h.option(sample.name(), value=sample.name())
예제 #7
0
def _assemblyStats(sample, assembler):
    def _assemblySettingsTable():
        with h.table(class_="table table-condensed"):
            h.tr(h.th("Parameter"), h.th("Value"))
            for param, value in sample.assemblySettings(assembler).items():
                h.tr(h.td(param), h.td(value))

    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]))

    div_id = "collapseStats" + sample.name()
    with h.div(class_="accordion-group"):
        with h.div(class_="accordion-heading"):
            h.a("Assembly Statistics",
                href="#" + div_id,
                class_="accordion-toggle",
                data_toggle="collapse")
        with h.div(id=div_id, class_="accordion-body collapse in"):
            with h.div(class_="accordion-inner"):
                with h.div(class_="row-fluid", id="statPane"):
                    with h.div(class_="row-fluid"):
                        with h.div(class_="span12"):
                            if sample.name() != '.':
                                h.p("Assembly summary statistics for ",
                                    sample.name() + ".")
                            with h.div(style="padding-top:5px"):
                                _assemblySettingsTable()
                            with h.div(style="padding-top:10px"):
                                _assemblyMetricsTable("Contig")
                            if sample.hasScaffolds(assembler):
                                with h.div(style="padding-top:10px"):
                                    _assemblyMetricsTable("Scaffold")
예제 #8
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)
예제 #9
0
def _assemblyStats(sample, assembler):
    def _assemblySettingsTable():
        with h.table(class_="table table-condensed"):
            h.tr(h.th("Parameter"), h.th("Value"))
            for param, value in sample.assemblySettings(assembler).items():
                h.tr(h.td(param), h.td(value))

    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]))

    div_id = "collapseStats" + sample.name()
    with h.div(class_="accordion-group"):
        with h.div(class_="accordion-heading"):
            h.a("Assembly Statistics", href="#"+div_id,
                class_="accordion-toggle", data_toggle="collapse")
        with h.div(id=div_id, class_="accordion-body collapse in"):
            with h.div(class_="accordion-inner"):
                with h.div(class_="row-fluid", id="statPane"):
                    with h.div(class_="row-fluid"):
                        with h.div(class_="span12"):
                            if sample.name() != '.':
                                h.p("Assembly summary statistics for ",
                                    sample.name() + ".")
                            with h.div(style="padding-top:5px"):
                                _assemblySettingsTable()
                            with h.div(style="padding-top:10px"):
                                _assemblyMetricsTable("Contig")
                            if sample.hasScaffolds(assembler):
                                with h.div(style="padding-top:10px"):
                                    _assemblyMetricsTable("Scaffold")
예제 #10
0
def generateReport(samples, assembler):
    css_path = "/pluginMedia/AssemblerPlus/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/AssemblerPlus/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("AssemblerPlus 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)