예제 #1
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));
  }
예제 #2
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);
 }
예제 #3
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);
 }
예제 #4
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));
 }
예제 #5
0
 @Test
 public void testVerifyQualitySangerOk() {
   frag.setSequence(new Text("AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT"));
   frag.setQuality(new Text("##############################"));
   assertEquals(
       -1,
       SequencedFragment.verifyQuality(
           frag.getQuality(), FormatConstants.BaseQualityEncoding.Sanger));
 }
예제 #6
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());
 }
예제 #7
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));
  }
예제 #8
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());
  }
예제 #9
0
 @Test(expected = IllegalArgumentException.class)
 public void testNoNullQuality() {
   frag.setQuality(null);
 }
예제 #10
0
 @Test
 public void testSerializationWithSeq() throws IOException {
   frag.setSequence(new Text("AGTAGTAGTAGTAGTAGTAGTAGTAGTAGT"));
   frag.setQuality(new Text("##############################"));
   assertEquals(frag, cloneBySerialization(frag));
 }