covstatsMultiTable.ssp 2.37 KB
Newer Older
1 2
#import(nl.lumc.sasc.biopet.utils.IoUtils)
#import(org.apache.commons.io.FileUtils)
3
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema._)
4 5 6 7 8 9 10
#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)
11
#import(java.io.File)
12 13
<%@ var summary: SummaryDb %>
<%@ var sampleId: Option[Int] = None %>
14
<%@ var sampleLevel: Boolean = true %>
15
<%@ var libId: Option[Int] = None %>
16
<%@ var outputDir: File %>
17
<%@ var rootPath: String %>
18
<%@ var metricsTag: String = "bammetrics" %>
19
<%@ var target: Option[String] %>
20 21
<%@ 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") %>
22 23
<%@ var allSamples: Seq[Sample] %>
<%@ var allLibraries: Seq[Library] %>
24
#{
25 26 27 28
    val samples = sampleId match {
    case Some(id) => allSamples.filter(_.id == id).toList
    case _ => allSamples.toList
    }
29 30 31
}#
<table class="table">
<thead><tr>
Peter van 't Hof's avatar
Peter van 't Hof committed
32
    <th>sample</th>
33 34 35
    #for (field <- fields)
        <th>${field}</th>
    #end
36 37
</tr></thead>
<tbody>
38
    #for (sample <- samples.sortBy(_.name))
39
        #{
40 41 42
            val libs: List[Option[Int]] = (libId, sampleLevel) match {
                case (_, true) => List(None)
                case (Some(_), _) => List(libId)
43
                case _ => allLibraries.filter(_.sampleId == sample.id).map(x => Some(x.id)).toList
44 45
            }
        }#
46
        <tr><td rowspan="${libs.size}"><a href="${rootPath}Samples/${sample.name}/index.html">${sample.name}</a></td>
47 48 49
        #for (libId <- libs)
            #if (libs.head != libId) <tr> #end
                #{
50 51 52
                    val moduleName = target.get + "_cov_stats"
                    val statsPaths = fields.map(x => x -> List("coverage", "_all", x)).toMap
                    val values = summary.getStatKeys(runId, PipelineName(metricsTag), ModuleName(moduleName), SampleId(sample.id), libId.map(LibraryId).getOrElse(NoLibrary), statsPaths)
53
                }#
54 55 56
                #for (field <- fields)
                    <th>${values(field)}</th>
                #end
57 58 59 60 61
            </tr>
        #end
    #end
</tbody>
</table>