Commit 38b152be authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Fixing BIOPET-491

parent 21fa48ed
...@@ -42,4 +42,6 @@ trait Summarizable { ...@@ -42,4 +42,6 @@ trait Summarizable {
def resolveSummaryConflict(v1: Any, v2: Any, key: String): Any = { def resolveSummaryConflict(v1: Any, v2: Any, key: String): Any = {
throw new IllegalStateException("Merge can not have same key by default") throw new IllegalStateException("Merge can not have same key by default")
} }
def summaryDeps: List[File] = Nil
} }
...@@ -56,13 +56,16 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config ...@@ -56,13 +56,16 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
def init(): Unit = { def init(): Unit = {
for (q <- qscript.summaryQScripts) for (q <- qscript.summaryQScripts)
deps :+= q.summaryFile deps :+= q.summaryFile
for ((_, l) <- qscript.summarizables; s <- l) s match { for ((_, l) <- qscript.summarizables; s <- l) {
case f: QFunction if qscript.functions.contains(f) => try { deps :::= s.summaryDeps
deps :+= f.firstOutput s match {
} catch { case f: QFunction if qscript.functions.contains(f) => try {
case e: NullPointerException => logger.warn("Queue values are not init") deps :+= f.firstOutput
} catch {
case e: NullPointerException => logger.warn("Queue values are not init")
}
case _ =>
} }
case _ =>
} }
jobOutputFile = new File(out.getParentFile, ".%s.%s.out".format(out.getName, analysisName)) jobOutputFile = new File(out.getParentFile, ".%s.%s.out".format(out.getName, analysisName))
......
...@@ -84,6 +84,8 @@ class Sickle(val root: Configurable) extends BiopetCommandLineFunction with Summ ...@@ -84,6 +84,8 @@ class Sickle(val root: Configurable) extends BiopetCommandLineFunction with Summ
(if (outputAsStsout) "" else " > " + required(outputStats)) (if (outputAsStsout) "" else " > " + required(outputStats))
} }
override def summaryDeps = outputStats :: super.summaryDeps
/** returns stats map for summary */ /** returns stats map for summary */
def summaryStats: Map[String, Any] = { def summaryStats: Map[String, Any] = {
// regex for single run // regex for single run
......
...@@ -94,6 +94,8 @@ class FastqSync(val root: Configurable) extends ToolCommandFunction with Summari ...@@ -94,6 +94,8 @@ class FastqSync(val root: Configurable) extends ToolCommandFunction with Summari
) )
} }
override def summaryDeps = outputStats :: super.summaryDeps
override def resolveSummaryConflict(v1: Any, v2: Any, key: String): Any = { override def resolveSummaryConflict(v1: Any, v2: Any, key: String): Any = {
(v1, v2) match { (v1, v2) match {
case (v1: Int, v2: Int) => v1 + v2 case (v1: Int, v2: Int) => v1 + v2
......
...@@ -14,12 +14,12 @@ ...@@ -14,12 +14,12 @@
*/ */
package nl.lumc.sasc.biopet.pipelines.flexiprep package nl.lumc.sasc.biopet.pipelines.flexiprep
import nl.lumc.sasc.biopet.core.summary.SummaryQScript import nl.lumc.sasc.biopet.core.summary.{Summarizable, SummaryQScript}
import nl.lumc.sasc.biopet.core.{ BiopetFifoPipe, PipelineCommand, SampleLibraryTag } import nl.lumc.sasc.biopet.core.{BiopetFifoPipe, PipelineCommand, SampleLibraryTag}
import nl.lumc.sasc.biopet.extensions.{ Gzip, Zcat } import nl.lumc.sasc.biopet.extensions.{Gzip, Zcat}
import nl.lumc.sasc.biopet.utils.config.Configurable import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.utils.IoUtils._ import nl.lumc.sasc.biopet.utils.IoUtils._
import nl.lumc.sasc.biopet.extensions.tools.{ FastqSync, SeqStat, ValidateFastq } import nl.lumc.sasc.biopet.extensions.tools.{FastqSync, SeqStat, ValidateFastq}
import nl.lumc.sasc.biopet.utils.Logging import nl.lumc.sasc.biopet.utils.Logging
import org.broadinstitute.gatk.queue.QScript import org.broadinstitute.gatk.queue.QScript
...@@ -206,8 +206,8 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with ...@@ -206,8 +206,8 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
fqSync.outputFastq2 = new File(outDir, fastqR2Qc.get.getName) fqSync.outputFastq2 = new File(outDir, fastqR2Qc.get.getName)
fqSync.outputStats = new File(outDir, s"${sampleId.getOrElse("x")}-${libId.getOrElse("x")}.sync.stats") fqSync.outputStats = new File(outDir, s"${sampleId.getOrElse("x")}-${libId.getOrElse("x")}.sync.stats")
val pipe = new BiopetFifoPipe(this, fqSync :: Nil) { val pipe = new BiopetFifoPipe(this, fqSync :: Nil) with Summarizable {
override def configNamespace = "qc-cmd" override def configNamespace = "qc_cmd"
override def beforeGraph(): Unit = { override def beforeGraph(): Unit = {
fqSync.beforeGraph() fqSync.beforeGraph()
...@@ -223,11 +223,20 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with ...@@ -223,11 +223,20 @@ class Flexiprep(val root: Configurable) extends QScript with SummaryQScript with
commands.foreach(addPipeJob) commands.foreach(addPipeJob)
super.beforeCmd() super.beforeCmd()
} }
/** Must return files to store into summary */
def summaryFiles: Map[String, File] = Map()
/** Must returns stats to store into summary */
def summaryStats: Any = Map()
override def summaryDeps = qcCmdR1.summaryDeps ::: qcCmdR2.summaryDeps ::: super.summaryDeps
} }
pipe.deps ::= fastqcR1.output pipe.deps ::= fastqcR1.output
pipe.deps ::= fastqcR2.output pipe.deps ::= fastqcR2.output
pipe.isIntermediate = !keepQcFastqFiles pipe.isIntermediate = !keepQcFastqFiles
addSummarizable(pipe, "qc_cmd")
add(pipe) add(pipe)
addSummarizable(fqSync, "fastq_sync") addSummarizable(fqSync, "fastq_sync")
......
...@@ -65,6 +65,8 @@ class QcCommand(val root: Configurable, val fastqc: Fastqc) extends BiopetComman ...@@ -65,6 +65,8 @@ class QcCommand(val root: Configurable, val fastqc: Fastqc) extends BiopetComman
def summaryStats = Map() def summaryStats = Map()
override def summaryDeps = trim.map(_.summaryDeps).toList.flatten ::: super.summaryDeps
override def addToQscriptSummary(qscript: SummaryQScript, name: String): Unit = { override def addToQscriptSummary(qscript: SummaryQScript, name: String): Unit = {
clip match { clip match {
case Some(job) => qscript.addSummarizable(job, s"clipping_$read") case Some(job) => qscript.addSummarizable(job, s"clipping_$read")
......
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