VcfReader { public static Iterable<VcfSample> samples(final Readable readable) throws IOException { return VcfSampleParser.samples(readable); } private  VcfReader(); static void parse(final Readable readable, final VcfParseListener listener); static void stream(final Readable readable, final VcfStreamListener listener); static VcfHeader header(final Readable readable); static Iterable<VcfSample> samples(final Readable readable); static Iterable<VcfRecord> records(final Readable readable); static VcfHeader header(final File file); static VcfHeader header(final URL url); static VcfHeader header(final InputStream inputStream); static Iterable<VcfSample> samples(final File file); static Iterable<VcfSample> samples(final URL url); static Iterable<VcfSample> samples(final InputStream inputStream); static Iterable<VcfRecord> records(final File file); static Iterable<VcfRecord> records(final URL url); static Iterable<VcfRecord> records(final InputStream inputStream);  }
@Test(expected=NullPointerException.class) public void testSamplesNullReadable() throws Exception { samples((Readable) null); }
@Test public void testSamplesEmptyReadable() throws Exception { samples(emptyReadable); }
@Test public void testSamples() throws Exception { Iterable<VcfSample> samples = samples(readable); assertNotNull(samples); assertTrue(ImmutableList.copyOf(samples).isEmpty()); }
@Test(expected=NullPointerException.class) public void testSamplesNullFile() throws Exception { samples((File) null); }
@Test public void testSamplesFile() throws Exception { validateSamples(samples(createFile(VCF))); }
@Test(expected=NullPointerException.class) public void testSamplesNullURL() throws Exception { samples((URL) null); }
@Test public void testSamplesURL() throws Exception { validateSamples(samples(createURL(VCF))); }
@Test(expected=NullPointerException.class) public void testSamplesNullInputStream() throws Exception { samples((InputStream) null); }
@Test public void testSamplesInputStream() throws Exception { validateSamples(samples(createInputStream(VCF))); }
@Test public void testSamplesFullHeader() throws Exception { Iterable<VcfSample> samples = samples(createInputStream("chr22-header.vcf")); assertEquals(1092, ImmutableList.copyOf(samples).size()); }
@Test public void testSamplesWithGenomes() throws Exception { int count = 0; for (VcfSample sample : samples(createInputStream("samples.vcf"))) { assertNotNull(sample); if ("Blood".equals(sample.getId())) { assertNotNull(sample.getGenomes()); assertEquals(1, sample.getGenomes().length); VcfGenome genome = sample.getGenomes()[0]; assertEquals("Germline", genome.getId()); assertEquals(1.0d, genome.getMixture(), 0.1d); assertEquals("Patient germline genome", genome.getDescription()); } else if ("TissueSample".equals(sample.getId())) { assertNotNull(sample.getGenomes()); assertEquals(2, sample.getGenomes().length); VcfGenome germline = sample.getGenomes()[0]; assertEquals("Germline", germline.getId()); assertEquals(0.3d, germline.getMixture(), 0.01d); assertEquals("Patient germline genome", germline.getDescription()); VcfGenome tumor = sample.getGenomes()[1]; assertEquals("Tumor", tumor.getId()); assertEquals(0.7d, tumor.getMixture(), 0.01d); assertEquals("Patient tumor genome", tumor.getDescription()); } count++; } assertEquals(2, count); }