flexiprepReadSummary.ssp 2.76 KB
Newer Older
1 2 3 4 5
#import(nl.lumc.sasc.biopet.core.summary.Summary)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
<%@ var summary: Summary %>
<%@ var sampleId: Option[String] = None %>
<%@ var libId: Option[String] = None %>
6
<%@ var rootPath: String %>
7 8 9 10 11 12 13 14 15 16 17
#{
    val samples = sampleId match {
        case Some(sample) => List(sample.toString)
        case _ => summary.samples.toList
    }
}#
<table>
<thead><tr>
    <th>Sample</th>
    <th colspan="2">Library</th>
    <th>Before QC</th>
18 19
    <th>Clipping</th>
    <th>Trimming</th>
20 21 22 23 24 25 26 27 28 29 30 31 32 33
    <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)
            }
        }#
34
        <tr><td rowspan="${sampleRowspan}"><a href="${rootPath}Samples/${sample}/index.html">${sample}</a></td>
35 36 37
        #for (libId <- libs)
            #if (libs.head != libId) <tr> #end
            #{ val paired = summary.getLibraryValue(sample, libId, "flexiprep", "settings", "paired").getOrElse(false) }#
38
            <td #if (paired == true) rowspan="2" #end><a href="${rootPath}Samples/${sample}/Libraries/${libId}/index.html">${libId}</a></td>
39 40 41
            #{ val reads = if (paired == true) List("R1", "R2") else List("R1") }#
            #for (read <- reads)
                #if (read == "R2") </tr><tr> #end
42 43 44 45 46 47 48
                #{
                    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]
                }#
49
                <td>${read}</td>
50 51 52 53
                <td>${beforeTotal}</td>
                <td>${clippingDiscardedToShort + clippingDiscardedToLong}</td>
                <td>${trimmingDiscarded}</td>
                <td>${afterTotal}</td>
54 55 56 57 58 59
            #end
            </tr>
        #end
    #end
</tbody>
</table>