예제 #1
0
 @Test
 public void basicReadIteratorTest() {
   StingSAMIterator iter = ArtificialSAMUtils.mappedReadIterator(1, 100, 100);
   int count = 0;
   while (iter.hasNext()) {
     SAMRecord rec = iter.next();
     count++;
   }
   assertEquals(count, 100 * 100);
 }
예제 #2
0
  @Test
  public void onePerChromosome() {
    StingSAMIterator iter = ArtificialSAMUtils.mappedReadIterator(1, 100, 1);
    int count = 0;
    while (iter.hasNext()) {
      SAMRecord rec = iter.next();

      assertEquals(Integer.valueOf(count), rec.getReferenceIndex());
      count++;
    }
    assertEquals(count, 100 * 1);
  }
예제 #3
0
  @Test
  public void basicUnmappedIteratorTest() {
    StingSAMIterator iter = ArtificialSAMUtils.mappedAndUnmappedReadIterator(1, 100, 100, 1000);
    int count = 0;
    for (int x = 0; x < (100 * 100); x++) {
      if (!iter.hasNext()) {
        fail("we didn't get the expected number of reads");
      }
      SAMRecord rec = iter.next();
      assertTrue(rec.getReferenceIndex() >= 0);
      count++;
    }
    assertEquals(100 * 100, count);

    // now we should have 1000 unmapped reads
    count = 0;
    while (iter.hasNext()) {
      SAMRecord rec = iter.next();
      assertTrue(rec.getReferenceIndex() < 0);
      count++;
    }
    assertEquals(count, 1000);
  }