rnaHistogram.ssp 3.7 KB
Newer Older
Peter van 't Hof's avatar
Peter van 't Hof committed
1 2 3
#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._)
4
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
Peter van 't Hof's avatar
Peter van 't Hof committed
5 6
#import(scala.concurrent.Await)
#import(scala.concurrent.duration.Duration)
7 8
#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
#{
Peter van 't Hof's avatar
Peter van 't Hof committed
22
    val samples = Await.result(summary.getSamples(runId = Some(runId)), Duration.Inf)
23 24 25 26 27 28 29 30
}#

#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
31
            This shows the relative coverage for all transcripts using Picard CollectRnaMetrics
32 33 34 35 36 37
        </p>
    </div>
    </div>
#end

#if (showPlot)
Peter van 't Hof's avatar
Peter van 't Hof committed
38
    #{ BammetricsReport.rnaHistogramPlot(outputDir, "rna", summary, !sampleLevel, sampleId = sampleId, libraryId = libId) }#
39 40

    <div class="panel-body">
Wai Yi Leung's avatar
Wai Yi Leung committed
41
        <img src="rna.png" class="img-responsive" />
42 43 44 45 46 47 48
    </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
Peter van 't Hof's avatar
Peter van 't Hof committed
49
        <a href="rna.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i>TSV file</button></a>
50 51 52 53 54 55 56 57 58 59 60 61 62 63
    </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
64
        #for (sample <- samples.sortBy(_.name))
65
            #{
Peter van 't Hof's avatar
Peter van 't Hof committed
66 67 68 69
                val libs: List[Option[Int]] = (libId, sampleLevel) match {
                case (_, true) => List(None)
                case (Some(_), _) => List(libId)
                case _ => Await.result(summary.getLibraries(sampleId = Some(sample.id), runId = Some(runId)), Duration.Inf).map(x => Some(x.id)).toList
70 71 72 73
                }
            }#
            <tr><td rowspan="${libs.size}"><a href="${rootPath}Samples/${sample}/index.html">${sample}</a></td>
            #for (libId <- libs)
Peter van 't Hof's avatar
Peter van 't Hof committed
74
                #{ val libName = libId.map(l => Await.result(summary.getLibraryName(l), Duration.Inf)) }#
75
                #if (libs.head != libId) <tr> #end
Peter van 't Hof's avatar
Peter van 't Hof committed
76
                    #if (!sampleLevel) <td><a href="${rootPath}Samples/${sample.name}/Libraries/${libName}/index.html">${libName}</a></td> #end
77
                    #{
Peter van 't Hof's avatar
Peter van 't Hof committed
78 79
                        val statsPaths = fields.map(x => x -> List("metrics", x.toUpperCase)).toMap
                        val results = summary.getStatKeys(runId, "bammetrics", "wgs", sample = sample.id, library = libId.map(LibraryId).getOrElse(NoLibrary), keyValues = statsPaths)
80
                    }#
Peter van 't Hof's avatar
Peter van 't Hof committed
81 82
                    #for (field <- fields)
                        <td>${results(field)}</td>
83 84 85 86 87 88 89 90
                    #end
                </tr>
            #end
        #end
    </tbody>
</table>

</div>