sampleVariantsSv.ssp 3.52 KB
Newer Older
akaljuvee's avatar
akaljuvee committed
1
2
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
3
#import(java.io.File)
akaljuvee's avatar
akaljuvee committed
4
5
<%@ var summary: SummaryDb %>
<%@ var allSamples: Seq[Sample]%>
6
7
<%@ var rootPath: String %>
<%@ var outputDir: File %>
akaljuvee's avatar
akaljuvee committed
8
9
<%@ var runId: Int %>
<%@ var sampleId: Option[Int] = None %>
10
11
12
13
14
<%@ var showPlot: Boolean = false %>
<%@ var showTable: Boolean = true %>
<%@ var showIntro: Boolean = true %>

#{
akaljuvee's avatar
akaljuvee committed
15
16
17
    val sampleNames: Seq[String] = sampleId match {
       case Some(sampleId) => Seq(allSamples.filter(s => s.id == sampleId).head.name)
       case _ => allSamples.collect({case s: Sample => s.name}).sorted
18
    }
akaljuvee's avatar
akaljuvee committed
19

akaljuvee's avatar
akaljuvee committed
20
21
    val counts: Map[String, Map[String, Array[Long]]] = ShivaSvCallingReport.parseSummaryForSvCounts(summary, runId, sampleNames)
    val traCounts: Map[String, Long] = ShivaSvCallingReport.parseSummaryForTranslocations(summary, runId, sampleNames)
akaljuvee's avatar
akaljuvee committed
22

23
24
25
26
27
28
29
30
31
    var svTypes = List(
    SvTypeForReport("DEL", "Deletions", "svSummaryDeletions.tsv", "svSummaryDeletions.png"),
    SvTypeForReport("DUP", "Duplications", "svSummaryDuplications.tsv", "svSummaryDuplications.png"),
    SvTypeForReport("INS", "Insertions", "svSummaryInsertions.tsv", "svSummaryInsertions.png"),
    SvTypeForReport("INV", "Inversions", "svSummaryInversions.tsv", "svSummaryInversions.png"))
    svTypes = svTypes.filter(sv => counts.contains(sv.svType))
    val tsvAllTypes = "svSummary.tsv"

    ShivaSvCallingReport.writeTsvFiles(sampleNames, counts, svTypes, tsvAllTypes, outputDir)
akaljuvee's avatar
akaljuvee committed
32
    ShivaSvCallingReport.createPlots(svTypes, outputDir)
33
34
35
36
37
}#


#if (showPlot)
    <div class="panel-body">
38
39
40
    #for (sv <- svTypes)
        <img src="${sv.pngFileName}" />
    #end
41
    </div>
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
    #if (traCounts.nonEmpty)
        <div class="panel-body">
        <h5>Number of translocation events detected:</h5>
        <table class="table table-condensed" style="width:auto">
            <thead><tr>
            #for (sampleName <- sampleNames)
                <th>${sampleName}</th>
            #end
            </tr></thead>
            <tbody><tr>
            #for (sampleName <- sampleNames)
                <td>${traCounts.get(sampleName).get}</td>
            #end
            </tr></tbody>
        </table>
        </div>
    #end
59
    <div class="panel-footer">
akaljuvee's avatar
akaljuvee committed
60
61
        <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#svSummaryTable">
            #if (showTable)
62
                <i class="glyphicon glyphicon-eye-close"></i> Hide tables
akaljuvee's avatar
akaljuvee committed
63
            #else
64
                <i class="glyphicon glyphicon-eye-open"></i> Show tables
akaljuvee's avatar
akaljuvee committed
65
66
67
            #end
        </button>
        <a href="${tsvAllTypes}"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> TSV file</button></a>
68
69
70
71
72
    </div>
#end

<div class="panel-body collapse #if (showTable)in#end" id="svSummaryTable">

73
74
#for (sv <- svTypes)
#{
akaljuvee's avatar
akaljuvee committed
75
    val countsForSvType: Map[String, Array[Long]] = counts.get(sv.svType).get
76
77
}#
<h3>${sv.displayText}</h3>
78
79
<table class="table sortable-theme-bootstrap" data-sortable>
    <thead><tr><th data-sorted="true" data-sorted-direction="ascending">Sample</th>
80
81
82
        #for (text <- ShivaSvCallingReport.histogramText)
            <th>${text}</th>
         #end
83
84
    </tr></thead>
    <tbody>
85
86
87
88
89
        #for (sampleName <- sampleNames)
            <tr>
            <td><a href="${rootPath}Samples/${sampleName}/index.html">${sampleName}</a></td>
            #for (countForSize <- countsForSvType.get(sampleName).get)
                <td>${countForSize}</td>
90
            #end
91
            </tr>
92
93
94
        #end
    </tbody>
</table>
95
96

#end
97
</div>