From 99b31701a60b5fec77c1f88e170f068149c57250 Mon Sep 17 00:00:00 2001
From: Peter van 't Hof <p.j.van_t_hof@lumc.nl>
Date: Thu, 21 Jul 2016 15:46:07 +0200
Subject: [PATCH] Fixed number of bins

---
 .../scala/nl/lumc/sasc/biopet/tools/bamstats/BamStats.scala  | 5 +++--
 .../shiva/variantcallers/HaploTypeCallerGvcfTest.scala       | 4 ++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/bamstats/BamStats.scala b/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/bamstats/BamStats.scala
index e40f3614a..530614d2f 100644
--- a/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/bamstats/BamStats.scala
+++ b/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/bamstats/BamStats.scala
@@ -109,9 +109,10 @@ object BamStats extends ToolCommand {
   def processContig(region: BedRecord, bamFile: File, binSize: Int, threadBinSize: Int, outputDir: File): Stats = {
     val scattersFutures = region
       .scatter(binSize)
-      .grouped((region.length.toDouble / threadBinSize).ceil.toInt)
+      .grouped((region.length.toDouble / binSize).ceil.toInt / (region.length.toDouble / threadBinSize).ceil.toInt)
       .map(scatters => Future { processThread(scatters, bamFile) })
-    val stats = waitOnFutures(scattersFutures.toList, Some(region.chr))
+      .toList
+    val stats = waitOnFutures(scattersFutures, Some(region.chr))
     val contigDir = new File(outputDir, "contigs" + File.separator + region.chr)
     contigDir.mkdirs()
     stats.writeStatsToFiles(contigDir)
diff --git a/shiva/src/test/scala/nl/lumc/sasc/biopet/pipelines/shiva/variantcallers/HaploTypeCallerGvcfTest.scala b/shiva/src/test/scala/nl/lumc/sasc/biopet/pipelines/shiva/variantcallers/HaploTypeCallerGvcfTest.scala
index f07376157..f028be3ce 100644
--- a/shiva/src/test/scala/nl/lumc/sasc/biopet/pipelines/shiva/variantcallers/HaploTypeCallerGvcfTest.scala
+++ b/shiva/src/test/scala/nl/lumc/sasc/biopet/pipelines/shiva/variantcallers/HaploTypeCallerGvcfTest.scala
@@ -7,8 +7,8 @@ import org.scalatest.testng.TestNGSuite
 import org.testng.annotations.Test
 
 /**
-  * Created by Sander Bollen on 13-7-16.
-  */
+ * Created by Sander Bollen on 13-7-16.
+ */
 class HaploTypeCallerGvcfTest extends TestNGSuite with Matchers {
 
   @Test
-- 
GitLab