From cdc3eea0780c73890eb81c93f99e3355f14fe028 Mon Sep 17 00:00:00 2001
From: Peter van 't Hof <p.j.van_t_hof@lumc.nl>
Date: Mon, 25 Jul 2016 10:26:54 +0200
Subject: [PATCH] Added index check

---
 .../src/main/scala/nl/lumc/sasc/biopet/tools/BaseCounter.scala   | 1 +
 1 file changed, 1 insertion(+)

diff --git a/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/BaseCounter.scala b/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/BaseCounter.scala
index e9817cc90..7745f85dd 100644
--- a/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/BaseCounter.scala
+++ b/biopet-tools/src/main/scala/nl/lumc/sasc/biopet/tools/BaseCounter.scala
@@ -63,6 +63,7 @@ object BaseCounter extends ToolCommand {
     logger.info("Start reading RefFlat file")
 
     val bamReader = SamReaderFactory.makeDefault().open(cmdArgs.bamFile)
+    require(bamReader.hasIndex, "Bamfile require an index")
     val geneReader = GeneAnnotationReader.loadRefFlat(cmdArgs.refFlat, bamReader.getFileHeader.getSequenceDictionary)
     bamReader.close()
     logger.info("Done reading RefFlat file")
-- 
GitLab