wgsHistogram.ssp 3.66 KB
Newer Older
1
#import(nl.lumc.sasc.biopet.utils.summary.Summary)
Peter van 't Hof's avatar
Peter van 't Hof committed
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(nl.lumc.sasc.biopet.pipelines.bammetrics.BammetricsReport)
#import(java.io.File)
#import(org.apache.commons.io.FileUtils)
<%@ var summary: Summary %>
<%@ var sampleId: Option[String] = None %>
<%@ var libId: Option[String] = None %>
<%@ var rootPath: String %>
<%@ var metricsTag: String = "bammetrics" %>
<%@ var sampleLevel: Boolean = false %>
<%@ var outputDir: File %>
<%@ var fields: List[String] = List("mean_coverage", "pct_5x", "pct_10x", "pct_15x", "pct_20x", "pct_25x", "pct_30x", "pct_40x", "pct_50x", "pct_60x", "pct_70x", "pct_80x", "pct_90x", "pct_100x")%>
<%@ var showPlot: Boolean = false %>
<%@ var showTable: Boolean = true %>
<%@ var showIntro: Boolean = true%>
#{
    val samples = sampleId match {
    case Some(sample) => {
    List(sample.toString)
    }
    case _ => summary.samples.toList
    }
}#

#if (showIntro)
    <br/>
    <div class="row">
    <div class="col-md-1"></div>
    <div class="col-md-6">
        <p>
Sander Bollen's avatar
Sander Bollen committed
32
            Here we show the total number of positions in the reference that are covered with a given coverage. This plot is whole-genome based, and will therefore be highly skewed in the case of an exome or targeted approach.
Peter van 't Hof's avatar
Peter van 't Hof committed
33 34 35 36 37 38
        </p>
    </div>
    </div>
#end

#if (showPlot)
Peter van 't Hof's avatar
Peter van 't Hof committed
39
    #{ BammetricsReport.wgsHistogramPlot(outputDir, "wgs", summary, !sampleLevel, sampleId = sampleId, libId = libId) }#
Peter van 't Hof's avatar
Peter van 't Hof committed
40 41 42 43 44 45 46 47 48 49

    <div class="panel-body">
    <img src="wgs.png" class="img-responsive" />
    </div>
    <div class="panel-footer">
        #if (showTable)
            <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#wgsTable">Hide table</button>
        #else
            <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#wgsTable">Show table</button>
        #end
50
        <a href="wgs.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> TSV file</button></a>
Peter van 't Hof's avatar
Peter van 't Hof committed
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
    </div>
#end

<div class="panel-body collapse #if (showTable)in#end" id="wgsTable">
<!-- Table -->
<table class="table sortable-theme-bootstrap" data-sortable>
    <thead><tr>
        <th data-sorted="true" data-sorted-direction="ascending">Sample</th>
        #if (!sampleLevel) <th>Library</th> #end
        #for (field <- fields)
            <th>${field.replaceAll("_", " ")}</th>
        #end
    </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
                    #{
                        val prefixPath = List("samples", sample) ::: (if (libId.isEmpty) Nil else List("libraries", libId)) ::: List("bammetrics", "stats")

                        val fieldValues = for (field <- fields) yield {
                            summary.getValue((prefixPath ::: List("wgs", "metrics", field.toUpperCase)):_*).getOrElse(prefixPath ::: metricsTag :: Nil)
                        }
                    }#
                    #for (value <- fieldValues)
                        <td>${value}</td>
                    #end
                </tr>
            #end
        #end
    </tbody>
</table>

</div>