File: htsjdk-api.patch

package info (click to toggle)
fastqc 0.11.9%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,388 kB
  • sloc: java: 6,900; perl: 285; xml: 56; sh: 33; makefile: 7
file content (50 lines) | stat: -rw-r--r-- 1,525 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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;
 			}
 		}