Commit 159c6184 authored by Peter van 't Hof's avatar Peter van 't Hof

Adding lost modules

parent 8314da08
...@@ -30,7 +30,7 @@ trait Summarizable { ...@@ -30,7 +30,7 @@ trait Summarizable {
def summaryStats: Any def summaryStats: Any
/** Can be used to add additional Summarizable, this is executed at the start of WriteSummary*/ /** Can be used to add additional Summarizable, this is executed at the start of WriteSummary*/
def addToQscriptSummary(qscript: SummaryQScript, name: String) {} def addToQscriptSummary(qscript: SummaryQScript) {}
/** /**
* This function is used to merge value that are found at the same path in the map. Default there will throw a exception at conflicting values. * This function is used to merge value that are found at the same path in the map. Default there will throw a exception at conflicting values.
......
...@@ -53,6 +53,8 @@ class WriteSummary(val parent: SummaryQScript) extends InProcessFunction with Co ...@@ -53,6 +53,8 @@ class WriteSummary(val parent: SummaryQScript) extends InProcessFunction with Co
} }
def init(): Unit = { def init(): Unit = {
qscript.summarizables.foreach(_._2.foreach(_.addToQscriptSummary(qscript)))
val db = SummaryDb.openSqliteSummary(qscript.summaryDbFile) val db = SummaryDb.openSqliteSummary(qscript.summaryDbFile)
if (qscript == root) { // This initialize the database if (qscript == root) { // This initialize the database
qscript match { qscript match {
......
...@@ -86,31 +86,32 @@ class CollectMultipleMetrics(val parent: Configurable) extends Picard with Summa ...@@ -86,31 +86,32 @@ class CollectMultipleMetrics(val parent: Configurable) extends Picard with Summa
optional("REFERENCE_SEQUENCE=", reference, spaceSeparated = false) + optional("REFERENCE_SEQUENCE=", reference, spaceSeparated = false) +
repeat("PROGRAM=", program, spaceSeparated = false) repeat("PROGRAM=", program, spaceSeparated = false)
override def addToQscriptSummary(qscript: SummaryQScript, name: String): Unit = { override def addToQscriptSummary(qscript: SummaryQScript): Unit = {
def summarizable(stats: () => Any): Summarizable = new Summarizable {
def summaryStats = stats()
def summaryFiles: Map[String, File] = Map()
}
program program
.filterNot(_ == Programs.CollectInsertSizeMetrics.toString && !new File(outputName + ".insert_size_metrics").exists()) .filterNot(_ == Programs.CollectInsertSizeMetrics.toString && !new File(outputName + ".insert_size_metrics").exists())
.foreach { p => .foreach { p =>
val stats: Any = p match { p match {
case _ if p == Programs.CollectAlignmentSummaryMetrics.toString => case _ if p == Programs.CollectAlignmentSummaryMetrics.toString =>
Picard.getMetrics(new File(outputName + ".alignment_summary_metrics"), groupBy = Some("CATEGORY")) qscript.addSummarizable(summarizable(() => Picard.getMetrics(new File(outputName + ".alignment_summary_metrics"), groupBy = Some("CATEGORY"))), p)
case _ if p == Programs.CollectInsertSizeMetrics.toString => case _ if p == Programs.CollectInsertSizeMetrics.toString =>
Map( qscript.addSummarizable(summarizable(() => Map(
"metrics" -> Picard.getMetrics(new File(outputName + ".insert_size_metrics")), "metrics" -> Picard.getMetrics(new File(outputName + ".insert_size_metrics")),
"histogram" -> Picard.getHistogram(new File(outputName + ".insert_size_metrics")) "histogram" -> Picard.getHistogram(new File(outputName + ".insert_size_metrics"))
) )), p)
case _ if p == Programs.QualityScoreDistribution.toString => case _ if p == Programs.QualityScoreDistribution.toString =>
Picard.getHistogram(new File(outputName + ".quality_distribution_metrics")) qscript.addSummarizable(summarizable(() => Picard.getHistogram(new File(outputName + ".quality_distribution_metrics"))), p)
case _ if p == Programs.MeanQualityByCycle.toString => case _ if p == Programs.MeanQualityByCycle.toString =>
Picard.getHistogram(new File(outputName + ".quality_by_cycle_metrics")) qscript.addSummarizable(summarizable(() => Picard.getHistogram(new File(outputName + ".quality_by_cycle_metrics"))), p)
case _ if p == Programs.CollectBaseDistributionByCycle.toString => case _ if p == Programs.CollectBaseDistributionByCycle.toString =>
Picard.getHistogram(new File(outputName + ".base_distribution_by_cycle_metrics"), tag = "METRICS CLASS") qscript.addSummarizable(summarizable(() => Picard.getHistogram(new File(outputName + ".base_distribution_by_cycle_metrics"), tag = "METRICS CLASS")), p)
case _ => None case _ => None
} }
val sum = new Summarizable {
override def summaryStats = stats
override def summaryFiles: Map[String, File] = Map()
}
qscript.addSummarizable(sum, p)
} }
} }
......
...@@ -70,7 +70,7 @@ class QcCommand(val parent: Configurable, val fastqc: Fastqc, val read: String) ...@@ -70,7 +70,7 @@ class QcCommand(val parent: Configurable, val fastqc: Fastqc, val read: String)
override def summaryDeps = trim.map(_.summaryDeps).toList.flatten ::: super.summaryDeps override def summaryDeps = trim.map(_.summaryDeps).toList.flatten ::: super.summaryDeps
override def addToQscriptSummary(qscript: SummaryQScript, name: String): Unit = { override def addToQscriptSummary(qscript: SummaryQScript): Unit = {
clip match { clip match {
case Some(job) => qscript.addSummarizable(job, s"clipping_$read") case Some(job) => qscript.addSummarizable(job, s"clipping_$read")
case _ => case _ =>
......
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