From fdf136943612cc87d00393d11b32a59c2e747cba Mon Sep 17 00:00:00 2001
From: Peter van 't Hof <p.j.van_t_hof@lumc.nl>
Date: Mon, 6 Apr 2015 13:04:43 +0200
Subject: [PATCH] Added manual path set to config

---
 .../lumc/sasc/biopet/core/config/Configurable.scala  | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/Configurable.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/Configurable.scala
index 1a3df9eaf..2f33005c2 100644
--- a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/Configurable.scala
+++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/core/config/Configurable.scala
@@ -52,7 +52,7 @@ trait Configurable extends ImplicitConversions {
    * @param submodule
    * @return
    */
-  def path(sample: String = null, library: String = null, submodule: String = null) = {
+  def getConfigPath(sample: String = null, library: String = null, submodule: String = null) = {
     (if (sample != null) "samples" :: sample :: Nil else Nil) :::
       (if (library != null) "libraries" :: library :: Nil else Nil) :::
       (if (submodule != null) configPath ::: configName :: Nil else configPath)
@@ -91,11 +91,12 @@ trait Configurable extends ImplicitConversions {
               submodule: String = null,
               freeVar: Boolean = true,
               sample: String = null,
-              library: String = null): ConfigValue = {
+              library: String = null,
+              path: List[String] = null): ConfigValue = {
       val s = if (sample != null || defaultSample.isEmpty) sample else defaultSample.get
       val l = if (library != null || defaultLibrary.isEmpty) library else defaultLibrary.get
       val m = if (submodule != null) submodule else configName
-      val p = path(s, l, submodule)
+      val p = if (path == null) getConfigPath(s, l, submodule) else path
       val d = {
         val value = Config.getValueFromMap(defaults.toMap, ConfigValueIndex(m, p, key, freeVar))
         if (value.isDefined) value.get.value else default
@@ -117,11 +118,12 @@ trait Configurable extends ImplicitConversions {
                  submodule: String = null,
                  freeVar: Boolean = true,
                  sample: String = null,
-                 library: String = null) = {
+                 library: String = null,
+                 path: List[String] = null) = {
       val s = if (sample != null || defaultSample.isEmpty) sample else defaultSample.get
       val l = if (library != null || defaultLibrary.isEmpty) library else defaultLibrary.get
       val m = if (submodule != null) submodule else configName
-      val p = path(s, l, submodule)
+      val p = if (path == null) getConfigPath(s, l, submodule) else path
 
       globalConfig.contains(m, p, key, freeVar) || !(Config.getValueFromMap(defaults.toMap, ConfigValueIndex(m, p, key, freeVar)) == None)
     }
-- 
GitLab