Skip to content

Commit

Permalink
add tests for SAM files that corrupt with adam + htsjdk 0.20.x (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
heuermh authored and tomwhite committed Sep 12, 2019
1 parent 8dd2362 commit 65cfd22
Show file tree
Hide file tree
Showing 3 changed files with 745 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/test/java/org/disq_bio/disq/HtsjdkReadsRddTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -550,4 +550,24 @@ public void testEnableBAIAndSBI() throws Exception {
Assert.assertTrue(
Files.exists(Paths.get(URI.create(outputPath + SbiWriteOption.getIndexExtension()))));
}

@Test
public void testCorruptedReadNameSAM() throws Exception {
String inputPath = getPath("small.sam");
HtsjdkReadsRddStorage htsjdkReadsRddStorage = HtsjdkReadsRddStorage.makeDefault(jsc);
HtsjdkReadsRdd htsjdkReadsRdd = htsjdkReadsRddStorage.read(inputPath);
SAMRecord record = htsjdkReadsRdd.getReads().first();
Assert.assertEquals("1", record.getReferenceName());
Assert.assertEquals(26472784, record.getStart());
Assert.assertEquals("simread:1:26472783:false", record.getReadName());
}

@Test
public void testCorruptedHeaderSAM() throws Exception {
String inputPath = getPath("flag-values.sam");
HtsjdkReadsRddStorage htsjdkReadsRddStorage = HtsjdkReadsRddStorage.makeDefault(jsc);
HtsjdkReadsRdd htsjdkReadsRdd = htsjdkReadsRddStorage.read(inputPath);
SAMRecord record = htsjdkReadsRdd.getReads().first();
Assert.assertEquals("read:0", record.getReadName());
}
}
Loading

0 comments on commit 65cfd22

Please sign in to comment.