flexiprepBaseSummary.ssp 2.96 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.flexiprep.FlexiprepReport)
#import(java.io.File)
5
6
7
<%@ var summary: Summary %>
<%@ var sampleId: Option[String] = None %>
<%@ var libId: Option[String] = None %>
8
<%@ var rootPath: String %>
9
10
11
<%@ var outputDir: File %>
<%@ var showPlot: Boolean = false %>
<%@ var showTable: Boolean = true %>
12
13
14
15
16
17
#{
    val samples = sampleId match {
        case Some(sample) => List(sample.toString)
        case _ => summary.samples.toList
    }
}#
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#if (showPlot)
    #{
        FlexiprepReport.baseSummaryPlot(outputDir, "QC_Bases_R1","R1", summary, sampleId = sampleId)
        FlexiprepReport.baseSummaryPlot(outputDir, "QC_Bases_R2","R2", summary, sampleId = sampleId)
    }#
    <table>
        <tr><th>R1</th><th>R2</th></tr>
        <tr>
            <td><img src="QC_Bases_R1.png"><br><a href="QC_Bases_R1.tsv">Tsv file</a></td>
            <td><img src="QC_Bases_R2.png"><br><a href="QC_Bases_R2.tsv">Tsv file</a></td>
        </tr>
    </table>
#end
#if (showTable)
32
33
34
35
36
<table>
<thead><tr>
    <th>Sample</th>
    <th colspan="2">Library</th>
    <th>Before QC</th>
37
38
    <th>Discarded</th>
    <th>(%)</th>
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
    <th>After QC</th>
</tr></thead>
<tbody>
    #for (sample <- samples.toList.sorted)
        #{
            val libs = libId match {
                case Some(libId) => List(libId.toString)
                case _ => summary.libraries(sample).toList
            }

            val sampleRowspan = {
                libs.size +
                libs.count(summary.getLibraryValue(sample, _, "flexiprep", "settings", "paired").getOrElse(false) == true)
            }
        }#
54
        <tr><td rowspan="${sampleRowspan}"><a href="${rootPath}Samples/${sample}/index.html">${sample}</a></td>
55
56
57
        #for (libId <- libs)
            #if (libs.head != libId) <tr> #end
            #{ val paired = summary.getLibraryValue(sample, libId, "flexiprep", "settings", "paired").getOrElse(false) }#
58
            <td #if (paired == true) rowspan="2" #end><a href="${rootPath}Samples/${sample}/Libraries/${libId}/index.html">${libId}</a></td>
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
            #{ val reads = if (paired == true) List("R1", "R2") else List("R1") }#
            #for (read <- reads)
                #if (read == "R2") </tr><tr> #end
            #{
                    val beforeTotal = summary.getLibraryValue(sample, libId, "flexiprep", "stats", "seqstat_" + read, "bases", "num_total").getOrElse(0).asInstanceOf[Long]
                    val afterTotal = summary.getLibraryValue(sample, libId, "flexiprep", "stats", "seqstat_" + read + "_after", "bases", "num_total").getOrElse(0).asInstanceOf[Long]
            }#
                <td>${read}</td>
                <td>${beforeTotal}</td>
                <td>${beforeTotal - afterTotal}</td>
                <td>${(beforeTotal - afterTotal).toDouble / beforeTotal * 100}%</td>
                <td>${afterTotal}</td>
            #end
            </tr>
        #end
    #end
</tbody>
76
77
</table>
#end