Exemple #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()
Exemple #2
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()
Exemple #3
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")
Exemple #4
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")
Exemple #5
0
# creating nice HTML reports with summaries about multiple samples

import hypertext as h
from ordereddict import OrderedDict # TorrentServer VM has only python 2.6 :(
import locale # for printing numbers with thousands delimited by commas
import json
import os

import sys
# FIXME: hardcoded version
sys.path.append(os.path.join(os.environ['DIRNAME'], "bin", "quast-2.3"))
from libs.N50 import N50
from libs.fastaparser import get_lengths_from_fastafile, read_fasta

MIRA_LINK = str(h.a("MIRA", target="_blank",
                    href="http://mira-assembler.sourceforge.net"))

SPADES_LINK = str(h.a("SPAdes", target="_blank",
                    href="http://bioinf.spbau.ru/spades"))

ASSEMBLER_LINKS = { 'mira' : MIRA_LINK,
                    'spades' : SPADES_LINK }

DIRNAME = os.environ['TSP_FILEPATH_PLUGIN_DIR']

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",
Exemple #6
0
# creating nice HTML reports with summaries about multiple samples

import hypertext as h
from ordereddict import OrderedDict  # TorrentServer VM has only python 2.6 :(
import locale  # for printing numbers with thousands delimited by commas
import json
import os

import sys
# FIXME: hardcoded version
sys.path.append(os.path.join(os.environ['DIRNAME'], "bin", "quast-2.3"))
from libs.N50 import N50
from libs.fastaparser import get_lengths_from_fastafile, read_fasta

MIRA_LINK = str(
    h.a("MIRA", target="_blank", href="http://mira-assembler.sourceforge.net"))

SPADES_LINK = str(
    h.a("SPAdes", target="_blank", href="http://bioinf.spbau.ru/spades"))

ASSEMBLER_LINKS = {'mira': MIRA_LINK, 'spades': SPADES_LINK}

DIRNAME = os.environ['TSP_FILEPATH_PLUGIN_DIR']


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",