flexiprepBaseSummary.ssp 5.02 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 %>
Peter van 't Hof's avatar
Peter van 't Hof committed
12
<%@ var showIntro: Boolean = true %>
Peter van 't Hof's avatar
Peter van 't Hof committed
13
<%@ var multisample: Boolean = true %>
14 15 16 17 18 19
#{
    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
20 21 22 23 24 25 26 27 28 29 30
#if (showIntro)
    <br/>
    <div class="row">
    <div class="col-md-1"></div>
    <div class="col-md-6">
        <p>
            Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc risus est, volutpat quis enim sit amet, lacinia posuere ante. Mauris eget massa efficitur, luctus nisl ut, placerat nibh. Pellentesque id nulla maximus, rutrum dui nec, lobortis odio. Fusce eu enim ac sem auctor congue. Ut ac ullamcorper quam, eget sollicitudin felis. Maecenas posuere sagittis blandit. Proin mollis magna lectus, id gravida est consectetur vitae. Nulla id risus at tellus laoreet finibus in id lacus. Duis lobortis commodo nisl viverra tempor. Curabitur sit amet pretium dui, sit amet tincidunt mauris. Duis volutpat eu purus ut molestie.
        </p>
    </div>
    </div>
#end
31 32 33 34 35
#if (showPlot)
    #{
        FlexiprepReport.baseSummaryPlot(outputDir, "QC_Bases_R1","R1", summary, sampleId = sampleId)
        FlexiprepReport.baseSummaryPlot(outputDir, "QC_Bases_R2","R2", summary, sampleId = sampleId)
    }#
36 37 38 39 40 41 42 43 44 45 46 47
    <div class="panel-body">
        <div class="row">
            <div class="col-sm-6 col-md-6">
                <img src="QC_Bases_R1.png" class="img-responsive" />
            </div>
            <div class="col-sm-6 col-md-6">
                <img src="QC_Bases_R2.png" class="img-responsive" />
            </div>
        </div>

    </div>
    <div class="panel-footer">
Peter van 't Hof's avatar
Peter van 't Hof committed
48
        #if (showTable)
Peter van 't Hof's avatar
Peter van 't Hof committed
49 50
            <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#QC_BasesTable">Hide table</button>
        #else
Peter van 't Hof's avatar
Peter van 't Hof committed
51 52
            <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#QC_BasesTable">Show table</button>
        #end
53 54 55
        <i class="glyphicon glyphicon-file"></i> <a href="QC_Bases_R1.tsv">R1 reads stats</a> -
        <i class="glyphicon glyphicon-file"></i> <a href="QC_Bases_R2.tsv">R2 reads stats</a>
    </div>
56
#end
57

Peter van 't Hof's avatar
Peter van 't Hof committed
58
<div class="panel-body collapse #if (showTable)in#end" id="QC_BasesTable">
59

Peter van 't Hof's avatar
Peter van 't Hof committed
60
<!-- Table -->
Peter van 't Hof's avatar
Peter van 't Hof committed
61
<table class="table sortable-theme-bootstrap">
62

Peter van 't Hof's avatar
Peter van 't Hof committed
63
    <thead><tr>
Peter van 't Hof's avatar
Peter van 't Hof committed
64
        <th>Sample</th>
Peter van 't Hof's avatar
Peter van 't Hof committed
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
        <th colspan="2">Library</th>
        <th>Before QC</th>
        <th>Discarded</th>
        <th>(%)</th>
        <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)
                }
            }#
Peter van 't Hof's avatar
Peter van 't Hof committed
84 85 86 87 88 89 90
            <tr><td rowspan="${sampleRowspan}">
            #if (multisample)
                <a href="${rootPath}Samples/${sample}/index.html">${sample}</a>
            #else
                ${sample}
            #end
            </td>
Peter van 't Hof's avatar
Peter van 't Hof committed
91 92 93
            #for (libId <- libs)
                #if (libs.head != libId) <tr> #end
                    #{ val paired = summary.getLibraryValue(sample, libId, "flexiprep", "settings", "paired").getOrElse(false) }#
Peter van 't Hof's avatar
Peter van 't Hof committed
94 95 96 97 98 99 100
                    <td #if (paired == true) rowspan="2" #end>
                    #if (multisample)
                        <a href="${rootPath}Samples/${sample}/Libraries/${libId}/index.html">${libId}</a>
                    #else
                        ${libId}
                    #end
                    </td>
Peter van 't Hof's avatar
Peter van 't Hof committed
101 102 103 104 105 106 107 108 109 110 111 112 113 114
                    #{ 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>
115
            #end
Peter van 't Hof's avatar
Peter van 't Hof committed
116 117 118
        #end
    </tbody>
</table>
119

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