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

Merge branch 'release-0.7.0' into 'master'

Release 0.7.0



See merge request !449
parents 23c1ccea bf548a42
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
......
...@@ -8,24 +8,16 @@ ...@@ -8,24 +8,16 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
package nl.lumc.sasc.biopet.pipelines.basty package nl.lumc.sasc.biopet.core
import nl.lumc.sasc.biopet.core.PipelineCommand
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.QScript
/** /**
* Basty implementation without GATK parts * Created by pjvan_thof on 4/26/16.
*
* Created by pjvan_thof on 3/4/15.
*/ */
class Basty(val root: Configurable) extends QScript with BastyTrait { trait ScatterGatherableFunction extends BiopetCommandLineFunction
def this() = this(null) with org.broadinstitute.gatk.queue.function.scattergather.ScatterGatherableFunction {
scatterCount = config("scattercount", freeVar = true, default = 1)
} }
object Basty extends PipelineCommand
\ No newline at end of file
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
...@@ -30,18 +29,16 @@ import scala.collection.mutable.ListBuffer ...@@ -30,18 +29,16 @@ import scala.collection.mutable.ListBuffer
*/ */
object WriteDependencies extends Logging with Configurable { object WriteDependencies extends Logging with Configurable {
val root: Configurable = null val root: Configurable = null
private val functionNames: mutable.Map[QFunction, String] = mutable.Map() private def createFunctionNames(functions: Seq[QFunction]): Map[QFunction, String] = {
private def createFunctionNames(functions: Seq[QFunction]): Unit = {
val cache: mutable.Map[String, Int] = mutable.Map() val cache: mutable.Map[String, Int] = mutable.Map()
for (function <- functions) { (for (function <- functions) yield {
val baseName = function match { val baseName = function match {
case f: Configurable => f.configName case f: Configurable => f.configNamespace
case f => f.getClass.getSimpleName case f => f.getClass.getSimpleName
} }
cache += baseName -> (cache.getOrElse(baseName, 0) + 1) cache += baseName -> (cache.getOrElse(baseName, 0) + 1)
functionNames += function -> s"$baseName-${cache(baseName)}" function -> s"$baseName-${cache(baseName)}"
} }).toMap
} }
/** /**
...@@ -55,7 +52,7 @@ object WriteDependencies extends Logging with Configurable { ...@@ -55,7 +52,7 @@ object WriteDependencies extends Logging with Configurable {
val errorOnMissingInput: Boolean = config("error_on_missing_input", false) val errorOnMissingInput: Boolean = config("error_on_missing_input", false)
createFunctionNames(functions) val functionNames = createFunctionNames(functions)
case class QueueFile(file: File) { case class QueueFile(file: File) {
private val inputJobs: ListBuffer[QFunction] = ListBuffer() private val inputJobs: ListBuffer[QFunction] = ListBuffer()
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
...@@ -24,7 +23,7 @@ trait PythonCommandLineFunction extends BiopetCommandLineFunction { ...@@ -24,7 +23,7 @@ trait PythonCommandLineFunction extends BiopetCommandLineFunction {
@Input(doc = "Python script", required = false) @Input(doc = "Python script", required = false)
var pythonScript: File = _ var pythonScript: File = _
executable = config("exe", default = "python", submodule = "python", freeVar = false) executable = config("exe", default = "python", namespace = "python", freeVar = false)
protected var pythonScriptName: String = _ protected var pythonScriptName: String = _
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
...@@ -24,6 +23,7 @@ import org.broadinstitute.gatk.utils.commandline.Input ...@@ -24,6 +23,7 @@ import org.broadinstitute.gatk.utils.commandline.Input
import org.fusesource.scalate.{ TemplateEngine, TemplateSource } import org.fusesource.scalate.{ TemplateEngine, TemplateSource }
import scala.collection.mutable import scala.collection.mutable
import scala.language.postfixOps
/** /**
* This trait is meant to make an extension for a report object * This trait is meant to make an extension for a report object
...@@ -66,15 +66,28 @@ trait ReportBuilderExtension extends ToolCommandFunction { ...@@ -66,15 +66,28 @@ trait ReportBuilderExtension extends ToolCommandFunction {
trait ReportBuilder extends ToolCommand { trait ReportBuilder extends ToolCommand {
case class Args(summary: File = null, outputDir: File = null, pageArgs: mutable.Map[String, Any] = mutable.Map()) extends AbstractArgs case class Args(summary: File = null,
outputDir: File = null,
pageArgs: mutable.Map[String, Any] = mutable.Map()) extends AbstractArgs
class OptParser extends AbstractOptParser { class OptParser extends AbstractOptParser {
head(
s"""
|$commandName - Generate HTML formatted report from a biopet summary.json
""".stripMargin
)
opt[File]('s', "summary") unbounded () required () maxOccurs 1 valueName "<file>" action { (x, c) => opt[File]('s', "summary") unbounded () required () maxOccurs 1 valueName "<file>" action { (x, c) =>
c.copy(summary = x) c.copy(summary = x)
} } validate {
x => if (x.exists) success else failure("Summary JSON file not found!")
} text "Biopet summary JSON file"
opt[File]('o', "outputDir") unbounded () required () maxOccurs 1 valueName "<file>" action { (x, c) => opt[File]('o', "outputDir") unbounded () required () maxOccurs 1 valueName "<file>" action { (x, c) =>
c.copy(outputDir = x) c.copy(outputDir = x)
} } text "Output HTML report files to this directory"
opt[Map[String, String]]('a', "args") unbounded () action { (x, c) => opt[Map[String, String]]('a', "args") unbounded () action { (x, c) =>
c.copy(pageArgs = c.pageArgs ++ x) c.copy(pageArgs = c.pageArgs ++ x)
} }
...@@ -118,7 +131,7 @@ trait ReportBuilder extends ToolCommand { ...@@ -118,7 +131,7 @@ trait ReportBuilder extends ToolCommand {
logger.info("Start") logger.info("Start")
val argsParser = new OptParser val argsParser = new OptParser
val cmdArgs: Args = argsParser.parse(args, Args()) getOrElse sys.exit(1) val cmdArgs: Args = argsParser.parse(args, Args()) getOrElse (throw new IllegalArgumentException)
require(cmdArgs.outputDir.exists(), "Output dir does not exist") require(cmdArgs.outputDir.exists(), "Output dir does not exist")
require(cmdArgs.outputDir.isDirectory, "Output dir is not a directory") require(cmdArgs.outputDir.isDirectory, "Output dir is not a directory")
...@@ -142,9 +155,14 @@ trait ReportBuilder extends ToolCommand { ...@@ -142,9 +155,14 @@ trait ReportBuilder extends ToolCommand {
// Static files that will be copied to the output folder, then file is added to [resourceDir] it's need to be added here also // Static files that will be copied to the output folder, then file is added to [resourceDir] it's need to be added here also
val extOutputDir: File = new File(cmdArgs.outputDir, "ext") val extOutputDir: File = new File(cmdArgs.outputDir, "ext")
for (resource <- extFiles.par) { // Copy each resource files out to the report destination
IoUtils.copyStreamToFile(getClass.getResourceAsStream(resource.resourcePath), new File(extOutputDir, resource.targetPath), createDirs = true) extFiles.par.foreach(
} resource =>
IoUtils.copyStreamToFile(
getClass.getResourceAsStream(resource.resourcePath),
new File(extOutputDir, resource.targetPath),
createDirs = true)
)
logger.info("Parsing summary") logger.info("Parsing summary")
setSummary = new Summary(cmdArgs.summary) setSummary = new Summary(cmdArgs.summary)
...@@ -165,11 +183,12 @@ trait ReportBuilder extends ToolCommand { ...@@ -165,11 +183,12 @@ trait ReportBuilder extends ToolCommand {
/** This must be implemented, this will be the root page of the report */ /** This must be implemented, this will be the root page of the report */
def indexPage: ReportPage def indexPage: ReportPage
/** This must be implemented, this will because the title of the report */ /** This must be implemented, this will become the title of the report */
def reportName: String def reportName: String
/** /**
* This method will render the page and the subpages recursivly * This method will render the page and the subpages recursivly
*
* @param summary The summary object * @param summary The summary object
* @param page Page to render * @param page Page to render
* @param outputDir Root output dir of the report * @param outputDir Root output dir of the report
...@@ -185,7 +204,7 @@ trait ReportBuilder extends ToolCommand { ...@@ -185,7 +204,7 @@ trait ReportBuilder extends ToolCommand {
val pageOutputDir = new File(outputDir, path.mkString(File.separator)) val pageOutputDir = new File(outputDir, path.mkString(File.separator))
pageOutputDir.mkdirs() pageOutputDir.mkdirs()
val rootPath = "./" + Array.fill(path.size)("../").mkString("") val rootPath = "./" + Array.fill(path.size)("../").mkString
val pageArgs = args ++ page.args ++ val pageArgs = args ++ page.args ++
Map("page" -> page, Map("page" -> page,
"path" -> path, "path" -> path,
...@@ -194,8 +213,9 @@ trait ReportBuilder extends ToolCommand { ...@@ -194,8 +213,9 @@ trait ReportBuilder extends ToolCommand {
) )
// Generating subpages // Generating subpages
val jobs = for ((name, subPage) <- page.subPages.par) yield { val jobs = page.subPages.par.flatMap {
generatePage(summary, subPage, outputDir, path ::: name :: Nil, pageArgs) case (name, subPage) => Some(generatePage(summary, subPage, outputDir, path ::: name :: Nil, pageArgs))
case _ => None
} }
val output = ReportBuilder.renderTemplate("/nl/lumc/sasc/biopet/core/report/main.ssp", val output = ReportBuilder.renderTemplate("/nl/lumc/sasc/biopet/core/report/main.ssp",
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
...@@ -37,7 +36,7 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript => ...@@ -37,7 +36,7 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript =>
private[summary] var summaryQScripts: List[SummaryQScript] = Nil private[summary] var summaryQScripts: List[SummaryQScript] = Nil
/** Name of the pipeline in the summary */ /** Name of the pipeline in the summary */
var summaryName = configName var summaryName = configNamespace
/** Must return a map with used settings for this pipeline */ /** Must return a map with used settings for this pipeline */
def summarySettings: Map[String, Any] def summarySettings: Map[String, Any]
...@@ -103,7 +102,7 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript => ...@@ -103,7 +102,7 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript =>
if (writeSummary.md5sum) { if (writeSummary.md5sum) {
if (!SummaryQScript.md5sumCache.contains(file)) { if (!SummaryQScript.md5sumCache.contains(file)) {
val md5sum = new Md5sum(this) { val md5sum = new Md5sum(this) {
override def configName = "md5sum" override def configNamespace = "md5sum"
override def cmdLine: String = super.cmdLine + " || " + override def cmdLine: String = super.cmdLine + " || " +
required("echo") + required("error_on_capture " + input.toString) + " > " + required(output) required("echo") + required("error_on_capture " + input.toString) + " > " + required(output)
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
...@@ -75,16 +74,16 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config ...@@ -75,16 +74,16 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
def fetchVersion(f: QFunction): Option[(String, Any)] = { def fetchVersion(f: QFunction): Option[(String, Any)] = {
f match { f match {
case f: BiopetJavaCommandLineFunction with Version => case f: BiopetJavaCommandLineFunction with Version =>
Some(f.configName -> Map("version" -> f.getVersion.getOrElse(None), Some(f.configNamespace -> Map("version" -> f.getVersion.getOrElse(None),
"java_md5" -> BiopetCommandLineFunction.executableMd5Cache.getOrElse(f.executable, None), "java_md5" -> BiopetCommandLineFunction.executableMd5Cache.getOrElse(f.executable, None),
"java_version" -> f.getJavaVersion, "java_version" -> f.getJavaVersion,
"jar_path" -> f.jarFile)) "jar_path" -> f.jarFile))
case f: BiopetCommandLineFunction with Version => case f: BiopetCommandLineFunction with Version =>
Some(f.configName -> Map("version" -> f.getVersion.getOrElse(None), Some(f.configNamespace -> Map("version" -> f.getVersion.getOrElse(None),
"md5" -> BiopetCommandLineFunction.executableMd5Cache.getOrElse(f.executable, None), "md5" -> BiopetCommandLineFunction.executableMd5Cache.getOrElse(f.executable, None),
"path" -> f.executable)) "path" -> f.executable))
case f: Configurable with Version => case f: Configurable with Version =>
Some(f.configName -> Map("version" -> f.getVersion.getOrElse(None))) Some(f.configNamespace -> Map("version" -> f.getVersion.getOrElse(None)))
case _ => None case _ => None
} }
} }
......
...@@ -8,8 +8,7 @@ ...@@ -8,8 +8,7 @@
* *
* Contact us at: sasc@lumc.nl * Contact us at: sasc@lumc.nl
* *
* A dual licensing mode is applied. The source code within this project that are * A dual licensing mode is applied. The source code within this project is freely available for non-commercial use under an AGPL
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* license; For commercial users or users who do not want to follow the AGPL * license; For commercial users or users who do not want to follow the AGPL
* license, please contact us to obtain a separate license. * license, please contact us to obtain a separate license.
*/ */
......