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 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
......
......@@ -8,24 +8,16 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
package nl.lumc.sasc.biopet.pipelines.basty
import nl.lumc.sasc.biopet.core.PipelineCommand
import nl.lumc.sasc.biopet.utils.config.Configurable
import org.broadinstitute.gatk.queue.QScript
package nl.lumc.sasc.biopet.core
/**
* Basty implementation without GATK parts
*
* Created by pjvan_thof on 3/4/15.
* Created by pjvan_thof on 4/26/16.
*/
class Basty(val root: Configurable) extends QScript with BastyTrait {
def this() = this(null)
trait ScatterGatherableFunction extends BiopetCommandLineFunction
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 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
......@@ -30,18 +29,16 @@ import scala.collection.mutable.ListBuffer
*/
object WriteDependencies extends Logging with Configurable {
val root: Configurable = null
private val functionNames: mutable.Map[QFunction, String] = mutable.Map()
private def createFunctionNames(functions: Seq[QFunction]): Unit = {
private def createFunctionNames(functions: Seq[QFunction]): Map[QFunction, String] = {
val cache: mutable.Map[String, Int] = mutable.Map()
for (function <- functions) {
(for (function <- functions) yield {
val baseName = function match {
case f: Configurable => f.configName
case f: Configurable => f.configNamespace
case f => f.getClass.getSimpleName
}
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 {
val errorOnMissingInput: Boolean = config("error_on_missing_input", false)
createFunctionNames(functions)
val functionNames = createFunctionNames(functions)
case class QueueFile(file: File) {
private val inputJobs: ListBuffer[QFunction] = ListBuffer()
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
......@@ -24,7 +23,7 @@ trait PythonCommandLineFunction extends BiopetCommandLineFunction {
@Input(doc = "Python script", required = false)
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 = _
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
......@@ -24,6 +23,7 @@ import org.broadinstitute.gatk.utils.commandline.Input
import org.fusesource.scalate.{ TemplateEngine, TemplateSource }
import scala.collection.mutable
import scala.language.postfixOps
/**
* This trait is meant to make an extension for a report object
......@@ -66,15 +66,28 @@ trait ReportBuilderExtension extends ToolCommandFunction {
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 {
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) =>
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) =>
c.copy(outputDir = x)
}
} text "Output HTML report files to this directory"
opt[Map[String, String]]('a', "args") unbounded () action { (x, c) =>
c.copy(pageArgs = c.pageArgs ++ x)
}
......@@ -118,7 +131,7 @@ trait ReportBuilder extends ToolCommand {
logger.info("Start")
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.isDirectory, "Output dir is not a directory")
......@@ -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
val extOutputDir: File = new File(cmdArgs.outputDir, "ext")
for (resource <- extFiles.par) {
IoUtils.copyStreamToFile(getClass.getResourceAsStream(resource.resourcePath), new File(extOutputDir, resource.targetPath), createDirs = true)
}
// Copy each resource files out to the report destination
extFiles.par.foreach(
resource =>
IoUtils.copyStreamToFile(
getClass.getResourceAsStream(resource.resourcePath),
new File(extOutputDir, resource.targetPath),
createDirs = true)
)
logger.info("Parsing summary")
setSummary = new Summary(cmdArgs.summary)
......@@ -165,11 +183,12 @@ trait ReportBuilder extends ToolCommand {
/** This must be implemented, this will be the root page of the report */
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
/**
* This method will render the page and the subpages recursivly
*
* @param summary The summary object
* @param page Page to render
* @param outputDir Root output dir of the report
......@@ -185,7 +204,7 @@ trait ReportBuilder extends ToolCommand {
val pageOutputDir = new File(outputDir, path.mkString(File.separator))
pageOutputDir.mkdirs()
val rootPath = "./" + Array.fill(path.size)("../").mkString("")
val rootPath = "./" + Array.fill(path.size)("../").mkString
val pageArgs = args ++ page.args ++
Map("page" -> page,
"path" -> path,
......@@ -194,8 +213,9 @@ trait ReportBuilder extends ToolCommand {
)
// Generating subpages
val jobs = for ((name, subPage) <- page.subPages.par) yield {
generatePage(summary, subPage, outputDir, path ::: name :: Nil, pageArgs)
val jobs = page.subPages.par.flatMap {
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",
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
......@@ -37,7 +36,7 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript =>
private[summary] var summaryQScripts: List[SummaryQScript] = Nil
/** Name of the pipeline in the summary */
var summaryName = configName
var summaryName = configNamespace
/** Must return a map with used settings for this pipeline */
def summarySettings: Map[String, Any]
......@@ -103,7 +102,7 @@ trait SummaryQScript extends BiopetQScript { qscript: QScript =>
if (writeSummary.md5sum) {
if (!SummaryQScript.md5sumCache.contains(file)) {
val md5sum = new Md5sum(this) {
override def configName = "md5sum"
override def configNamespace = "md5sum"
override def cmdLine: String = super.cmdLine + " || " +
required("echo") + required("error_on_capture " + input.toString) + " > " + required(output)
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
......@@ -75,16 +74,16 @@ class WriteSummary(val root: Configurable) extends InProcessFunction with Config
def fetchVersion(f: QFunction): Option[(String, Any)] = {
f match {
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_version" -> f.getJavaVersion,
"jar_path" -> f.jarFile))
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),
"path" -> f.executable))
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
}
}
......
......@@ -8,8 +8,7 @@
*
* Contact us at: sasc@lumc.nl
*
* A dual licensing mode is applied. The source code within this project that are
* not part of GATK Queue is freely available for non-commercial use under an AGPL
* A dual licensing mode is applied. The source code within this project 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, please contact us to obtain a separate license.
*/
......
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