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

Remove redundent queries

parent af88febc
#import(nl.lumc.sasc.biopet.utils.summary.Summary)
#import(nl.lumc.sasc.biopet.core.report.ReportPage)
<%@ var summary: Summary %>
<%@ var rootPath: String %>
<%@ var sampleId: Option[Int] %>
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Run)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Library)
<%@ var runId: Int %>
<%@ var sampleId: Option[Int] = None %>
<%@ var libId: Option[Int] = None %>
<%@ var run: Run %>
<%@ var allSamples: Seq[Sample] %>
<%@ var allLibraries: Seq[Library] %>
<table class="table">
<tbody>
<tr><th>Pipeline</th><td>BamMetrics</td></tr>
<tr><th>Version</th><td>${summary.getValue("meta", "pipeline_version")}</td></tr>
<tr><th>Last commit hash</th><td>${summary.getValue("meta", "last_commit_hash")}</td></tr>
<tr><th>Output directory</th><td>${summary.getValue("meta", "output_dir")}</td></tr>
<tr><th>Sample ID</th><td>${sampleId}</td></tr>
#if (libId.isDefined) <tr><th>Library ID</th><td>${libId}</td></tr> #end
<tr><th>Pipeline</th><td>GearsSingle</td></tr>
<tr><th>Version</th><td>${run.version}</td></tr>
<tr><th>Last commit hash</th><td>${run.commitHash}</td></tr>
<tr><th>Output directory</th><td>${run.outputDir}</td></tr>
<tr><th>Sample</th><td>${allSamples.filter(_.id == sampleId.get).headOption.map(_.name)}</td></tr>
<tr><th>Library</th><td>${allLibraries.filter(_.id == libId.get).headOption.map(_.name)}</td></tr>
</tbody>
</table>
<br/>
......
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
#import(scala.concurrent.Await)
#import(scala.concurrent.duration.Duration)
<%@ var summary: SummaryDb %>
<%@ var runId: Int %>
#{
val run = Await.result(summary.getRuns(runId = Some(runId)), Duration.Inf).head
}#
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Run)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
<%@ var run: Run %>
<%@ var allSamples: List[Sample] %>
<table class="table">
<tbody>
<tr><th>Pipeline</th><td>Carp</td></tr>
<tr><th>Version</th><td>${run.version}</td></tr>
<tr><th>Last commit hash</th><td>${run.commitHash}</td></tr>
<tr><th>Output directory</th><td>${run.outputDir}</td></tr>
<tr><th>Number of samples</th><td>${allSamples.size}</td></tr>
</tbody>
</table>
<br/>
......
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Library)
#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)
......@@ -17,9 +19,11 @@
<%@ var showTable: Boolean = true %>
<%@ var showIntro: Boolean = true %>
<%@ var multisample: Boolean = true %>
<%@ var allSamples: List[Sample] %>
<%@ var allLibraries: List[Library] %>
#{
val samples = Await.result(summary.getSamples(runId = Some(runId), sampleId = sampleId), Duration.Inf)
val libraries = Await.result(summary.getLibraries(runId = Some(runId), sampleId = sampleId), Duration.Inf)
val samples = sampleId.map(id => allSamples.filter(_.id == id)).getOrElse(allSamples)
val libraries = libId.map(id => allLibraries.filter(_.id == id)).getOrElse(allLibraries)
val settings = summary.getSettingsForLibraries(runId, "flexiprep", keyValues = Map(
"skip_trim" -> List("skip_trim"), "skip_clip" -> List("skip_clip"), "paired" -> List("paired")))
settings.count(_._2.getOrElse("skip_trim", None) == Some(true))
......
#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(scala.concurrent.Await)
#import(scala.concurrent.duration.Duration)
<%@ var summary: SummaryDb %>
<%@ var rootPath: String %>
<%@ var runId: Int %>
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Run)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Library)
<%@ var sampleId: Option[Int] %>
<%@ var libId: Option[Int] %>
#{
val run = Await.result(summary.getRuns(runId = Some(runId)), Duration.Inf).head
}#
<%@ var run: Run %>
<%@ var allSamples: List[Sample] %>
<%@ var allLibraries: List[Library] %>
<table class="table">
<tbody>
<tr><th>Pipeline</th><td>Flexiprep</td></tr>
<tr><th>Version</th><td>${run.version}</td></tr>
<tr><th>Last commit hash</th><td>${run.commitHash}</td></tr>
<tr><th>Output directory</th><td>${run.outputDir}</td></tr>
<tr><th>Sample ID</th><td>${Await.result(summary.getSampleName(sampleId.get), Duration.Inf)}</td></tr>
<tr><th>Library ID</th><td>${Await.result(summary.getLibraryName(libId.get), Duration.Inf)}</td></tr>
<tr><th>Sample ID</th><td>${allSamples.filter(_.id == sampleId.get).headOption.map(_.name)}</td></tr>
<tr><th>Library ID</th><td>${allLibraries.filter(_.id == libId.get).headOption.map(_.name)}</td></tr>
</tbody>
</table>
<br/>
......
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Library)
#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)
......@@ -16,9 +18,11 @@
<%@ var showTable: Boolean = true %>
<%@ var showIntro: Boolean = true %>
<%@ var multisample: Boolean = true %>
<%@ var allSamples: List[Sample] %>
<%@ var allLibraries: List[Library] %>
#{
val samples = Await.result(summary.getSamples(runId = Some(runId), sampleId = sampleId), Duration.Inf)
val libraries = Await.result(summary.getLibraries(runId = Some(runId), sampleId = sampleId), Duration.Inf)
val samples = sampleId.map(id => allSamples.filter(_.id == id)).getOrElse(allSamples)
val libraries = libId.map(id => allLibraries.filter(_.id == id)).getOrElse(allLibraries)
val settings = summary.getSettingsForLibraries(runId, "flexiprep", keyValues = Map(
"skip_trim" -> List("skip_trim"), "skip_clip" -> List("skip_clip"), "paired" -> List("paired")))
settings.count(_._2.getOrElse("skip_trim", None) == Some(true))
......
#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(scala.concurrent.Await)
#import(scala.concurrent.duration.Duration)
<%@ var summary: SummaryDb %>
<%@ var runId: Int %>
#{
val run = Await.result(summary.getRuns(runId = Some(runId)), Duration.Inf).head
val samples = Await.result(summary.getSamples(Some(runId)), Duration.Inf)
}#
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Run)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
<%@ var run: Run %>
<%@ var allSamples: List[Sample] %>
<table class="table">
<tbody>
<tr><th>Pipeline</th><td>Gears</td></tr>
<tr><th>Version</th><td>${run.version}</td></tr>
<tr><th>Last commit hash</th><td>${run.commitHash}</td></tr>
<tr><th>Output directory</th><td>${run.outputDir}</td></tr>
<tr><th>Number of samples</th><td>${samples.size}</td></tr>
<tr><th>Number of samples</th><td>${allSamples.size}</td></tr>
</tbody>
</table>
<br/>
......
#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(scala.concurrent.Await)
#import(scala.concurrent.duration.Duration)
<%@ var summary: SummaryDb %>
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Run)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Library)
<%@ var runId: Int %>
<%@ var sampleId: Option[String] = None %>
<%@ var libId: Option[String] = None %>
#{
val run = Await.result(summary.getRuns(runId = Some(runId)), Duration.Inf).head
}#
<%@ var sampleId: Option[Int] = None %>
<%@ var libId: Option[Int] = None %>
<%@ var run: Run %>
<%@ var allSamples: Seq[Sample] %>
<%@ var allLibraries: Seq[Library] %>
<table class="table">
<tbody>
<tr><th>Pipeline</th><td>GearsSingle</td></tr>
<tr><th>Version</th><td>${run.version}</td></tr>
<tr><th>Last commit hash</th><td>${run.commitHash}</td></tr>
<tr><th>Output directory</th><td>${run.outputDir}</td></tr>
#if(sampleId.isDefined) <tr><th>Sample</th><td>${sampleId}</td></tr> #end
#if(libId.isDefined) <tr><th>Library</th><td>${libId}</td></tr> #end
<tr><th>Sample</th><td>${allSamples.filter(_.id == sampleId.get).headOption.map(_.name)}</td></tr>
<tr><th>Library</th><td>${allLibraries.filter(_.id == libId.get).headOption.map(_.name)}</td></tr>
</tbody>
</table>
<br/>
......
#import(nl.lumc.sasc.biopet.utils.summary.Summary)
#import(nl.lumc.sasc.biopet.utils.ConfigUtils)
#import(java.io.File)
<%@ var summary: Summary %>
<%@ var sampleId: Option[String] = None %>
<%@ var libId: Option[String] = None %>
<%@ var rootPath: String %>
<%@ var showPlot: Boolean = true %>
<%@ var showIntro: Boolean = true %>
#{
val samples = sampleId match {
case Some(sample) => List(sample.toString)
case _ => summary.samples.toList
}
val librariesCount = summary.samples.foldLeft(0)(_ + summary.libraries(_).size)
}#
#if (showIntro)
<div class="row">
<div class="col-md-1"></div>
<div class="col-md-10">
Here we show a sunburst visualisation of the analysis of the metagenome in sample: ${sampleId}
</div>
<div class="col-md-1"></div>
</div>
#end
#if (showPlot)
<div class="row">
<div class="col-md-12">
<h3 id='currentlevel'>Root</h3>
<div>
<span id="selection_name"></span> -
<span id="selection_size"></span> -
<span id="selection_value"></span>
</div>
<form>
<label><input type="radio" name="mode" value="size"> Size</label>
<label><input type="radio" name="mode" value="count" checked> Count</label>
</form>
<div id="sequence"></div>
<div id="datatable"></div>
<div id="svgholder"></div>
</div>
<script src="${rootPath}ext/js/gears.js"></script>
<script type="application/ecmascript">
#{
val rawreport = Map("kraken" -> summary.getValue(sampleId, libId, "gearskraken", "stats", "krakenreport"))
val jsonReport = ConfigUtils.mapToJson(rawreport)
}#
var krakenresult = ${unescape(jsonReport)};
loadGears(krakenresult.kraken.classified);
</script>
</div>
#end
......@@ -13,7 +13,6 @@
<%@ var centrifugeTag: Option[String] = None %>
<%@ var summaryStatsTag: String = "krakenreport" %>
<%@ var summaryModuleTag: String = "gearskraken" %>
<%
val summaries = if (sampleId.isEmpty) {
summary.getSampleValues(summaryModuleTag, "stats", summaryStatsTag).map(x => x._1 -> x._2.get.asInstanceOf[Map[String, Any]])
......
......@@ -5,7 +5,6 @@
<%@ var biomFile: File %>
<%@ var args: Map[String, Any] %>
<%@ var outputDir: File %>
<%
val tempFile = File.createTempFile("krona.", ".xml")
tempFile.deleteOnExit()
......@@ -20,5 +19,4 @@
writer.println(output)
writer.close()
%>
<iframe src="kraken_krona.html" style="width:100%;height:80vh;border:none;"></iframe>
#import(nl.lumc.sasc.biopet.utils.summary.Summary)
<%@ var summary: Summary %>
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Run)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
<%@ var run: Run %>
<%@ var allSamples: List[Sample] %>
<table class="table">
<tbody>
<tr><th>Pipeline</th><td>Gentrap</td></tr>
<tr><th>Version</th><td>${summary.getValue("meta", "pipeline_version")}</td></tr>
<tr><th>Last commit hash</th><td>${summary.getValue("meta", "last_commit_hash")}</td></tr>
<tr><th>Output directory</th><td>${summary.getValue("meta", "output_dir")}</td></tr>
<tr><th>Version</th><td>${run.version}</td></tr>
<tr><th>Last commit hash</th><td>${run.commitHash}</td></tr>
<tr><th>Output directory</th><td>${run.outputDir}</td></tr>
<tr><th>Number of samples</th><td>${allSamples.size}</td></tr>
</tbody>
</table>
<br/>
......
#import(nl.lumc.sasc.biopet.utils.summary.Summary)
#import(org.apache.commons.io.FileUtils)
#import(java.io.File)
<%@ var summary: Summary %>
<%@ var outputDir: File %>
<%@ var pipelineName: String %>
<%@ var plotPath: Option[Any] %>
......
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Run)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Library)
#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)
......@@ -9,8 +12,10 @@
<%@ var runId: Int %>
<%@ var sampleId: Option[Int] %>
<%@ var libId: Option[Int] %>
<%@ var run: Run %>
<%@ var allSamples: Seq[Sample] %>
<%@ var allLibraries: Seq[Library] %>
#{
val run = Await.result(summary.getRuns(runId = Some(runId)), Duration.Inf).head
val settings = summary.getSettingKeys(runId, run.name,
keyValues = Map(
"contigs" -> List("reference", "contigs"),
......@@ -25,8 +30,8 @@
<tr><th>Last commit hash</th><td>${run.commitHash}</td></tr>
<tr><th>Output directory</th><td>${run.outputDir}</td></tr>
<tr><th>Reference</th><td>${settings.get("species")} - ${settings.get("name")}</td></tr>
<tr><th>Sample</th><td>${Await.result(summary.getSampleName(sampleId.get), Duration.Inf)}</td></tr>
<tr><th>Library</th><td>${Await.result(summary.getLibraryName(libId.get), Duration.Inf)}</td></tr>
<tr><th>Sample</th><td>${allSamples.filter(_.id == sampleId.get).headOption.map(_.name)}</td></tr>
<tr><th>Library</th><td>${allLibraries.filter(_.id == libId.get).headOption.map(_.name)}</td></tr>
</tbody>
</table>
<br/>
......
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Run)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
#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)
......@@ -8,9 +10,10 @@
<%@ var rootPath: String %>
<%@ var pipeline: String %>
<%@ var runId: Int %>
<%@ var run: Run %>
<%@ var allSamples: List[Sample] %>
#{
val run = Await.result(summary.getRuns(runId = Some(runId)), Duration.Inf).head
val samples = Await.result(summary.getSamples(runId = Some(runId)), Duration.Inf)
val samples = allSamples
val settings = summary.getSettingKeys(runId, pipeline,
keyValues = Map(
"contigs" -> List("reference", "contigs"),
......
......@@ -42,9 +42,6 @@ object MappingReport extends ReportBuilder {
override def extFiles = super.extFiles ++ List("js/gears.js", "js/krona-2.0.js", "img/krona/loading.gif", "img/krona/hidden.png", "img/krona/favicon.ico")
.map(x => ExtFile("/nl/lumc/sasc/biopet/pipelines/gears/report/ext/" + x, x))
def krakenExecuted: Boolean = Await.result(summary.getStatsSize(runId, "gears", "krakenreport",
sample = sampleId.map(SampleId), library = libId.map(LibraryId)), Duration.Inf) >= 1
/** Root page for single BamMetrcis report */
def indexPage: Future[ReportPage] = Future {
val mappingSettings = summary.getSettingKeys(runId, "mapping", NoModule,
......@@ -55,11 +52,7 @@ object MappingReport extends ReportBuilder {
Some(BammetricsReport.bamMetricsPage(summary, sampleId, libId))
} else None
ReportPage((if (skipFlexiprep) Nil else List("QC" -> FlexiprepReport.flexiprepPage)) :::
bamMetricsPage.map(_.subPages).getOrElse(Nil) :::
(if (krakenExecuted) List("Gears - Metagenomics" -> Future.successful(ReportPage(List(), List(
"Sunburst analysis" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/gearsSunburst.ssp"
)), Map())))
else Nil), List(
bamMetricsPage.map(_.subPages).getOrElse(Nil), List(
"Report" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/mapping/mappingFront.ssp")
) ::: bamMetricsPage.map(_.sections).getOrElse(Nil),
Map()
......
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Sample)
#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)
......@@ -18,10 +19,14 @@
<%@ var target: Option[String] = None %>
<%@ var caller: String = "final" %>
<%@ var runId: Int %>
<%@ var allSamples: List[Sample] %>
#{
val fields = List("Hom", "HomVar", "Het", "HomRef", "NoCall", "Variant", "Total")
val samples = Await.result(summary.getSamples(runId = Some(runId), sampleId = sampleId), Duration.Inf)
val samples = sampleId match {
case Some(id) => allSamples.filter(_.id == id)
case _ => allSamples
}
val vcfstatsKey = target match {
case Some(t) => s"multisample-vcfstats-$caller-$t"
case _ => s"multisample-vcfstats-$caller"
......
#import(nl.lumc.sasc.biopet.utils.summary.db.SummaryDb)
#import(nl.lumc.sasc.biopet.utils.summary.db.Schema.Run)
#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)
......@@ -6,8 +7,8 @@
#import(scala.concurrent.duration.Duration)
<%@ var summary: SummaryDb %>
<%@ var runId: Int %>
<%@ var run: Run %>
#{
val run = Await.result(summary.getRuns(runId = Some(runId)), Duration.Inf).head
val samples = Await.result(summary.getSamples(Some(runId)), Duration.Inf)
val settings = summary.getSettingKeys(runId, run.name,
keyValues = Map(
......
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