Package htsjdk.tribble.readers

Examples of htsjdk.tribble.readers.PositionalBufferedStream


    public void testNoCalls() {
        Pair<VariantContext,VariantContext> data = getData4();
        VariantContext eval = data.getFirst();
        VariantContext truth = data.getSecond();
        VCFCodec codec = new VCFCodec();
        VCFHeader evalHeader = (VCFHeader)codec.readActualHeader(codec.makeSourceFromStream(new PositionalBufferedStream(new StringBufferInputStream(TEST_1_HEADER))));
        VCFHeader compHeader = (VCFHeader)codec.readActualHeader(codec.makeSourceFromStream(new PositionalBufferedStream(new StringBufferInputStream(TEST_1_HEADER))));
        ConcordanceMetrics metrics = new ConcordanceMetrics(evalHeader,compHeader,null);
        metrics.update(eval,truth);
        Assert.assertEquals(metrics.getGenotypeConcordance("test1_sample2").getnMismatchingAlt(),0);
        Assert.assertEquals(metrics.getGenotypeConcordance("test1_sample2").getTable()[2][1],0);
        Assert.assertEquals(metrics.getGenotypeConcordance("test1_sample2").getTable()[0][2],1);
View Full Code Here


    public void testMissing() {
        Pair<VariantContext,VariantContext> data = getData5();
        VariantContext eval = data.getFirst();
        VariantContext truth = data.getSecond();
        VCFCodec codec = new VCFCodec();
        VCFHeader evalHeader = (VCFHeader)codec.readActualHeader(codec.makeSourceFromStream(new PositionalBufferedStream(new StringBufferInputStream(TEST_1_HEADER))));
        VCFHeader compHeader = (VCFHeader)codec.readActualHeader(codec.makeSourceFromStream(new PositionalBufferedStream(new StringBufferInputStream(TEST_1_HEADER))));
        ConcordanceMetrics metrics = new ConcordanceMetrics(evalHeader,compHeader,null);
        metrics.update(eval,truth);
        Assert.assertTrue(eval.getGenotype("test1_sample2").getType().equals(GenotypeType.UNAVAILABLE));
        Assert.assertEquals(metrics.getGenotypeConcordance("test1_sample2").getnMismatchingAlt(),0);
        Assert.assertEquals(metrics.getGenotypeConcordance("test1_sample2").getTable()[2][1],0);
View Full Code Here

        sample2_expected[4] = new int[]{0,1,0,0,0,0};

        List<Pair<VariantContext,VariantContext>> data = getData6();

        VCFCodec codec = new VCFCodec();
        VCFHeader evalHeader = (VCFHeader)codec.readActualHeader(codec.makeSourceFromStream(new PositionalBufferedStream(new StringBufferInputStream(TEST_2_HEADER))));
        VCFHeader compHeader = (VCFHeader)codec.readActualHeader(codec.makeSourceFromStream(new PositionalBufferedStream(new StringBufferInputStream(TEST_2_HEADER))));
        ConcordanceMetrics metrics = new ConcordanceMetrics(evalHeader,compHeader,null);

        for ( Pair<VariantContext,VariantContext> contextPair : data ) {
            VariantContext eval = contextPair.getFirst();
            VariantContext comp = contextPair.getSecond();
View Full Code Here

    public void testNRD_testNRS_testMargins() {
        Pair<VariantContext,VariantContext> data = getData3();
        VariantContext eval = data.getFirst();
        VariantContext truth = data.getSecond();
        VCFCodec codec = new VCFCodec();
        VCFHeader evalHeader = (VCFHeader)codec.readActualHeader(codec.makeSourceFromStream(new PositionalBufferedStream(new StringBufferInputStream(TEST_1_HEADER))));
        VCFHeader compHeader = (VCFHeader)codec.readActualHeader(codec.makeSourceFromStream(new PositionalBufferedStream(new StringBufferInputStream(TEST_1_HEADER))));
        ConcordanceMetrics metrics = new ConcordanceMetrics(evalHeader,compHeader,null);
        int[][] table = metrics.getOverallGenotypeConcordance().getTable();
        // set up the table
        table[0] = new int[] {30, 12, 7, 5, 6, 0};
        table[1] = new int[] {10, 100, 5, 1, 7, 1};
View Full Code Here

    }

    @Test(enabled=true)
    public void testRobustness() {
        VCFCodec codec = new VCFCodec();
        VCFHeader evalHeader = (VCFHeader)codec.readActualHeader(codec.makeSourceFromStream(new PositionalBufferedStream(new StringBufferInputStream(TEST_3_HEADER_1))));
        VCFHeader disjointCompHeader = (VCFHeader)codec.readActualHeader(codec.makeSourceFromStream(new PositionalBufferedStream(new StringBufferInputStream(TEST_3_HEADER_2))));
        VCFHeader overlapCompHeader = (VCFHeader)codec.readActualHeader(codec.makeSourceFromStream(new PositionalBufferedStream(new StringBufferInputStream(TEST_3_HEADER_3))));
        ConcordanceMetrics disjointMetrics = new ConcordanceMetrics(evalHeader,disjointCompHeader,null);
        ConcordanceMetrics overlapMetrics = new ConcordanceMetrics(evalHeader,overlapCompHeader,null);

        // test what happens if you put in disjoint sets and start making requests
        Assert.assertEquals(0,disjointMetrics.getPerSampleGenotypeConcordance().size());
View Full Code Here

    }

    @Test(enabled = true)
    public void testSites() {
        VCFCodec codec = new VCFCodec();
        VCFHeader evalHeader = (VCFHeader)codec.readActualHeader(codec.makeSourceFromStream(new PositionalBufferedStream(new StringBufferInputStream(TEST_2_HEADER))));
        VCFHeader compHeader = (VCFHeader)codec.readActualHeader(codec.makeSourceFromStream(new PositionalBufferedStream(new StringBufferInputStream(TEST_2_HEADER))));
        ConcordanceMetrics metrics = new ConcordanceMetrics(evalHeader,compHeader,null);

        List<Pair<VariantContext,VariantContext>> data = getData7();

        int idx = 0;
View Full Code Here

        final File outputVCF = executeTest("testMultiAllelics", spec).getFirst().get(0);

        final VCFCodec codec = new VCFCodec();
        final FileInputStream originalStream = new FileInputStream(MultiAllelicsTest);
        final LineIterator originalLineIterator = codec.makeSourceFromStream(new PositionalBufferedStream(originalStream));
        codec.readHeader(originalLineIterator);
        int numOriginalRecords = 0;
        while ( originalLineIterator.hasNext() ) {
            originalLineIterator.next();
            numOriginalRecords++;
        }

        final FileInputStream newStream = new FileInputStream(outputVCF);
        final LineIterator newLineIterator = codec.makeSourceFromStream(new PositionalBufferedStream(newStream));
        codec.readHeader(newLineIterator);
        int numNewRecords = 0;
        while ( newLineIterator.hasNext() ) {
            newLineIterator.next();
            numNewRecords++;
View Full Code Here

        final File outputVCFAnn = executeTest("testStrandBiasBySample re-annotation of FisherStrand", specAnn).getFirst().get(0);

        // confirm that the FisherStrand values are identical for the two pipelines
        final VCFCodec codec = new VCFCodec();
        final FileInputStream s = new FileInputStream(outputVCF);
        final LineIterator lineIterator = codec.makeSourceFromStream(new PositionalBufferedStream(s));
        codec.readHeader(lineIterator);

        final VCFCodec codecAnn = new VCFCodec();
        final FileInputStream sAnn = new FileInputStream(outputVCFAnn);
        final LineIterator lineIteratorAnn = codecAnn.makeSourceFromStream(new PositionalBufferedStream(sAnn));
        codecAnn.readHeader(lineIteratorAnn);

        while( lineIterator.hasNext() && lineIteratorAnn.hasNext() ) {
            final String line = lineIterator.next();
            Assert.assertFalse(line == null);
View Full Code Here

        // confirm that the QD values are present in the new file for all biallelic variants
        // QD values won't be identical because some filtered reads are missing during re-annotation

        final VCFCodec codec = new VCFCodec();
        final FileInputStream s = new FileInputStream(outputVCF);
        final LineIterator lineIterator = codec.makeSourceFromStream(new PositionalBufferedStream(s));
        codec.readHeader(lineIterator);

        final VCFCodec codecAnn = new VCFCodec();
        final FileInputStream sAnn = new FileInputStream(outputVCFAnn);
        final LineIterator lineIteratorAnn = codecAnn.makeSourceFromStream(new PositionalBufferedStream(sAnn));
        codecAnn.readHeader(lineIteratorAnn);

        while( lineIterator.hasNext() && lineIteratorAnn.hasNext() ) {
            final String line = lineIterator.next();
            Assert.assertFalse(line == null);
View Full Code Here

    }


    public LineIterator getLineIterator() {
        try {
            return new LineIteratorImpl(LineReaderUtil.fromBufferedStream(new PositionalBufferedStream(new FileInputStream(hapMapFile))));
        } catch (FileNotFoundException e) {
            Assert.fail("Unable to open hapmap file : " + hapMapFile);
        }
        return null; // for intellij, it doesn't know that assert.fail is fatal
    }
View Full Code Here

TOP

Related Classes of htsjdk.tribble.readers.PositionalBufferedStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.