MultisampleReportBuilder.scala 1.32 KB
Newer Older
1
2
3
4
5
6
package nl.lumc.sasc.biopet.core.report

/**
 * Created by pjvan_thof on 3/30/15.
 */
trait MultisampleReportBuilder extends ReportBuilder {
Peter van 't Hof's avatar
Peter van 't Hof committed
7
  def samplePage(sampleId: String, args: Map[String, Any]): ReportPage
8

9
10
11
12
13
14
  def samplesSections: List[(String, ReportSection)] = {
    List(
      ("Samples", ReportSection("/nl/lumc/sasc/biopet/core/report/samplesList.ssp"))
    )
  }

15
  def libraryPage(sampleId:String, libraryId: String, args: Map[String, Any]): ReportPage
16

17
18
19
20
21
22
  def libririesSections: List[(String, ReportSection)] = {
    List(
      ("Libraries", ReportSection("/nl/lumc/sasc/biopet/core/report/librariesList.ssp"))
    )
  }

Peter van 't Hof's avatar
Peter van 't Hof committed
23
  def generateSamplesPage(args: Map[String, Any]): ReportPage = {
24
25
26
    val samplePages = summary.samples
      .map(sampleId => (sampleId -> samplePage(sampleId, args ++ Map("sampleId" -> Some(sampleId)))))
      .toMap
27
    ReportPage(samplePages, samplesSections, args)
28
29
  }

Peter van 't Hof's avatar
Peter van 't Hof committed
30
  def generateLibraryPage(args: Map[String, Any]): ReportPage = {
31
    val sampleId = args("sampleId") match {
32
      case Some(x) => x.toString
Peter van 't Hof's avatar
Peter van 't Hof committed
33
      case None    => throw new IllegalStateException("Sample not found")
34
35
36
37
    }

    val libPages = summary.libraries(sampleId)
      .map(libId => (libId -> libraryPage(sampleId, libId, args ++ Map("libId" -> Some(libId)))))
38
      .toMap
39
    ReportPage(libPages, libririesSections, args)
40
41
  }
}