Package org.broad.igv.variant.vcf

Examples of org.broad.igv.variant.vcf.VCFVariant


        int count = 0;
        boolean found = false;

        while(iter.hasNext()){
            VCFVariant vcfVariant = (VCFVariant) iter.next();
            assertNotNull(vcfVariant);

            if(vcfVariant.getStart() == 3796932){
                assertEquals(9, vcfVariant.getSampleNames().size());
                found = true;
            }

            count++;
        }
View Full Code Here


        if (errorMessage != null) System.out.println(errorMessage);
        assertNull(errorMessage);

        Iterator<VCFVariant> result = getFeature();
        Assert.assertTrue("Empty result after adding call", result.hasNext());
        VCFVariant variant = result.next();
        Assert.assertFalse("Empty result after adding call", result.hasNext());

        assertEquals(chr, variant.getChr());
        assertEquals(start, variant.getStart());
        assertEquals(end, variant.getEnd());
        assertEquals(alleles.get(0), variant.getReference().replace("*", ""));
        int index = 1;
        for (Allele al : variant.getAlternateAlleles()) {
            assertEquals(alleles.get(index++), al.toString());
        }
        assertTrue(variant.getSource().equals(callsetName));

    }
View Full Code Here

        VCFWriterTest.assertHeadersEquals((VCFHeader) inputTrack.getHeader(), (VCFHeader) outputTrack.getHeader());

        int n = 0;
        for (Feature var1 : inputTrack.getFeatures(chr, start, end)) {
            VCFVariant var0 = infeatures.get(n++);
            VCFWriterTest.assertVCFVariantsEqual(var0, (VCFVariant) var1);
        }

        assertEquals("Different number of features from input", infeatures.size(), n);
View Full Code Here

        AbstractFeatureReader basicReader = AbstractFeatureReader.getFeatureReader(vcfFile, codec, true);
        CloseableTribbleIterator it = basicReader.iterator();
        List<VCFVariant> features = new ArrayList<VCFVariant>();
        while (it.hasNext()) {
            VCFVariant next = (VCFVariant) it.next();
            features.add(next);
        }
       // Test the first feature in the file -- this one was failing
        VCFVariant a_6321732 = (VCFVariant) FeatureUtils.getFeatureClosest(6321732.4, features);
        assertEquals("variant closest to 6321732 must be found with position=6321732", 6321732, a_6321732.getStart());


        //Now test a couple right next to each other
        VCFVariant a_6321739 = (VCFVariant) FeatureUtils.getFeatureClosest(6321739.4, features);
        VCFVariant a_6321740 = (VCFVariant) FeatureUtils.getFeatureClosest(6321740.4, features);
        assertEquals("variant closest to 6321739.4 must be found with position=6321739", 6321739, a_6321739.getStart());
        assertEquals("variant closest to 6321740.4 must be found with position=6321740", 6321740, a_6321740.getStart());



    }
View Full Code Here

        int start = 201813161 - 1;
        int end = start + 2;
        int count = 0;
        Iterator<Feature> iterator = source.getFeatures("1", start, end);
        while (iterator.hasNext()) {
            VCFVariant feat = (VCFVariant) iterator.next();
            assertEquals("1", feat.getChr());
            assertEquals(start, feat.getStart());
            assertEquals("rs2248941", feat.getID());
            assertEquals(start + 1, feat.getEnd());
            count++;
        }
        assertEquals(1, count);

    }
View Full Code Here

        VariantContext vc = wrappedCodec.decode(stream);
        if (vc == null) {
            return null;
        }
        String chr = genome == null ? vc.getChr() : genome.getChromosomeAlias(vc.getChr());
        return new VCFVariant(vc, chr);

    }
View Full Code Here

        if (vc == null) {
            return null;
        }
        String chr = genome == null ? vc.getChr() : genome.getChromosomeAlias(vc.getChr());
        return new VCFVariant(vc, chr);

    }
View Full Code Here

        final int end = 182776742;
        final String chr = "1";
        Iterator<VCFVariant> iter = baseReader.query(chr, start, end);

        while (iter.hasNext()) {
            VCFVariant var = iter.next();
            assertEquals(chr, var.getChr());
            assertTrue(var.getEnd() >= start && var.getStart() <= end);
            baseReaderLoci.add(getLocusString(var));
        }
        assertTrue(baseReaderLoci.size() > 0);

        // Now use CachingFeatureReader and insure results are the same
        Set<String> cacheReaderLoci = new HashSet();
        iter = cacheReader.query(chr, start, end);
        while (iter.hasNext()) {
            VCFVariant var = iter.next();
            assertEquals(chr, var.getChr());
            assertTrue(var.getEnd() >= start && var.getStart() <= end);
            cacheReaderLoci.add(getLocusString(var));
        }

        assertEquals(baseReaderLoci.size(), cacheReaderLoci.size());
        for (String locus : cacheReaderLoci) {
View Full Code Here

TOP

Related Classes of org.broad.igv.variant.vcf.VCFVariant

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.