def createResultsPage(f, parametric, uniqueName):
    samples, data = fileData(f)

    pid, pathwayName = getPathwayByFilename(f)
    print "pathway:", pathwayName

    if parametric:
        imgFilename = rootDir + pngDir + uniqueName + '_' + pid + "_p_summary.png"
    else:
        imgFilename = rootDir + pngDir + uniqueName + '_' + pid + "_np_summary.png"

    imgSize = (12, 5)
    pathwayName, entitySummary, pngFile = imgFG.createPlotFromData(
        pathwayName, imgSize, imgFilename, parametric, samples, data)
    #print "pathway:", pathwayName, entitySummary['sample']
    print "pathway:", pathwayName

    basePNG = os.path.basename(pngFile)

    page = initializePage(t=pathwayName + " -- " + uniqueName,
                          h="",
                          sort_list="[[8,1]]")
    page.img(src=pngDir + basePNG, alt="Summary Plot")
    page.p("Result table")

    putSummaryTable(p=page, b="1", data=entitySummary, id="result_table")

    fname = basePNG[:-4] + ".html"
    writePageToFile(page, rootDir + fname)

    summary = summarizePathway(samples, data, entitySummary)

    return fname, pathwayName, summary
Exemple #2
0
def createSampleListPage(path_f, parametric, uniqueName, red_label,
                         grey_label):
    samples, data = fileData(path_f)

    pid, pathwayName = getPathwayByFilename(path_f)
    print "pathway:", pathwayName

    if parametric:
        imgFilename = pngDir + uniqueName + '_' + pid + "_p_summary.png"
    else:
        imgFilename = pngDir + uniqueName + '_' + pid + "_np_summary.png"
    #print "#image file ", imgFilename, "root", rootDir, "png", pngDir

    imgSize = (12, 5)
    pathwayName, entitySummary, pngFile = imgFG.createPlotFromData(
        pathwayName, imgSize, imgFilename, parametric, samples, data,
        red_label, grey_label, class1, class2)
    basePNG = os.path.basename(pngFile)

    page, summary_tsv = initializePage(t=pathwayName + " -- " + uniqueName,
                                       h="",
                                       sort_list="[[8,1]]")
    #ipl plot at top of page
    #summary_tsv.write('<img src="%s" alt="Summary Plot"\n' % pngDir+basePNG)
    #summary_tsv.write('Result table\n')
    page.img(src=pngBase + basePNG, alt="Summary Plot")
    page.p("Result table")

    putSummaryTable(p=page,
                    b="1",
                    data=entitySummary,
                    id="result_table",
                    tsv=summary_tsv)

    fname = basePNG[:-4] + ".html"
    print "createSampleListPage"
    writePageToFile(page, rootDir + fname)

    summary = summarizePathway(samples, data, entitySummary)

    return fname, pathwayName, summary