covstatsPlot.ssp 1.75 KB
Newer Older
1 2
#import(nl.lumc.sasc.biopet.utils.IoUtils)
#import(org.apache.commons.io.FileUtils)
3 4 5 6 7 8 9
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb._)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(scala.concurrent.Await)
#import(scala.concurrent.duration.Duration)
#import(nl.lumc.sasc.biopet.pipelines.bammetrics.BammetricsReport)
10
#import(java.io.File)
11 12 13
<%@ var summary: SummaryDb %>
<%@ var sampleId: Option[Int] %>
<%@ var libId: Option[Int] = None %>
14
<%@ var outputDir: File %>
Peter van 't Hof's avatar
Peter van 't Hof committed
15
<%@ var metricsTag: String = "bammetrics" %>
Peter van 't Hof's avatar
Peter van 't Hof committed
16
<%@ var target: Option[String] %>
17 18
<%@ var runId: Int %>
<%@ var fields: List[String] = List("mean", "median", "max", "horizontal", "frac_min_10x", "frac_min_20x", "frac_min_30x", "frac_min_40x", "frac_min_50x") %>
19
#{
20 21 22 23 24
    val moduleName = target.get + "_cov_stats"

    val statsPaths = fields.map(x => x -> List("coverage", "_all", x)).toMap
    val plotFile = Await.result(summary.getFile(runId, PipelineName(metricsTag), ModuleName(moduleName), sampleId.map(SampleId).get, libId.map(LibraryId).getOrElse(NoLibrary), "plot"), Duration.Inf)
    val originalPlot = new File(plotFile.get.path)
Peter van 't Hof's avatar
Peter van 't Hof committed
25
    val plot = new File(outputDir, target.get + "_cov_stats.png")
26

27
    val values = summary.getStatKeys(runId, PipelineName(metricsTag), ModuleName(moduleName), sampleId.map(SampleId).get, libId.map(LibraryId).getOrElse(NoLibrary), statsPaths)
Peter van 't Hof's avatar
Peter van 't Hof committed
28

29
    if (originalPlot.exists()) IoUtils.copyFile(originalPlot, plot)
30
}#
Peter van 't Hof's avatar
Peter van 't Hof committed
31
<img src="${plot.getName}">
Peter van 't Hof's avatar
Peter van 't Hof committed
32 33 34

<table class="table">
<thead><tr>
35 36 37
#for (field <- fields)
    <th>${field}</th>
#end
Peter van 't Hof's avatar
Peter van 't Hof committed
38 39 40
</tr></thead>
<tbody>
<tr>
41 42 43
    #for (field <- fields)
        <th>${values(field)}</th>
    #end
Peter van 't Hof's avatar
Peter van 't Hof committed
44 45 46
</tr>
</tbody>
</table>