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

Added Summary class for easy access summary values

parent 922d84e9
package nl.lumc.sasc.biopet.core.summary
import java.io.File
import nl.lumc.sasc.biopet.utils.ConfigUtils
/**
* Created by pjvan_thof on 3/26/15.
*/
class Summary(file: File) {
val map = ConfigUtils.fileToConfigMap(file)
lazy val samples: Set[String] = {
ConfigUtils.getValueFromPath(map, List("samples")) match {
case Some(samples) => ConfigUtils.any2map(samples).keySet
case _ => Set()
}
}
lazy val libraries: Map[String, Set[String]] = {
(for (sample <- samples) yield sample -> {
ConfigUtils.getValueFromPath(map, List("samples", sample, "libraries")) match {
case Some(libs) => ConfigUtils.any2map(libs).keySet
case _ => Set[String]()
}
}).toMap
}
def getValue(path: List[String]): Option[Any] = {
ConfigUtils.getValueFromPath(map, path)
}
}
Supports Markdown
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