Commit 25aaee6e authored by bow's avatar bow
Browse files

Try to convert numeric values appropriately in Picard metrics parsing

parent 4abb761f
......@@ -70,7 +70,7 @@ class CollectAlignmentSummaryMetrics(val root: Configurable) extends Picard with
case None => Map()
case Some((header, content)) =>
(for (category <- 0 until content.size) yield {
content(category)(0) -> (
content(category)(0).toString -> (
for (
i <- 1 until header.size if i < content(category).size
) yield {
......
......@@ -103,7 +103,7 @@ class MarkDuplicates(val root: Configurable) extends Picard with Summarizable {
case None => Map()
case Some((header, content)) =>
(for (category <- 0 until content.size) yield {
content(category)(0) -> (
content(category)(0).toString -> (
for (
i <- 1 until header.size if i < content(category).size
) yield {
......
......@@ -21,6 +21,7 @@ import scala.io.Source
import org.broadinstitute.gatk.utils.commandline.Argument
import nl.lumc.sasc.biopet.core.BiopetJavaCommandLineFunction
import nl.lumc.sasc.biopet.utils.tryToParseNumber
/**
* General picard extension
......@@ -80,7 +81,7 @@ object Picard {
* @param file input metrics file
* @return (header, content)
*/
def getMetrics(file: File): Option[(Array[String], List[Array[String]])] =
def getMetrics(file: File): Option[(Array[String], List[Array[Any]])] =
if (file.exists) {
val lines = Source.fromFile(file).getLines().toArray
......@@ -88,9 +89,10 @@ object Picard {
val end = lines.indexOf("", start)
val header = lines(start).split("\t")
val content = (for (i <- (start + 1) until end) yield lines(i).split("\t")).toList
val content = (for (i <- (start + 1) until end) yield lines(i).split("\t"))
.map(row => row.map(col => tryToParseNumber(col).getOrElse(col)))
Option((header, content))
Option((header, content.toList))
} else {
None
}
......
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