Commit b118cadf authored by Peter van 't Hof's avatar Peter van 't Hof

Fixed rna template

parent a5333b95
#import(nl.lumc.sasc.biopet.utils.summary.Summary) #import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb._)
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb.Implicts._)
#import(nl.lumc.sasc.biopet.core.report.ReportPage) #import(nl.lumc.sasc.biopet.core.report.ReportPage)
#import(scala.concurrent.Await)
#import(scala.concurrent.duration.Duration)
#import(nl.lumc.sasc.biopet.pipelines.bammetrics.BammetricsReport) #import(nl.lumc.sasc.biopet.pipelines.bammetrics.BammetricsReport)
#import(java.io.File) #import(java.io.File)
#import(org.apache.commons.io.FileUtils) <%@ var summary: SummaryDb %>
<%@ var summary: Summary %> <%@ var sampleId: Option[Int] = None %>
<%@ var sampleId: Option[String] = None %> <%@ var libId: Option[Int] = None %>
<%@ var libId: Option[String] = None %>
<%@ var rootPath: String %> <%@ var rootPath: String %>
<%@ var metricsTag: String = "bammetrics" %> <%@ var metricsTag: String = "bammetrics" %>
<%@ var sampleLevel: Boolean = false %> <%@ var sampleLevel: Boolean = false %>
...@@ -14,13 +17,9 @@ ...@@ -14,13 +17,9 @@
<%@ var showPlot: Boolean = false %> <%@ var showPlot: Boolean = false %>
<%@ var showTable: Boolean = true %> <%@ var showTable: Boolean = true %>
<%@ var showIntro: Boolean = true%> <%@ var showIntro: Boolean = true%>
<%@ var runId: Int %>
#{ #{
val samples = sampleId match { val samples = Await.result(summary.getSamples(runId = Some(runId)), Duration.Inf)
case Some(sample) => {
List(sample.toString)
}
case _ => summary.samples.toList
}
}# }#
#if (showIntro) #if (showIntro)
...@@ -36,7 +35,7 @@ ...@@ -36,7 +35,7 @@
#end #end
#if (showPlot) #if (showPlot)
#{ BammetricsReport.rnaHistogramPlot(outputDir, "rna", summary, !sampleLevel, sampleId = sampleId, libId = libId) }# #{ BammetricsReport.rnaHistogramPlot(outputDir, "rna", summary, !sampleLevel, sampleId = sampleId, libraryId = libId) }#
<div class="panel-body"> <div class="panel-body">
<img src="rna.png" class="img-responsive" /> <img src="rna.png" class="img-responsive" />
...@@ -47,7 +46,7 @@ ...@@ -47,7 +46,7 @@
#else #else
<button type="button" class="btn btn-info" data-toggle="collapse" data-target="#rnaTable">Show table</button> <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#rnaTable">Show table</button>
#end #end
<a href="rna.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i> TSV file</button></a> <a href="rna.tsv"><button type="button" class="btn btn-info"><i class="glyphicon glyphicon-cloud-download"></i>TSV file</button></a>
</div> </div>
#end #end
...@@ -62,27 +61,25 @@ ...@@ -62,27 +61,25 @@
#end #end
</tr></thead> </tr></thead>
<tbody> <tbody>
#for (sample <- samples.toList.sorted) #for (sample <- samples.sortBy(_.name))
#{ #{
val libs = (libId, sampleLevel) match { val libs: List[Option[Int]] = (libId, sampleLevel) match {
case (_, true) => List("") case (_, true) => List(None)
case (Some(libId), _) => List(libId.toString) case (Some(_), _) => List(libId)
case _ => summary.libraries(sample).toList case _ => Await.result(summary.getLibraries(sampleId = Some(sample.id), runId = Some(runId)), Duration.Inf).map(x => Some(x.id)).toList
} }
}# }#
<tr><td rowspan="${libs.size}"><a href="${rootPath}Samples/${sample}/index.html">${sample}</a></td> <tr><td rowspan="${libs.size}"><a href="${rootPath}Samples/${sample}/index.html">${sample}</a></td>
#for (libId <- libs) #for (libId <- libs)
#{ val libName = libId.map(l => Await.result(summary.getLibraryName(l), Duration.Inf)) }#
#if (libs.head != libId) <tr> #end #if (libs.head != libId) <tr> #end
#if (!sampleLevel) <td><a href="${rootPath}Samples/${sample}/Libraries/${libId}/index.html">${libId}</a></td> #end #if (!sampleLevel) <td><a href="${rootPath}Samples/${sample.name}/Libraries/${libName}/index.html">${libName}</a></td> #end
#{ #{
val prefixPath = List("samples", sample) ::: (if (libId.isEmpty) Nil else List("libraries", libId)) ::: List("bammetrics", "stats") val statsPaths = fields.map(x => x -> List("metrics", x.toUpperCase)).toMap
val results = summary.getStatKeys(runId, "bammetrics", "wgs", sample = sample.id, library = libId.map(LibraryId).getOrElse(NoLibrary), keyValues = statsPaths)
val fieldValues = for (field <- fields) yield {
summary.getValue((prefixPath ::: List("rna", "metrics", field.toUpperCase)):_*).getOrElse(prefixPath ::: metricsTag :: Nil)
}
}# }#
#for (value <- fieldValues) #for (field <- fields)
<td>${value}</td> <td>${results(field)}</td>
#end #end
</tr> </tr>
#end #end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment