Description: use correct SamReader API
Author: Sascha Steinbiss <satta@debian.org>
--- a/uk/ac/babraham/FastQC/Sequence/BAMFile.java
+++ b/uk/ac/babraham/FastQC/Sequence/BAMFile.java
@@ -27,7 +27,9 @@
 
 import htsjdk.samtools.CigarElement;
 import htsjdk.samtools.CigarOperator;
-import htsjdk.samtools.SAMFileReader;
+import htsjdk.samtools.SamInputResource;
+import htsjdk.samtools.SamReader;
+import htsjdk.samtools.SamReaderFactory;
 import htsjdk.samtools.SAMFormatException;
 import htsjdk.samtools.SAMRecord;
 import htsjdk.samtools.ValidationStringency;
@@ -44,7 +46,7 @@
 	// only way to access the file pointer.
 	private FileInputStream fis;
 
-	private SAMFileReader br;
+	private SamReader br;
 	private String name;
 	private Sequence nextSequence = null;
 	Iterator<SAMRecord> it;
@@ -56,11 +58,12 @@
 		name = file.getName();
 		this.onlyMapped = onlyMapped;
 
-		SAMFileReader.setDefaultValidationStringency(ValidationStringency.SILENT);
-
 		fis = new FileInputStream(file);
-		
-		br = new SAMFileReader(fis);
+
+		SamInputResource sir = SamInputResource.of(fis);
+		SamReaderFactory srf = SamReaderFactory.makeDefault().validationStringency(ValidationStringency.SILENT);
+
+		br = srf.open(sir);
 		
 		it = br.iterator();
 		readNext();
@@ -135,7 +138,7 @@
 		// through the file.
 		if (recordSize == 0) {
 			recordSize = (record.getReadLength()*2)+150;
-			if (br.isBinary()) {
+			if (br.type() == SamReader.Type.BAM_TYPE || br.type() == SamReader.Type.CRAM_TYPE) {
 				recordSize /= 4;
 			}
 		}
