insertSize.ssp 3.07 KB
Newer Older
Peter van 't Hof's avatar
Peter van 't Hof committed
1
2
#import(nl.lumc.sasc.biopet.core.summary.Summary)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
3
#import(nl.lumc.sasc.biopet.pipelines.bammetrics.BammetricsReport)
Peter van 't Hof's avatar
Peter van 't Hof committed
4
5
6
#import(java.io.File)
#import(org.apache.commons.io.FileUtils)
<%@ var summary: Summary %>
7
<%@ var sampleId: Option[String] = None %>
Peter van 't Hof's avatar
Peter van 't Hof committed
8
9
10
<%@ var libId: Option[String] = None %>
<%@ var rootPath: String %>
<%@ var metricsTag: String = "bammetrics" %>
11
<%@ var sampleLevel: Boolean = false %>
Peter van 't Hof's avatar
Peter van 't Hof committed
12
13
<%@ var outputDir: File %>
<%@ var fields: List[String] = List("mean_insert_size", "standard_deviation", "median_insert_size")%>
14
15
<%@ var showPlot: Boolean = false %>
<%@ var showTable: Boolean = true %>
Peter van 't Hof's avatar
Peter van 't Hof committed
16
#{
17
18
19
20
21
    val samples = sampleId match {
    case Some(sample) => {
    List(sample.toString)
    }
    case _ => summary.samples.toList
Peter van 't Hof's avatar
Peter van 't Hof committed
22
23
24
    }
}#

25
26
27
28
29
30
31
#if (showPlot)
    #{ BammetricsReport.insertSizePlot(outputDir, "insertsize", summary, !sampleLevel, sampleId = sampleId) }#

    <div class="panel-body">
    <img src="insertsize.png" class="img-responsive" />
    </div>
    <div class="panel-footer">
Peter van 't Hof's avatar
Peter van 't Hof committed
32
33
34
35
        #if (showTable)
            <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#insertsizeTable">Show table</button>
        #end
        <i class="glyphicon glyphicon-file"></i> <a href="insertsize.tsv">tsv file</a>
36
37
38
    </div>
#end
#if (showTable)
Peter van 't Hof's avatar
Peter van 't Hof committed
39
    <div class="panel-body collapse" id="insertsizeTable">
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
    <!-- 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}</th>
            #end
        </tr></thead>
        <tbody>
            #for (sample <- samples.toList.sorted)
                #{
                    val libs = (libId, sampleLevel) match {
                    case (_, true) => List("")
                    case (Some(libId), _) => List(libId.toString)
                    case _ => summary.libraries(sample).toList
                    }
                }#
                <tr><td rowspan="${libs.size}"><a href="${rootPath}Samples/${sample}/index.html">${sample}</a></td>
                #for (libId <- libs)
                    #if (libs.head != libId) <tr> #end
                        #if (!sampleLevel) <td><a href="${rootPath}Samples/${sample}/Libraries/${libId}/index.html">${libId}</a></td> #end
                        #{
                            val prefixPath = List("samples", sample) ::: (if (libId.isEmpty) Nil else List("libraries", libId)) ::: List("bammetrics", "stats")
Peter van 't Hof's avatar
Peter van 't Hof committed
64

65
66
67
68
69
70
71
72
73
                            val fieldValues = for (field <- fields) yield {
                                summary.getValue((prefixPath ::: List(metricsTag, "stats", "insert_size_metrics", field)):_*)
                            }
                        }#
                        #for (value <- fieldValues)
                            <td>${value}</td>
                        #end
                    </tr>
                #end
Peter van 't Hof's avatar
Peter van 't Hof committed
74
            #end
75
76
77
78
79
80
81
        </tbody>
    </table>

    </div>

#end