Commit d1f28ea8 authored by Peter van 't Hof's avatar Peter van 't Hof

Alow for multiple configs in BIOPET_CONFIG and BIO_CONFIG_SCATTER

parent e69b6f0c
...@@ -15,6 +15,9 @@ trait BiopetQScript extends Configurable { ...@@ -15,6 +15,9 @@ trait BiopetQScript extends Configurable {
@Argument(doc = "Output directory", fullName = "output_directory", shortName = "outDir", required = true) @Argument(doc = "Output directory", fullName = "output_directory", shortName = "outDir", required = true)
var outputDir: String = _ var outputDir: String = _
@Argument(doc = "Use scatter defaults, env vale BIOPET_CONFIG_SCATTER", shortName = "SC", required = false)
var useScatterDefault: Boolean = false
var outputFiles: Map[String, File] = Map() var outputFiles: Map[String, File] = Map()
var qSettings: QSettings var qSettings: QSettings
...@@ -25,6 +28,7 @@ trait BiopetQScript extends Configurable { ...@@ -25,6 +28,7 @@ trait BiopetQScript extends Configurable {
var functions: Seq[QFunction] var functions: Seq[QFunction]
final def script() { final def script() {
if (useScatterDefault) Config.global.loadDefaultScatterConfig
if (!outputDir.endsWith("/")) outputDir += "/" if (!outputDir.endsWith("/")) outputDir += "/"
init init
biopetScript biopetScript
......
...@@ -12,15 +12,24 @@ class Config(var map: Map[String, Any]) extends Logging { ...@@ -12,15 +12,24 @@ class Config(var map: Map[String, Any]) extends Logging {
loadDefaultConfig() loadDefaultConfig()
} }
def loadDefaultConfig() { def loadConfigEnv(valueName: String) {
var globalFile: String = System.getenv("BIOPET_CONFIG") var globalFiles = System.getenv(valueName).split(":")
if (globalFile != null) { for (globalFile <- globalFiles) {
var file: File = new File(globalFile) var file: File = new File(globalFile)
if (file.exists()) { if (file.exists()) {
logger.info("Loading config file: " + file) logger.info("Loading config file: " + file)
loadConfigFile(file) loadConfigFile(file)
} else logger.warn("BIOPET_CONFIG value found but file does not exist, no global config is loaded") } else logger.warn(valueName + " value found but file does not exist, no global config is loaded")
} else logger.info("BIOPET_CONFIG value not found, no global config is loaded") }
if (globalFiles.isEmpty) logger.info(valueName + " value not found, no global config is loaded")
}
def loadDefaultConfig() {
loadConfigEnv("BIOPET_CONFIG")
}
def loadDefaultScatterConfig() {
loadConfigEnv("BIOPET_CONFIG_SCATTER")
} }
def loadConfigFile(configFile: File) { def loadConfigFile(configFile: File) {
......
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