covstatsMultiTable.ssp 2.92 KB
Newer Older
1
#import(nl.lumc.sasc.biopet.utils.IoUtils)
2
#import(nl.lumc.sasc.biopet.utils.summary.Summary)
3 4 5 6 7 8 9 10 11 12
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(org.apache.commons.io.FileUtils)
#import(java.io.File)
<%@ var summary: Summary %>
<%@ var sampleId: Option[String] = None %>
<%@ var libId: Option[String] = None %>
<%@ var sampleLevel: Boolean = true %>
<%@ var rootPath: String %>
<%@ var outputDir: File %>
<%@ var metricsTag: String = "bammetrics" %>
13
<%@ var target: Option[String] %>
14 15 16 17 18 19 20 21 22 23
#{
    val samples = sampleId match {
        case Some(sample) => List(sample.toString)
        case _ => summary.samples.toList
    }
}#


<table class="table">
<thead><tr>
Peter van 't Hof's avatar
Peter van 't Hof committed
24
    <th>sample</th>
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
    <th>mean</th>
    <th>median</th>
    <th>max</th>
    <th>horizontal</th>
    <th>frac min 10x</th>
    <th>frac min 20x</th>
    <th>frac min 30x</th>
    <th>frac min 40x</th>
    <th>frac min 50x</th>
</tr></thead>
<tbody>
    #for (sample <- samples.toList.sorted)
        #{
            val libs = (libId, sampleLevel) match {
            case (_, true) => List("")
            case (Some(libId), _) => List(libId.toString)
            case _ => summary.libraries(sample).toList
            }
        }#
        <tr><td rowspan="${libs.size}"><a href="${rootPath}Samples/${sample}/index.html">${sample}</a></td>
        #for (libId <- libs)
            #if (libs.head != libId) <tr> #end
                #if (!sampleLevel) <td><a href="${rootPath}Samples/${sample}/Libraries/${libId}/index.html">${libId}</a></td> #end
                #{
49
                    val prefixPath = List("samples", sample) ::: (if (libId.isEmpty) Nil else List("libraries", libId)) ::: List(metricsTag, "stats", target.get + "_cov_stats", "coverage", "_all")
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
                    val total = summary.getValue((prefixPath ::: List("biopet_flagstat", "All")):_*).getOrElse(0L).asInstanceOf[Long]
                    val mapped = summary.getValue((prefixPath ::: List("biopet_flagstat", "Mapped")):_*).getOrElse(0L).asInstanceOf[Long]
                    val duplicates = summary.getValue((prefixPath ::: List("biopet_flagstat", "Duplicates")):_*).getOrElse(0L).asInstanceOf[Long]
                }#
                <td>${summary.getValue((prefixPath ::: "mean" :: Nil):_*)}</td>
                <td>${summary.getValue((prefixPath ::: "median" :: Nil):_*)}</td>
                <td>${summary.getValue((prefixPath ::: "max" :: Nil):_*)}</td>
                <td>${summary.getValue((prefixPath ::: "horizontal" :: Nil):_*)}</td>
                <td>${summary.getValue((prefixPath ::: "frac_min_10x" :: Nil):_*)}</td>
                <td>${summary.getValue((prefixPath ::: "frac_min_20x" :: Nil):_*)}</td>
                <td>${summary.getValue((prefixPath ::: "frac_min_30x" :: Nil):_*)}</td>
                <td>${summary.getValue((prefixPath ::: "frac_min_40x" :: Nil):_*)}</td>
                <td>${summary.getValue((prefixPath ::: "frac_min_50x" :: Nil):_*)}</td>
            </tr>
        #end
    #end
</tbody>
</table>