Skip to content
Snippets Groups Projects
Commit b938c1b8 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added init version of dependency debug mode

parent 5434cd5c
No related branches found
No related tags found
No related merge requests found
......@@ -102,6 +102,8 @@ trait BiopetQScript extends Configurable with GatkLogging {
case _ => reportClass.foreach(add(_))
}
if (logger.isDebugEnabled) WriteDependencies.writeDependencies(functions, new File(outputDir, s".log/${qSettings.runName}.deps.json"))
Logging.checkErrors()
}
......
package nl.lumc.sasc.biopet.core
import java.io.{File, PrintWriter}
import nl.lumc.sasc.biopet.utils.ConfigUtils
import org.broadinstitute.gatk.queue.function.{CommandLineFunction, QFunction}
import scala.collection.mutable
/**
* Created by pjvanthof on 06/11/15.
*/
object WriteDependencies {
val functionNames: mutable.Map[QFunction, String] = mutable.Map()
def createFunctionNames(functions: Seq[QFunction]): Unit = {
val cache: mutable.Map[String, Int] = mutable.Map()
for (function <- functions) {
val baseName = function match {
case f: BiopetCommandLineFunction => f.configName
case f => f.getClass.getSimpleName
}
cache += baseName -> (cache.getOrElse(baseName, 0) + 1)
functionNames += function -> (s"$baseName-${cache(baseName)}")
}
}
def writeDependencies(functions: Seq[QFunction], outputFile: File): Unit = {
createFunctionNames(functions)
val writer = new PrintWriter(outputFile)
val jobs = functionNames.map { case (f, name) => name -> Map("command" -> (f match {
case cmd: CommandLineFunction => cmd.commandLine
case _ => None
}), "intermediate" -> f.isIntermediate) }
writer.println(ConfigUtils.mapToJson(jobs.toMap).spaces2)
writer.close()
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment