Commit 168543b0 authored by Peter van 't Hof's avatar Peter van 't Hof

Switch from dot to gv files

parent 211bcfda
......@@ -16,7 +16,7 @@ package nl.lumc.sasc.biopet.core
import java.io.File
import nl.lumc.sasc.biopet.core.summary.SummaryQScript
import nl.lumc.sasc.biopet.core.summary.{ SummaryQScript, WriteSummary }
import nl.lumc.sasc.biopet.utils.config.Configurable
import nl.lumc.sasc.biopet.core.report.ReportBuilderExtension
import nl.lumc.sasc.biopet.utils.Logging
......@@ -98,7 +98,8 @@ trait BiopetQScript extends Configurable with GatkLogging { qscript: QScript =>
f.beforeGraph()
f.internalBeforeGraph()
f.commandLine
case _ =>
case f: WriteSummary => f.init()
case _ =>
}
if (outputDir.getParentFile.canWrite || (outputDir.exists && outputDir.canWrite))
......
......@@ -110,13 +110,13 @@ object WriteDependencies extends Logging with Configurable {
val jobs = functionNames.par.map {
case (f, name) =>
name -> Map("command" -> (f match {
name.toString -> Map("command" -> (f match {
case cmd: CommandLineFunction => cmd.commandLine
case _ => None
}), "main_job" -> (f match {
case cmd: BiopetCommandLineFunction => cmd.mainFunction
case cmd: BiopetCommandLineFunction => cmd.mainFunction
case s: WriteSummary if s.qscript.root == null => true
case _ => false
case _ => false
}), "intermediate" -> f.isIntermediate,
"depends_on_intermediate" -> f.inputs.exists(files(_).isIntermediate),
"depends_on_jobs" -> f.inputs.toList.flatMap(files(_).outputJobNames).distinct,
......@@ -140,7 +140,7 @@ object WriteDependencies extends Logging with Configurable {
val jobsWriter = new PrintWriter(new File(outputDir, s"$prefix.jobs.json"))
jobsWriter.println(ConfigUtils.mapToJson(jobsDeps).spaces2)
jobsWriter.close()
writeDotFile(jobsDeps, new File(outputDir, s"$prefix.jobs.dot"))
writeGraphvizFile(jobsDeps, new File(outputDir, s"$prefix.jobs.gv"))
val mainJobs = jobs.filter(_._2("main_job") == true).map {
case (name, job) =>
......@@ -150,7 +150,7 @@ object WriteDependencies extends Logging with Configurable {
val mainJobsWriter = new PrintWriter(new File(outputDir, s"$prefix.main_jobs.json"))
mainJobsWriter.println(ConfigUtils.mapToJson(mainJobs).spaces2)
mainJobsWriter.close()
writeDotFile(mainJobs, new File(outputDir, s"$prefix.main_jobs.dot"))
writeGraphvizFile(mainJobs, new File(outputDir, s"$prefix.main_jobs.gv"))
logger.info("done calculating dependencies")
}
......@@ -168,10 +168,10 @@ object WriteDependencies extends Logging with Configurable {
}.distinct
}
def writeDotFile(jobs: Map[String, List[String]], outputFile: File): Unit = {
def writeGraphvizFile(jobs: Map[String, List[String]], outputFile: File): Unit = {
val writer = new PrintWriter(outputFile)
writer. println("digraph graphname {")
jobs.foreach { case (a,b) => b.foreach(c => writer.println(s" $c -> $a;"))}
writer.println("digraph graphname {")
jobs.foreach { case (a, b) => b.foreach(c => writer.println(s" $c -> $a;")) }
writer.println("}")
writer.close()
}
......
......@@ -49,15 +49,19 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
//TODO: add more checksums types
override def freezeFieldValues(): Unit = {
for (q <- qscript.summaryQScripts) deps :+= q.summaryFile
init()
super.freezeFieldValues()
}
def init(): Unit = {
for (q <- qscript.summaryQScripts)
deps :+= q.summaryFile
for ((_, l) <- qscript.summarizables; s <- l) s match {
case f: QFunction => deps :+= f.firstOutput
case _ =>
}
jobOutputFile = new File(out.getParentFile, ".%s.%s.out".format(out.getName, analysisName))
super.freezeFieldValues()
}
/** Function to create summary */
......
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