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

Merge remote-tracking branch 'origin/fix-BIOPET-587' into fix-BIOPET-587

parents da4ba466 be96b35b
......@@ -62,7 +62,6 @@ trait MultiSampleQScript extends SummaryQScript { qscript: QScript =>
currentSample = Some(sampleId)
currentLib = Some(libId)
addJobs()
qscript.addSummarizable(this, "pipeline", Some(sampleId), Some(libId))
currentLib = None
currentSample = None
}
......@@ -170,7 +169,6 @@ trait MultiSampleQScript extends SummaryQScript { qscript: QScript =>
Logging.addError(s"Sample '$sampleId' $nameError")
currentSample = Some(sampleId)
addJobs()
qscript.addSummarizable(this, "pipeline", Some(sampleId))
currentSample = None
}
......
......@@ -22,6 +22,7 @@ import nl.lumc.sasc.biopet.core.extensions.{ CheckChecksum, Md5sum }
import nl.lumc.sasc.biopet.utils.summary.db.SummaryDb
import org.broadinstitute.gatk.queue.QScript
import nl.lumc.sasc.biopet.LastCommitHash
import nl.lumc.sasc.biopet.utils.ConfigUtils
import scala.collection.mutable
import scala.concurrent.Await
......@@ -64,7 +65,8 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript =>
* @param libraryId Id of libary
* @param forceSingle If true it replaces summarizable instead of adding to it
*/
def addSummarizable(summarizable: Summarizable, name: String,
def addSummarizable(summarizable: Summarizable,
name: String,
sampleId: Option[String] = None,
libraryId: Option[String] = None,
forceSingle: Boolean = false): Unit = {
......@@ -90,7 +92,7 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript =>
val id = reader.getLines().next().toInt
reader.close()
id
} else createRun
} else createRun()
}
private def runIdFile = root match {
......@@ -104,7 +106,11 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript =>
case q: BiopetQScript => q.outputDir
case _ => throw new IllegalStateException("Root should be a BiopetQscript")
}
val id = Await.result(db.createRun(summaryName, dir.getAbsolutePath, nl.lumc.sasc.biopet.Version,
val name = root match {
case q: SummaryQScript => q.summaryName
case _ => throw new IllegalStateException("Root should be a SummaryQScript")
}
val id = Await.result(db.createRun(name, dir.getAbsolutePath, nl.lumc.sasc.biopet.Version,
LastCommitHash, new Date(System.currentTimeMillis())), Duration.Inf)
runIdFile.getParentFile.mkdir()
val writer = new PrintWriter(runIdFile)
......@@ -183,6 +189,22 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript =>
case _ => add(writeSummary)
}
qscript match {
case q: MultiSampleQScript =>
// Global level
for ((key, file) <- qscript.summaryFiles) addChecksum(file)
for ((sampleName, sample) <- q.samples) {
// Sample level
for ((key, file) <- sample.summaryFiles) addChecksum(file)
for ((libName, lib) <- sample.libraries) {
// Library level
for ((key, file) <- lib.summaryFiles) addChecksum(file)
}
}
case q => for ((key, file) <- q.summaryFiles) addChecksum(file)
}
addedJobs = true
}
}
......
......@@ -149,14 +149,14 @@ class WriteSummary(val parent: SummaryQScript) extends InProcessFunction with Co
// Sample level
val sampleId = Await.result(db.getSampleId(qscript.summaryRunId, sampleName), Duration.Inf).getOrElse(throw new IllegalStateException("Sample should already exist in database"))
for ((key, file) <- sample.summaryFiles.par)
Await.result(createFile(db, q.summaryRunId, pipelineId, Some(sampleId), None, None, key, file, outputDir), Duration.Inf)
Await.result(createFile(db, q.summaryRunId, pipelineId, None, Some(sampleId), None, key, file, outputDir), Duration.Inf)
db.createOrUpdateSetting(qscript.summaryRunId, pipelineId, None, Some(sampleId), None, ConfigUtils.mapToJson(sample.summarySettings).nospaces)
for ((libName, lib) <- sample.libraries) {
// Library level
val libId = Await.result(db.getLibraryId(qscript.summaryRunId, sampleId, libName), Duration.Inf).getOrElse(throw new IllegalStateException("Library should already exist in database"))
for ((key, file) <- lib.summaryFiles.par)
Await.result(createFile(db, q.summaryRunId, pipelineId, Some(sampleId), Some(libId), None, key, file, outputDir), Duration.Inf)
Await.result(createFile(db, q.summaryRunId, pipelineId, None, Some(sampleId), Some(libId), key, file, outputDir), Duration.Inf)
db.createOrUpdateSetting(qscript.summaryRunId, pipelineId, None, Some(sampleId), Some(libId), ConfigUtils.mapToJson(lib.summarySettings).nospaces)
}
}
......
#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)
<%@ var summary: Summary %>
<%@ var rootPath: String %>
#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)
}#
<table class="table">
<tbody>
<tr><th>Pipeline</th><td>Gears</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>${samples.size}</td></tr>
</tbody>
</table>
<br/>
......
#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)
<%@ var summary: Summary %>
<%@ var rootPath: String %>
#import(scala.concurrent.Await)
#import(scala.concurrent.duration.Duration)
<%@ var summary: SummaryDb %>
<%@ 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
}#
<table class="table">
<tbody>
<tr><th>Pipeline</th><td>Gears</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>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
</tbody>
......
......@@ -14,6 +14,8 @@
*/
package nl.lumc.sasc.biopet.pipelines.gears
import java.io.File
import nl.lumc.sasc.biopet.core.report.{ MultisampleReportBuilder, ReportBuilderExtension, ReportPage, ReportSection }
import nl.lumc.sasc.biopet.pipelines.flexiprep.FlexiprepReport
import nl.lumc.sasc.biopet.utils.config.Configurable
......@@ -57,10 +59,10 @@ object GearsReport extends MultisampleReportBuilder {
)), Map()))
else Nil) ::: (if (qiimeClosesOtuTable.isDefined) List("Qiime closed reference analysis" -> ReportPage(List(), List(
"Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp"
)), Map("biomFile" -> qiimeClosesOtuTable.get)))
)), Map("biomFile" -> new File(qiimeClosesOtuTable.get.path))))
else Nil) ::: (if (qiimeOpenOtuTable.isDefined) List("Qiime open reference analysis" -> ReportPage(List(), List(
"Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp"
)), Map("biomFile" -> qiimeOpenOtuTable.get)))
)), Map("biomFile" -> new File(qiimeOpenOtuTable.get.path))))
else Nil) ::: List("Samples" -> generateSamplesPage(pageArgs)) ++
Map(
"Versions" -> ReportPage(List(), List(
......@@ -97,10 +99,10 @@ object GearsReport extends MultisampleReportBuilder {
)), Map()))
else Nil) ::: (if (qiimeClosesOtuTable.isDefined) List("Qiime closed reference analysis" -> ReportPage(List(), List(
"Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp"
)), Map("biomFile" -> qiimeClosesOtuTable.get)))
)), Map("biomFile" -> new File(qiimeClosesOtuTable.get.path))))
else Nil) ::: (if (qiimeOpenOtuTable.isDefined) List("Qiime open reference analysis" -> ReportPage(List(), List(
"Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp"
)), Map("biomFile" -> qiimeOpenOtuTable.get)))
)), Map("biomFile" -> new File(qiimeOpenOtuTable.get.path))))
else Nil) ::: List(
"Libraries" -> generateLibraryPage(args)
), List("QC reads" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"),
......@@ -133,10 +135,10 @@ object GearsReport extends MultisampleReportBuilder {
)), Map()))
else Nil) ::: (if (qiimeClosesOtuTable.isDefined) List("Qiime closed reference analysis" -> ReportPage(List(), List(
"Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp"
)), Map("biomFile" -> qiimeClosesOtuTable.get)))
)), Map("biomFile" -> new File(qiimeClosesOtuTable.get.path))))
else Nil) ::: (if (qiimeOpenOtuTable.isDefined) List("Qiime open reference analysis" -> ReportPage(List(), List(
"Krona plot" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/gears/qiimeKrona.ssp"
)), Map("biomFile" -> qiimeOpenOtuTable.get)))
)), Map("biomFile" -> new File(qiimeOpenOtuTable.get.path))))
else Nil), List(
"QC reads" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepReadSummary.ssp"),
"QC bases" -> ReportSection("/nl/lumc/sasc/biopet/pipelines/flexiprep/flexiprepBaseSummary.ssp")
......
#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 pipeline: String %>
<%@ var runId: Int %>
<%@ var sampleId: Option[Int] %>
<%@ var libId: Option[Int] %>
#{
val run = Await.result(summary.getRuns(runId = Some(runId)), Duration.Inf).head
val settings = summary.getSettingKeys(runId, Right(pipeline),
val settings = summary.getSettingKeys(runId, run.name,
keyValues = Map(
"contigs" -> List("reference", "contigs"),
"species" -> List("reference", "species"),
......@@ -19,13 +20,13 @@
}#
<table class="table">
<tbody>
<tr><th>Pipeline</th><td>${pipeline}</td></tr>
<tr><th>Pipeline</th><td>Mapping</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>Reference</th><td>${settings.get("species")} - ${settings.get("name")}</td></tr>
<tr><th>Sample</th><td>${sampleId}</td></tr>
<tr><th>Library</th><td>${libId}</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>
</tbody>
</table>
<br/>
......
#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)
<%@ var summary: Summary %>
<%@ var rootPath: String %>
#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)
val settings = summary.getSettingKeys(runId, run.name,
keyValues = Map(
"contigs" -> List("reference", "contigs"),
"species" -> List("reference", "species"),
"name" -> List("reference", "name"),
"annotation" -> List("annotation"),
"multisample_variantcalling" -> List("multisample_variantcalling"),
"sv_calling" -> List("sv_calling"),
"variantcallers" -> List("variantcallers")
))
}#
<table class="table">
<tbody>
<tr><th>Pipeline</th><td>Shiva</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>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>Variantcallers</th>
<td>${summary.getValue("shivavariantcalling", "settings", "variantcallers").getOrElse(List("None")).asInstanceOf[List[String]].mkString(", ")}</td>
<td>${settings.get("variantcallers")}</td>
</tr>
<tr><th>Reference</th><td>${summary.getValue("shiva", "settings", "reference", "species")} - ${summary.getValue("shiva", "settings", "reference", "name")}</td></tr>
<tr><th>Number of samples</th><td>${summary.samples.size}</td></tr>
<tr><th>Annotation</th><td>${summary.getValue("shiva", "settings", "annotation")}</td></tr>
<tr><th>Multisample variantcalling</th><td>${summary.getValue("shiva", "settings", "multisample_variantcalling")}</td></tr>
<tr><th>Sv calling</th><td>${summary.getValue("shiva", "settings", "sv_calling")}</td></tr>
<tr><th>Reference</th><td>${settings.get("species")} - ${settings.get("name")}</td></tr>
<tr><th>Number of samples</th><td>${samples.size}</td></tr>
<tr><th>Annotation</th><td>${settings.get("annotation")}</td></tr>
<tr><th>Multisample variantcalling</th><td>${settings.get("multisample_variantcalling")}</td></tr>
<tr><th>Sv calling</th><td>${settings.get("sv_calling")}</td></tr>
</tbody>
</table>
<br/>
......
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