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