Commit 1f620a44 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Make all module within one qscript

parent e193f1b6
...@@ -41,7 +41,7 @@ trait SummaryQScript extends BiopetQScript with Summarizable { ...@@ -41,7 +41,7 @@ trait SummaryQScript extends BiopetQScript with Summarizable {
def addSummaryJobs: Unit = { def addSummaryJobs: Unit = {
val writeSummary = new WriteSummary(this) val writeSummary = new WriteSummary(this)
addSummarizable(this, summaryName) addSummarizable(this, "pipeline")
//Automatic checksums //Automatic checksums
for ((_, summarizableList) <- summarizables; summarizable <- summarizableList; (_, file) <- summarizable.summaryFiles) { for ((_, summarizableList) <- summarizables; summarizable <- summarizableList; (_, file) <- summarizable.summaryFiles) {
......
...@@ -19,20 +19,20 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config ...@@ -19,20 +19,20 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
require(root.isInstanceOf[SummaryQScript], "root is not a SummaryQScript") require(root.isInstanceOf[SummaryQScript], "root is not a SummaryQScript")
val summaryQScript = root.asInstanceOf[SummaryQScript] val qscript = root.asInstanceOf[SummaryQScript]
@Input(doc = "deps", required = false) @Input(doc = "deps", required = false)
var deps: List[File] = Nil var deps: List[File] = Nil
@Output(doc = "Summary output", required = true) @Output(doc = "Summary output", required = true)
var out: File = summaryQScript.summaryFile var out: File = qscript.summaryFile
var md5sum: Boolean = config("summary_md5", default = true) var md5sum: Boolean = config("summary_md5", default = true)
//TODO: add more checksums types //TODO: add more checksums types
override def freezeFieldValues(): Unit = { override def freezeFieldValues(): Unit = {
for (q <- summaryQScript.summaryQScripts) deps :+= q.summaryFile for (q <- qscript.summaryQScripts) deps :+= q.summaryFile
for ((_, l) <- summaryQScript.summarizables; s <- l) s match { for ((_, l) <- qscript.summarizables; s <- l) s match {
case f: QFunction => deps :+= f.firstOutput case f: QFunction => deps :+= f.firstOutput
case _ => case _ =>
} }
...@@ -44,10 +44,10 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config ...@@ -44,10 +44,10 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
def run(): Unit = { def run(): Unit = {
val map = (for ( val map = (for (
((name, sampleId, libraryId), summarizables) <- summaryQScript.summarizables; ((name, sampleId, libraryId), summarizables) <- qscript.summarizables;
summarizable <- summarizables summarizable <- summarizables
) yield { ) yield {
val map = Map(name -> parseSummarizable(summarizable)) val map = Map(qscript.summaryName ->Map(name -> parseSummarizable(summarizable)))
(sampleId match { (sampleId match {
case Some(sampleId) => Map("samples" -> Map(sampleId -> (libraryId match { case Some(sampleId) => Map("samples" -> Map(sampleId -> (libraryId match {
...@@ -58,7 +58,7 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config ...@@ -58,7 +58,7 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
}, (v1: Any, v2: Any, key: String) => summarizable.resolveSummaryConflict(v1, v2, key)) }, (v1: Any, v2: Any, key: String) => summarizable.resolveSummaryConflict(v1, v2, key))
}).foldRight(Map[String, Any]())((a, b) => ConfigUtils.mergeMaps(a._1, b, a._2)) }).foldRight(Map[String, Any]())((a, b) => ConfigUtils.mergeMaps(a._1, b, a._2))
val combinedMap = (for (qscript <- summaryQScript.summaryQScripts) yield { val combinedMap = (for (qscript <- qscript.summaryQScripts) yield {
ConfigUtils.fileToConfigMap(qscript.summaryFile) ConfigUtils.fileToConfigMap(qscript.summaryFile)
}).foldRight(map)((a, b) => ConfigUtils.mergeMaps(a, b)) }).foldRight(map)((a, b) => ConfigUtils.mergeMaps(a, b))
......
Supports Markdown
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