Commit dcdcb3b5 authored by Sander Bollen's avatar Sander Bollen
Browse files

do not put header in resulting map agian

parent 06b90a21
...@@ -271,7 +271,7 @@ class VariantEffectPredictor(val root: Configurable) extends BiopetCommandLineFu ...@@ -271,7 +271,7 @@ class VariantEffectPredictor(val root: Configurable) extends BiopetCommandLineFu
def parseStatsFile(file: File): Map[String, Any] = { def parseStatsFile(file: File): Map[String, Any] = {
val contents = Source.fromFile(file).getLines().toList val contents = Source.fromFile(file).getLines().toList
val headers = getHeadersFromStatsFile(contents) val headers = getHeadersFromStatsFile(contents)
headers.foldLeft(Map.empty[String, Any])((acc, x) => acc + (x -> getBlockFromStatsFile(contents, x))) headers.foldLeft(Map.empty[String, Any])((acc, x) => acc + (x.replace(" ", "_") -> getBlockFromStatsFile(contents, x)))
} }
def getBlockFromStatsFile(contents: List[String], header: String): Map[String, Any] = { def getBlockFromStatsFile(contents: List[String], header: String): Map[String, Any] = {
...@@ -281,17 +281,17 @@ class VariantEffectPredictor(val root: Configurable) extends BiopetCommandLineFu ...@@ -281,17 +281,17 @@ class VariantEffectPredictor(val root: Configurable) extends BiopetCommandLineFu
val stripped = x.stripPrefix("[").stripSuffix("]") val stripped = x.stripPrefix("[").stripSuffix("]")
if (stripped == header) { if (stripped == header) {
inBlock = true inBlock = true
} else {
if (inBlock) {
val key = stripped.split('\t').head.replace(" ", "_")
val value = stripped.split('\t').last
theMap ++= Map(key -> value)
}
} }
if (stripped == "") { if (stripped == "") {
inBlock = false inBlock = false
} }
if (inBlock) {
val key = stripped.split('\t').head.replace(" ", "_")
val value = stripped.split('\t').last
theMap ++= Map(key -> value)
}
} }
theMap theMap
} }
......
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