예제 #1
0
 @Test
 public void testEqualsFilterPassed() {
   frag.setFilterPassed(false);
   assertFalse(frag.equals(frag2));
   frag2.setFilterPassed(false);
   assertTrue(frag.equals(frag2));
 }
예제 #2
0
 @Test
 public void testEqualsControlNumber() {
   frag.setControlNumber(314);
   assertFalse(frag.equals(frag2));
   frag2.setControlNumber(314);
   assertTrue(frag.equals(frag2));
 }
예제 #3
0
 @Test
 public void testEqualsYpos() {
   frag.setYpos(1234);
   assertFalse(frag.equals(frag2));
   frag2.setYpos(1234);
   assertTrue(frag.equals(frag2));
 }
예제 #4
0
 @Test
 public void testEqualsRead() {
   frag.setRead(2);
   assertFalse(frag.equals(frag2));
   frag2.setRead(2);
   assertTrue(frag.equals(frag2));
 }
예제 #5
0
 @Test
 public void testEqualsTile() {
   frag.setTile(1000);
   assertFalse(frag.equals(frag2));
   frag2.setTile(1000);
   assertTrue(frag.equals(frag2));
 }
예제 #6
0
 @Test
 public void testEqualsLane() {
   frag.setLane(2);
   assertFalse(frag.equals(frag2));
   frag2.setLane(2);
   assertTrue(frag.equals(frag2));
 }
예제 #7
0
 @Test
 public void testEqualsFlowcellId() {
   frag.setFlowcellId("id");
   assertFalse(frag.equals(frag2));
   frag2.setFlowcellId("id");
   assertTrue(frag.equals(frag2));
 }
예제 #8
0
 @Test
 public void testEqualsIndexSequence() {
   frag.setIndexSequence("ABC");
   assertFalse(frag.equals(frag2));
   frag2.setIndexSequence("ABC");
   assertTrue(frag.equals(frag2));
 }
예제 #9
0
 @Test
 public void testEqualsSequence() {
   frag.getSequence().append("AAAA".getBytes(), 0, 4);
   assertFalse(frag.equals(frag2));
   frag2.getSequence().append("AAAA".getBytes(), 0, 4);
   assertTrue(frag.equals(frag2));
 }
예제 #10
0
 @Test
 public void testEqualsInstrument() {
   frag.setInstrument("instrument");
   assertFalse(frag.equals(frag2));
   frag2.setInstrument("instrument");
   assertTrue(frag.equals(frag2));
 }
예제 #11
0
 @Test
 public void testEqualsRunNumber() {
   frag.setRunNumber(240);
   assertFalse(frag.equals(frag2));
   frag2.setRunNumber(240);
   assertTrue(frag.equals(frag2));
 }
예제 #12
0
 @Test(expected = FormatException.class)
 public void testConvertQualitySangerUnderRange() {
   frag.setSequence(new Text("AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT"));
   frag.setQuality(new Text("### ##########################"));
   SequencedFragment.convertQuality(
       frag.getQuality(),
       FormatConstants.BaseQualityEncoding.Sanger,
       FormatConstants.BaseQualityEncoding.Illumina);
 }
예제 #13
0
 @Test(expected = IllegalArgumentException.class)
 public void testConvertQualityNoop() {
   frag.setSequence(new Text("AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT"));
   frag.setQuality(new Text("[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["));
   SequencedFragment.convertQuality(
       frag.getQuality(),
       FormatConstants.BaseQualityEncoding.Sanger,
       FormatConstants.BaseQualityEncoding.Sanger);
 }
예제 #14
0
 @Test
 public void testVerifyQualityIlluminaOutOfRange() {
   frag.setSequence(new Text("AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT"));
   frag.setQuality(new Text("zzz=zzzzzzzzzzzzzzzzzzzzzzzzzz"));
   assertEquals(
       3,
       SequencedFragment.verifyQuality(
           frag.getQuality(), FormatConstants.BaseQualityEncoding.Illumina));
 }
예제 #15
0
 @Test
 public void testVerifyQualitySangerOk() {
   frag.setSequence(new Text("AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT"));
   frag.setQuality(new Text("##############################"));
   assertEquals(
       -1,
       SequencedFragment.verifyQuality(
           frag.getQuality(), FormatConstants.BaseQualityEncoding.Sanger));
 }
