rnaHistogram.ssp 3.76 KB
Newer Older
1 2
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Library)
Peter van 't Hof's avatar
Peter van 't Hof committed
3 4 5
#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._)
6 7 8
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(nl.lumc.sasc.biopet.pipelines.bammetrics.BammetricsReport)
#import(java.io.File)
Peter van 't Hof's avatar
Peter van 't Hof committed
9 10 11
<%@ var summary: SummaryDb %>
<%@ var sampleId: Option[Int] = None %>
<%@ var libId: Option[Int] = None %>
12 13 14 15
<%@ var rootPath: String %>
<%@ var metricsTag: String = "bammetrics" %>
<%@ var sampleLevel: Boolean = false %>
<%@ var outputDir: File %>
Peter van 't Hof's avatar
Peter van 't Hof committed
16
<%@ var fields: List[String] = List("PF_ALIGNED_BASES", "MEDIAN_5PRIME_BIAS", "MEDIAN_3PRIME_BIAS", "MEDIAN_5PRIME_TO_3PRIME_BIAS")%>
17 18 19
<%@ var showPlot: Boolean = false %>
<%@ var showTable: Boolean = true %>
<%@ var showIntro: Boolean = true%>
Peter van 't Hof's avatar
Peter van 't Hof committed
20
<%@ var runId: Int %>
21 22
<%@ var allSamples: Seq[Sample] %>
<%@ var allLibraries: Seq[Library] %>
23 24
<%@ var rnaHistogramPlotTables: Option[Array[Map[String, Array[Any]]]] %>
<%@ var rnaHistogramTableResults: Map[(Int, Int), Map[String, Option[Any]]] %>
25
#{
26 27 28 29
    val samples = sampleId match {
    case Some(id) => allSamples.filter(_.id == id).toList
    case _ => allSamples.toList
    }
30 31 32 33 34 35 36
}#
#if (showIntro)
    <br/>
    <div class="row">
    <div class="col-md-1"></div>
    <div class="col-md-6">
        <p>
Wai Yi Leung's avatar
Wai Yi Leung committed
37
            This shows the relative coverage for all transcripts using Picard CollectRnaMetrics
38 39 40 41 42 43
        </p>
    </div>
    </div>
#end

#if (showPlot)
44
    #{ BammetricsReport.rnaHistogramPlot(outputDir, "rna", rnaHistogramPlotTables.getOrElse(Array(Map("x" -> Array(""))))) }#
45 46

    <div class="panel-body">
Wai Yi Leung's avatar
Wai Yi Leung committed
47
        <img src="rna.png" class="img-responsive" />
48 49 50 51 52 53 54
    </div>
    <div class="panel-footer">
        #if (showTable)
            <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#rnaTable">Hide table</button>
        #else
            <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#rnaTable">Show table</button>
        #end
55
        <a href="rna.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> Data points</button></a>
56 57 58 59 60 61 62 63 64 65 66 67 68 69
    </div>
#end

<div class="panel-body collapse #if (showTable)in#end" id="rnaTable">
<!-- Table -->
<table class="table sortable-theme-bootstrap" data-sortable>
    <thead><tr>
        <th data-sorted="true" data-sorted-direction="ascending">Sample</th>
        #if (!sampleLevel) <th>Library</th> #end
        #for (field <- fields)
            <th>${field.replaceAll("_", " ")}</th>
        #end
    </tr></thead>
    <tbody>
Peter van 't Hof's avatar
Peter van 't Hof committed
70
        #for (sample <- samples.sortBy(_.name))
71
            #{
Peter van 't Hof's avatar
Peter van 't Hof committed
72 73 74
                val libs: List[Option[Int]] = (libId, sampleLevel) match {
                case (_, true) => List(None)
                case (Some(_), _) => List(libId)
75
                case _ => allLibraries.filter(_.sampleId == sample.id).map(x => Some(x.id)).toList
76 77
                }
            }#
78
            <tr><td rowspan="${libs.size}"><a href="${rootPath}Samples/${sample.name}/index.html">${sample.name}</a></td>
79
            #for (libId <- libs)
80
                #{ val libName = libId.map(l => allLibraries.find(_.id == l).get.name) }#
81
                #if (libs.head != libId) <tr> #end
Peter van 't Hof's avatar
Peter van 't Hof committed
82
                    #if (!sampleLevel) <td><a href="${rootPath}Samples/${sample.name}/Libraries/${libName}/index.html">${libName}</a></td> #end
83
                    #{
84
                          val results = rnaHistogramTableResults((sample.id,libId.get))
85
                    }#
Peter van 't Hof's avatar
Peter van 't Hof committed
86 87
                    #for (field <- fields)
                        <td>${results(field)}</td>
88 89 90 91 92 93 94 95
                    #end
                </tr>
            #end
        #end
    </tbody>
</table>

</div>