JAL-2909 JAL-3894 hack in support to import regions of an unindexed SAM file.
[jalview.git] / src / jalview / datamodel / CigarParser.java
index a42c2b1..113223d 100644 (file)
@@ -9,7 +9,9 @@ import java.util.TreeMap;
 
 import htsjdk.samtools.CigarElement;
 import htsjdk.samtools.CigarOperator;
+import htsjdk.samtools.SAMFormatException;
 import htsjdk.samtools.SAMRecord;
+import jalview.bin.Cache;
 
 public class CigarParser
 {
@@ -291,7 +293,14 @@ public class CigarParser
     do
     {
       // check extent of read
-      SAMRecord rec = it.next();
+      SAMRecord rec = null;
+      try {
+        rec = it.next();
+      } catch (SAMFormatException ex)
+      {
+        Cache.log.info("Bailing on parsing SAM File - see error below",ex);
+        break;
+      }
       if (extent != null)
       {