Commit 6b9c8e37 authored by Peter van 't Hof's avatar Peter van 't Hof

Adding workaround for issue #180

parent 4b3972ae
......@@ -55,6 +55,11 @@ object SamplesTsvToJson extends ToolCommand {
require(header.length == values.length, "Number columns is not the same as the header")
val sample = values(sampleColumn)
val library = if (libraryColumn != -1) Some(values(libraryColumn)) else None
//FIXME: this is a workaround, should be removed after fixing #180
if (sample.head.isDigit || library.forall(_.head.isDigit))
throw new IllegalStateException("Sample or library may not start with a number")
if (sampleLibCache.contains((sample, library)))
throw new IllegalStateException(s"Combination of $sample and $library is found multiple times")
else sampleLibCache.add((sample, library))
......@@ -63,7 +68,7 @@ object SamplesTsvToJson extends ToolCommand {
) yield header(t) -> values(t)).toMap
library match {
case Some(lib) => Map("samples" -> Map(sample -> Map("libraries" -> Map(library -> valuesMap))))
case _ => Map("samples" -> Map(sample -> valuesMap))
case _ => Map("samples" -> Map(sample -> valuesMap))
}
}
librariesValues.foldLeft(Map[String, Any]())((acc, kv) => mergeMaps(acc, kv))
......
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