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

Fix compile issues

parent ba4a8f95
......@@ -51,7 +51,7 @@ case class Stats(generalStats: mutable.Map[String, mutable.Map[String, mutable.M
}
/** Function to write 1 specific general field */
def writeField(field: String, chr: String = "total"): Map[String, Array[Any]] = {
def writeField2(field: String, chr: String = "total"): Map[String, Array[Any]] = {
val data = this.generalStats.getOrElse(chr, mutable.Map[String, mutable.Map[Any, Int]]()).getOrElse(field, mutable.Map[Any, Int]())
val rows = for (key <- data.keySet.toArray.sortWith(sortAnyAny)) yield {
......@@ -82,7 +82,7 @@ case class Stats(generalStats: mutable.Map[String, mutable.Map[String, mutable.M
}
/** Function to write 1 specific genotype field */
def writeGenotypeField(samples: List[String], field: String, chr: String = "total"): Map[String, Map[String, Any]] = {
def writeGenotypeField2(samples: List[String], field: String, chr: String = "total"): Map[String, Map[String, Any]] = {
val keySet = (for (sample <- samples) yield this.samplesStats(sample).genotypeStats.getOrElse(chr, Map[String, Map[Any, Int]]()).getOrElse(field, Map[Any, Int]()).keySet).fold(Set[Any]())(_ ++ _)
(for (sample <- samples) yield sample -> {
......
......@@ -19,11 +19,12 @@ import java.nio.file.{Files, Paths}
import htsjdk.variant.variantcontext.Allele
import htsjdk.variant.vcf.VCFFileReader
import nl.lumc.sasc.biopet.tools.vcfstats.VcfStats
import nl.lumc.sasc.biopet.tools.vcfstats.{SampleStats, SampleToSampleStats, Stats, VcfStats}
import nl.lumc.sasc.biopet.tools.vcfstats.VcfStats._
import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite
import org.testng.annotations.Test
import nl.lumc.sasc.biopet.utils.sortAnyAny
import scala.collection.mutable
......@@ -129,18 +130,18 @@ class VcfStatsTest extends TestNGSuite with Matchers {
val m1: mutable.Map[Any, Int] = mutable.Map("a" -> 1)
val m2: mutable.Map[Any, Int] = mutable.Map("b" -> 2)
mergeStatsMap(m1, m2)
Stats.mergeStatsMap(m1, m2)
m1 should equal(mutable.Map("a" -> 1, "b" -> 2))
val m3: mutable.Map[Any, Int] = mutable.Map(1 -> 500)
val m4: mutable.Map[Any, Int] = mutable.Map(6 -> 125)
mergeStatsMap(m3, m4)
Stats.mergeStatsMap(m3, m4)
m3 should equal(mutable.Map(1 -> 500, 6 -> 125))
mergeStatsMap(m1, m3)
Stats.mergeStatsMap(m1, m3)
m1 should equal(mutable.Map("a" -> 1, "b" -> 2, 1 -> 500, 6 -> 125))
}
......@@ -152,7 +153,7 @@ class VcfStatsTest extends TestNGSuite with Matchers {
val m2: Map[String, Map[String, Map[Any, Int]]] = Map("test" ->
Map("nested" -> Map("b" -> 2)))
mergeNestedStatsMap(m1, m2)
Stats.mergeNestedStatsMap(m1, m2)
m1 should equal(mutable.Map("test" -> mutable.Map("nested" -> mutable.Map("a" -> 1, "b" -> 2))))
......@@ -161,13 +162,13 @@ class VcfStatsTest extends TestNGSuite with Matchers {
val m4: Map[String, Map[String, Map[Any, Int]]] = Map("test" ->
Map("nestedd" -> Map(6 -> 125)))
mergeNestedStatsMap(m3, m4)
Stats.mergeNestedStatsMap(m3, m4)
m3 should equal(mutable.Map("test" -> mutable.Map("nestedd" -> mutable.Map(1 -> 500, 6 -> 125))))
val m5 = m3.toMap.map(x => x._1 -> x._2.toMap.map(y => y._1 -> y._2.toMap))
mergeNestedStatsMap(m1, m5)
Stats.mergeNestedStatsMap(m1, m5)
m1 should equal(mutable.Map("test" -> mutable.Map("nested" -> mutable.Map("a" -> 1, "b" -> 2),
"nestedd" -> mutable.Map(1 -> 500, 6 -> 125))))
......
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