rnaHistogram.ssp 3.47 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
#import(nl.lumc.sasc.biopet.utils.summary.Summary)
#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 %>
Peter van 't Hof's avatar
Peter van 't Hof committed
13
<%@ var fields: List[String] = List("PF_ALIGNED_BASES", "MEDIAN_5PRIME_BIAS", "MEDIAN_3PRIME_BIAS", "MEDIAN_5PRIME_TO_3PRIME_BIAS")%>
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
<%@ 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>
Wai Yi Leung's avatar
Wai Yi Leung committed
32
            This shows the relative coverage for all transcripts using Picard CollectRnaMetrics
33 34 35 36 37 38 39 40 41
        </p>
    </div>
    </div>
#end

#if (showPlot)
    #{ BammetricsReport.rnaHistogramPlot(outputDir, "rna", summary, !sampleLevel, sampleId = sampleId, libId = libId) }#

    <div class="panel-body">
Wai Yi Leung's avatar
Wai Yi Leung committed
42
        <img src="rna.png" class="img-responsive" />
43 44 45 46 47 48 49
    </div>
    <div class="panel-footer">
        #if (showTable)
            <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#rnaTable">Hide table</button>
        #else
            <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#rnaTable">Show table</button>
        #end
50
        <a href="rna.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> TSV file</button></a>
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="rnaTable">
<!-- 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("rna", "metrics", field.toUpperCase)):_*).getOrElse(prefixPath ::: metricsTag :: Nil)
                        }
                    }#
                    #for (value <- fieldValues)
                        <td>${value}</td>
                    #end
                </tr>
            #end
        #end
    </tbody>
</table>

</div>