flexiprepReadSummary.ssp 4.52 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

#if (showPlot)
    #{
        FlexiprepReport.readSummaryPlot(outputDir, "QC_Reads_R1","R1", summary, sampleId = sampleId)
        FlexiprepReport.readSummaryPlot(outputDir, "QC_Reads_R2","R2", summary, sampleId = sampleId)
    }#
24 25 26 27 28 29 30 31 32 33 34 35
    <div class="panel-body">
        <div class="row">
            <div class="col-sm-6 col-md-6">
                <img src="QC_Reads_R1.png" class="img-responsive">
            </div>
            <div class="col-sm-6 col-md-6">
                <img src="QC_Reads_R2.png" class="img-responsive">
            </div>
        </div>

    </div>
    <div class="panel-footer">
Peter van 't Hof's avatar
Peter van 't Hof committed
36 37 38
        #if (showTable)
            <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#QC_ReadsTable">Show table</button>
        #end
39 40 41
        <i class="glyphicon glyphicon-file"></i> <a href="QC_Reads_R1.tsv">R1 reads stats</a> -
        <i class="glyphicon glyphicon-file"></i> <a href="QC_Reads_R2.tsv">R2 reads stats</a>
    </div>
42 43
#end
#if (showTable)
Peter van 't Hof's avatar
Peter van 't Hof committed
44
    <div class="panel-body collapse" id="QC_ReadsTable">
45 46 47 48

    <!-- Table -->
    <table class="table sortable-theme-bootstrap" data-sortable>
        <thead><tr>
49
            <th data-sorted="true" data-sorted-direction="ascending">Sample</th>
50 51 52 53 54 55 56 57
            <th colspan="2">Library</th>
            <th>Before QC</th>
            <th>Clipping</th>
            <th>Trimming</th>
            <th>After QC</th>
        </tr></thead>
        <tbody>
            #for (sample <- samples.toList.sorted)
58
                #{
59 60 61 62 63 64 65 66
                    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)
                    }
67
                }#
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
                <tr><td rowspan="${sampleRowspan}"><a href="${rootPath}Samples/${sample}/index.html">${sample}</a></td>
                #for (libId <- libs)
                    #if (libs.head != libId) <tr> #end
                        #{ val paired = summary.getLibraryValue(sample, libId, "flexiprep", "settings", "paired").getOrElse(false) }#
                        <td #if (paired == true) rowspan="2" #end><a href="${rootPath}Samples/${sample}/Libraries/${libId}/index.html">${libId}</a></td>
                        #{ 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, "reads", "num_total")
                                val afterTotal = summary.getLibraryValue(sample, libId, "flexiprep", "stats", "seqstat_" + read + "_after", "reads", "num_total")
                                val clippingDiscardedToShort = summary.getLibraryValue(sample, libId, "flexiprep", "stats", "clipping_" + read, "num_reads_discarded_too_short").getOrElse(0).asInstanceOf[Long]
                                val clippingDiscardedToLong = summary.getLibraryValue(sample, libId, "flexiprep", "stats", "clipping_" + read, "num_reads_discarded_too_long").getOrElse(0).asInstanceOf[Long]
                                val trimmingDiscarded = summary.getLibraryValue(sample, libId, "flexiprep", "stats", "trimming", "num_reads_discarded_" + read).getOrElse(0).asInstanceOf[Long]
                            }#
                            <td>${read}</td>
                            <td>${beforeTotal}</td>
                            <td>${clippingDiscardedToShort + clippingDiscardedToLong}</td>
                            <td>${trimmingDiscarded}</td>
                            <td>${afterTotal}</td>
                        #end
                    </tr>
                #end
91
            #end
92 93 94 95 96
        </tbody>

    </table>
    </div>

97
#end