예제 #16
0
 @Test
 public void testConvertQualitySangerToIllumina() {
   frag.setSequence(new Text("AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT"));
   frag.setQuality(new Text("[[[[[[[[[[[[[[[[[[[[[[[[[[[[[["));
   SequencedFragment.convertQuality(
       frag.getQuality(),
       FormatConstants.BaseQualityEncoding.Sanger,
       FormatConstants.BaseQualityEncoding.Illumina);
   assertEquals("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzz", frag.getQuality().toString());
 }
예제 #17
0
  ///////////////////////////////////////////////////////////////
  // serialization
  ///////////////////////////////////////////////////////////////
  private static SequencedFragment cloneBySerialization(SequencedFragment original)
      throws IOException {
    ByteArrayOutputStream outputBuffer = new ByteArrayOutputStream();
    DataOutputStream dataOutput = new DataOutputStream(outputBuffer);
    original.write(dataOutput);
    dataOutput.close();

    SequencedFragment newFrag = new SequencedFragment();
    newFrag.readFields(new DataInputStream(new ByteArrayInputStream(outputBuffer.toByteArray())));

    return newFrag;
  }
예제 #18
0
  @Test
  public void testSerializationWithFields() throws IOException {
    frag.setSequence(new Text("AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT"));
    frag.setQuality(new Text("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB"));

    frag.setInstrument("machine");
    frag.setLane(3);
    frag.setRead(1);
    frag.setIndexSequence("CAT");

    assertEquals(frag, cloneBySerialization(frag));
  }
예제 #19
0
  @Test
  public void testVerifyQualitySangerOutOfRange() {
    frag.setSequence(new Text("AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT"));
    frag.setQuality(
        new Text("#############################" + Character.toString((char) 127))); // over range
    assertEquals(
        29,
        SequencedFragment.verifyQuality(
            frag.getQuality(), FormatConstants.BaseQualityEncoding.Sanger));

    frag.setQuality(new Text("##### ########################")); // under range
    assertEquals(
        5,
        SequencedFragment.verifyQuality(
            frag.getQuality(), FormatConstants.BaseQualityEncoding.Sanger));
  }
예제 #20
0
 @Test(expected = IllegalArgumentException.class)
 public void testNoNullQuality() {
   frag.setQuality(null);
 }
예제 #21
0
 @Test(expected = IllegalArgumentException.class)
 public void testNoNullSequence() {
   frag.setSequence(null);
 }
예제 #22
0
  @Test
  public void testInitialState() {
    assertNotNull(frag.getSequence());
    assertNotNull(frag.getQuality());

    assertNull(frag.getInstrument());
    assertNull(frag.getRunNumber());
    assertNull(frag.getFlowcellId());
    assertNull(frag.getLane());
    assertNull(frag.getTile());
    assertNull(frag.getXpos());
    assertNull(frag.getYpos());
    assertNull(frag.getRead());
    assertNull(frag.getFilterPassed());
    assertNull(frag.getControlNumber());
    assertNull(frag.getIndexSequence());

    assertNotNull(frag.toString());
  }
예제 #23
0
  @Test
  public void testToString() {
    String seq = "AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT";
    String qual = "##############################";
    frag.setSequence(new Text(seq));
    frag.setQuality(new Text(qual));

    frag.setInstrument("machine");
    frag.setRunNumber(123);
    frag.setFlowcellId("flowcell");
    frag.setLane(3);
    frag.setTile(1001);
    frag.setXpos(1234);
    frag.setYpos(4321);
    frag.setIndexSequence("CAT");
    frag.setRead(1);

    assertEquals(
        "machine\t123\tflowcell\t3\t1001\t1234\t4321\tCAT\t1\t" + seq + "\t" + qual + "\t1",
        frag.toString());
  }
예제 #24
0
 @Test
 public void testSerializationWithSeq() throws IOException {
   frag.setSequence(new Text("AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT"));
   frag.setQuality(new Text("##############################"));
   assertEquals(frag, cloneBySerialization(frag));
 }