wgsHistogram.ssp 3.9 KB
Newer Older
Peter van 't Hof's avatar
Peter van 't Hof committed
1
2
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Library)
3
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
Peter van 't Hof's avatar
Peter van 't Hof committed
4
5
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb._)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._)
Peter van 't Hof's avatar
Peter van 't Hof committed
6
7
8
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(nl.lumc.sasc.biopet.pipelines.bammetrics.BammetricsReport)
#import(java.io.File)
9
10
11
<%@ var summary: SummaryDb %>
<%@ var sampleId: Option[Int] = None %>
<%@ var libId: Option[Int] = None %>
Peter van 't Hof's avatar
Peter van 't Hof committed
12
<%@ var sampleLevel: Boolean = false %>
13
<%@ var rootPath: String %>
Peter van 't Hof's avatar
Peter van 't Hof committed
14
15
16
17
<%@ var outputDir: File %>
<%@ var showPlot: Boolean = false %>
<%@ var showTable: Boolean = true %>
<%@ var showIntro: Boolean = true%>
18
19
<%@ var runId: Int %>
<%@ var fields: List[String] = List("mean_coverage", "pct_5x", "pct_10x", "pct_15x", "pct_20x", "pct_25x", "pct_30x", "pct_40x", "pct_50x", "pct_60x", "pct_70x", "pct_80x", "pct_90x", "pct_100x")%>
20
21
<%@ var allSamples: Seq[Sample] %>
<%@ var allLibraries: Seq[Library] %>
22
23
<%@ var wgsHistogramPlotTables: Option[Array[Map[String, Array[Any]]]] %>
<%@ var wgsHistogramTableResults: Map[(Int, Int), Map[String, Option[Any]]] %>
Peter van 't Hof's avatar
Peter van 't Hof committed
24
#{
25
26
27
28
    val samples = sampleId match {
    case Some(id) => allSamples.filter(_.id == id).toList
    case _ => allSamples.toList
    }
Peter van 't Hof's avatar
Peter van 't Hof committed
29
30
31
32
33
34
35
}#
#if (showIntro)
    <br/>
    <div class="row">
    <div class="col-md-1"></div>
    <div class="col-md-6">
        <p>
Sander Bollen's avatar
Sander Bollen committed
36
            Here we show the total number of positions in the reference that are covered with a given coverage. This plot is whole-genome based, and will therefore be highly skewed in the case of an exome or targeted approach.
Peter van 't Hof's avatar
Peter van 't Hof committed
37
38
39
40
41
42
        </p>
    </div>
    </div>
#end

#if (showPlot)
43
    #{ BammetricsReport.wgsHistogramPlot(outputDir, "rna", wgsHistogramPlotTables.getOrElse(Array(Map("x" -> Array(""))))) }#
Peter van 't Hof's avatar
Peter van 't Hof committed
44
45
46
47
48
49
50
51
52
53

    <div class="panel-body">
    <img src="wgs.png" class="img-responsive" />
    </div>
    <div class="panel-footer">
        #if (showTable)
            <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#wgsTable">Hide table</button>
        #else
            <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#wgsTable">Show table</button>
        #end
54
        <a href="wgs.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> Data points</button></a>
Peter van 't Hof's avatar
Peter van 't Hof committed
55
56
57
58
59
60
61
62
63
64
65
66
67
68
    </div>
#end

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

</div>