Пример #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));
 }