alignmentSummary.ssp 3.36 KB
Newer Older
1
2
#import(nl.lumc.sasc.biopet.core.summary.Summary)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
3
4
#import(nl.lumc.sasc.biopet.pipelines.bammetrics.BammetricsReport)
#import(java.io.File)
5
6
7
8
9
<%@ var summary: Summary %>
<%@ var sampleId: Option[String] = None %>
<%@ var libId: Option[String] = None %>
<%@ var sampleLevel: Boolean = false %>
<%@ var rootPath: String %>
10
11
12
<%@ var outputDir: File %>
<%@ var showPlot: Boolean = false %>
<%@ var showTable: Boolean = true %>
13
14
#{
    val samples = sampleId match {
15
16
17
18
        case Some(sample) => {
            List(sample.toString)
        }
        case _ => summary.samples.toList
19
20
    }
}#
21
22
23

#if (showPlot)
#{ BammetricsReport.alignmentSummaryPlot(outputDir, "alignmentSummary", summary, !sampleLevel, sampleId = sampleId) }#
24
25
26
27
28

    <div class="panel-body">
        <img src="alignmentSummary.png" class="img-responsive" />
    </div>
        <div class="panel-footer">
Peter van 't Hof's avatar
Peter van 't Hof committed
29
30
31
            #if (showTable)
                <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#alignmentSummaryTable">Show table</button>
            #end
32
33
            <i class="glyphicon glyphicon-file"></i> <a href="alignmentSummary.tsv">tsv file</a>
        </div>
34
35
#end
#if (showTable)
36

Peter van 't Hof's avatar
Peter van 't Hof committed
37
    <div class="panel-body collapse" id="alignmentSummaryTable">
38
39
40
    <!-- Table -->
    <table class="table sortable-theme-bootstrap" data-sortable>
        <thead><tr>
41
            <th data-sorted="true" data-sorted-direction="ascending">Sample</th>
42
43
44
45
46
47
48
49
50
51
52
            #if (!sampleLevel) <th>Library</th> #end
            <th>Total</th>
            <th>Mapped</th>
            <th>(%)</th>
            <th>Duplicates</th>
            <th>(%)</th>
        </tr></thead>
        <tbody>
            #for (sample <- samples.toList.sorted)
                #{
                    val libs = (libId, sampleLevel) match {
53
54
55
                    case (_, true) => List("")
                    case (Some(libId), _) => List(libId.toString)
                    case _ => summary.libraries(sample).toList
56
                    }
57
                }#
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
                <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")
                            val total = summary.getValue((prefixPath ::: List("biopet_flagstat", "All")):_*).getOrElse(0L).asInstanceOf[Long]
                            val mapped = summary.getValue((prefixPath ::: List("biopet_flagstat", "Mapped")):_*).getOrElse(0L).asInstanceOf[Long]
                            val duplicates = summary.getValue((prefixPath ::: List("biopet_flagstat", "Duplicates")):_*).getOrElse(0L).asInstanceOf[Long]
                        }#
                        <td>${total}</td>
                        <td>${mapped}</td>
                        <td>${mapped.toDouble / total * 100}%</td>
                        <td>${duplicates}</td>
                        <td>${duplicates.toDouble / total * 100}%</td>
                    </tr>
                #end
75
            #end
76
77
78
79
80
        </tbody>
    </table>

    </div>

81
#end