Search in sources :

Example 1 with LineReader

use of htsjdk.tribble.readers.LineReader in project gatk by broadinstitute.

the class TableCodecUnitTest method testDecodeFailsNoHeader.

@Test(expectedExceptions = UserException.MalformedFile.class)
public void testDecodeFailsNoHeader() {
    TableCodec tc = new TableCodec();
    LineReader reader = makeReader(asList("1:1  1   2   3"));
    LineIterator li = new LineIteratorImpl(reader);
    tc.readActualHeader(li);
}
Also used : LineReader(htsjdk.tribble.readers.LineReader) LineIteratorImpl(htsjdk.tribble.readers.LineIteratorImpl) LineIterator(htsjdk.tribble.readers.LineIterator) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 2 with LineReader

use of htsjdk.tribble.readers.LineReader in project gatk by broadinstitute.

the class TableCodecUnitTest method testDecodeOnlyComments.

@Test
public void testDecodeOnlyComments() {
    TableCodec tc = new TableCodec();
    LineReader reader = makeReader(asList("#HEADER a b c", "#HEADER d e f"));
    LineIterator li = new LineIteratorImpl(reader);
    final List<String> strings = tc.readActualHeader(li);
    Assert.assertEquals(strings, emptyList());
}
Also used : LineReader(htsjdk.tribble.readers.LineReader) LineIteratorImpl(htsjdk.tribble.readers.LineIteratorImpl) LineIterator(htsjdk.tribble.readers.LineIterator) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 3 with LineReader

use of htsjdk.tribble.readers.LineReader in project gatk by broadinstitute.

the class TableCodecUnitTest method testTwoHeaders.

@Test
public void testTwoHeaders() {
    TableCodec tc = new TableCodec();
    LineReader reader = makeReader(asList("HEADER a b c", "HEADER d e f"));
    LineIterator li = new LineIteratorImpl(reader);
    final List<String> strings = tc.readActualHeader(li);
    Assert.assertEquals(strings, asList("HEADER", "a", "b", "c"));
}
Also used : LineReader(htsjdk.tribble.readers.LineReader) LineIteratorImpl(htsjdk.tribble.readers.LineIteratorImpl) LineIterator(htsjdk.tribble.readers.LineIterator) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 4 with LineReader

use of htsjdk.tribble.readers.LineReader in project gatk by broadinstitute.

the class TableCodecUnitTest method testDecodeHeader.

@Test
public void testDecodeHeader() {
    TableCodec tc = new TableCodec();
    LineReader reader = makeReader(asList("HEADER a b c"));
    LineIterator li = new LineIteratorImpl(reader);
    List<String> hd = tc.readActualHeader(li);
    Assert.assertEquals(hd, asList("HEADER", "a", "b", "c"));
}
Also used : LineReader(htsjdk.tribble.readers.LineReader) LineIteratorImpl(htsjdk.tribble.readers.LineIteratorImpl) LineIterator(htsjdk.tribble.readers.LineIterator) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Example 5 with LineReader

use of htsjdk.tribble.readers.LineReader in project gatk by broadinstitute.

the class TableCodecUnitTest method testDecodeHeader2.

@Test
public void testDecodeHeader2() {
    TableCodec tc = new TableCodec();
    final String str2 = "1:1  1   2   3";
    LineReader reader = makeReader(asList("HEADER a b c", str2));
    LineIterator li = new LineIteratorImpl(reader);
    List<String> hd = tc.readActualHeader(li);
    Assert.assertEquals(hd, asList("HEADER", "a", "b", "c"));
    final TableFeature decode = tc.decode(str2);
    Assert.assertEquals(decode.get("a"), "1");
    Assert.assertEquals(decode.get("b"), "2");
    Assert.assertEquals(decode.get("c"), "3");
    Assert.assertEquals(decode.getLocation().getContig(), "1");
    Assert.assertEquals(decode.getContig(), "1");
    Assert.assertEquals(decode.getLocation().getStart(), 1);
    Assert.assertEquals(decode.getLocation().getEnd(), 1);
}
Also used : LineReader(htsjdk.tribble.readers.LineReader) LineIteratorImpl(htsjdk.tribble.readers.LineIteratorImpl) LineIterator(htsjdk.tribble.readers.LineIterator) BaseTest(org.broadinstitute.hellbender.utils.test.BaseTest) Test(org.testng.annotations.Test)

Aggregations

LineIterator (htsjdk.tribble.readers.LineIterator)6 LineIteratorImpl (htsjdk.tribble.readers.LineIteratorImpl)6 LineReader (htsjdk.tribble.readers.LineReader)6 BaseTest (org.broadinstitute.hellbender.utils.test.BaseTest)6 Test (org.testng.annotations.Test)6