insertSize.ssp 4.29 KB
Newer Older
1
#import(nl.lumc.sasc.biopet.utils.summary.Summary)
Peter van 't Hof's avatar
Peter van 't Hof committed
2
#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
<%@ var showIntro: Boolean = true%>
Peter van 't Hof's avatar
Peter van 't Hof committed
17
#{
18
19
20
21
22
    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
23
24
25
    }
}#

Peter van 't Hof's avatar
Peter van 't Hof committed
26
27
28
29
30
31
#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
32
        #if (sampleId.isDefined && libId.isDefined)
Wai Yi Leung's avatar
Wai Yi Leung committed
33
            This plot shows the insert size distribution for all libraries combined in sample <b>${sampleId}</b>.
Sander Bollen's avatar
Sander Bollen committed
34
        #elseif(sampleId.isDefined)
Wai Yi Leung's avatar
Wai Yi Leung committed
35
            This plot shows the insert size distribution for the libraries of sample <b>${sampleId}</b>.
Sander Bollen's avatar
Sander Bollen committed
36
        #else
Wai Yi Leung's avatar
Wai Yi Leung committed
37
            This plot shows the insert size distribution for each of the <b>${samples.size}</b> samples.
Sander Bollen's avatar
Sander Bollen committed
38
        #end
Wai Yi Leung's avatar
Wai Yi Leung committed
39
        <a href="http://thegenomefactory.blogspot.nl/2013/08/paired-end-read-confusion-library.html">Insert size</a> denotes the size of the so-called <em>insert</em> between two read pairs in a paired-end sequencing run. This should correspond to the length of the sequence between the sequencing adaptors. The provided table shows mean and median insert size for each sample, together with the standard deviation.
Peter van 't Hof's avatar
Peter van 't Hof committed
40
41
42
43
44
        </p>
    </div>
    </div>
#end

45
#if (showPlot)
Peter van 't Hof's avatar
Peter van 't Hof committed
46
    #{ BammetricsReport.insertSizePlot(outputDir, "insertsize", summary, !sampleLevel, sampleId = sampleId, libraryId = libId) }#
47
48
49
50
51

    <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
52
        #if (showTable)
53
            <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#insertsizeTable">
Peter van 't Hof's avatar
Peter van 't Hof committed
54
                <i class="glyphicon glyphicon-eye-close"></i>Hide table</button>
Peter van 't Hof's avatar
Peter van 't Hof committed
55
        #else
56
            <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#insertsizeTable">
Peter van 't Hof's avatar
Peter van 't Hof committed
57
            <i class="glyphicon glyphicon-eye-open"></i>Show table</button>
Peter van 't Hof's avatar
Peter van 't Hof committed
58
        #end
Peter van 't Hof's avatar
Peter van 't Hof committed
59
      <a href="insertsize.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i>TSV file</button></a>
60

61
62
63
    </div>
#end

Peter van 't Hof's avatar
Peter van 't Hof committed
64
65
<div class="panel-body collapse #if (showTable)in#end" id="insertsizeTable">
<!-- Table -->
66
<table class="table">
Peter van 't Hof's avatar
Peter van 't Hof committed
67
68
69
70
    <thead><tr>
        <th data-sorted="true" data-sorted-direction="ascending">Sample</th>
        #if (!sampleLevel) <th>Library</th> #end
        #for (field <- fields)
Peter van 't Hof's avatar
Peter van 't Hof committed
71
            <th>${field.replaceAll("_", " ")}</th>
Peter van 't Hof's avatar
Peter van 't Hof committed
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
        #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")
89

Peter van 't Hof's avatar
Peter van 't Hof committed
90
                        val fieldValues = for (field <- fields) yield {
91
                            summary.getValue((prefixPath ::: List("CollectInsertSizeMetrics", "metrics", field.toUpperCase)):_*).getOrElse("N/A")
Peter van 't Hof's avatar
Peter van 't Hof committed
92
93
94
95
96
97
98
99
100
101
                        }
                    }#
                    #for (value <- fieldValues)
                        <td>${value}</td>
                    #end
                </tr>
            #end
        #end
    </tbody>
</table>
102

Peter van 't Hof's avatar
Peter van 't Hof committed
103
</div>