Examples of VCFCodec


Examples of htsjdk.variant.vcf.VCFCodec

                // todo -- currently we only understand VCF files! Blow up since we can't test them
                throw new GATKException("Found an index created for file " + resultFile + " but we can only validate VCF files.  Extend this code!");
            }

            System.out.println("Verifying on-the-fly index " + indexFile + " for test " + name + " using file " + resultFile);
            Index indexFromOutputFile = IndexFactory.createDynamicIndex(resultFile, new VCFCodec());
            Index dynamicIndex = IndexFactory.loadIndex(indexFile.getAbsolutePath());

            if ( ! indexFromOutputFile.equalsIgnoreProperties(dynamicIndex) ) {
                Assert.fail(String.format("Index on disk from indexing on the fly not equal to the index created after the run completed.  FileIndex %s vs. on-the-fly %s%n",
                        indexFromOutputFile.getProperties(),
View Full Code Here

Examples of htsjdk.variant.vcf.VCFCodec

                " -V " + privateTestDir + "NA12878.WGS.b37.chr20.firstMB.vcf"
                + " -o %s -L 20:61098",
                1, Arrays.asList(""));
        spec.disableShadowBCF();
        final File vcf = executeTest("testGATKVersionInVCF", spec).first.get(0);
        final VCFCodec codec = new VCFCodec();
        final VCFHeader header = (VCFHeader) codec.readActualHeader(codec.makeSourceFromStream(new FileInputStream(vcf)));
        final VCFHeaderLine versionLine = header.getMetaDataLine(GATKVCFUtils.GATK_COMMAND_LINE_KEY);
        Assert.assertNotNull(versionLine);
        Assert.assertTrue(versionLine.toString().contains("SelectVariants"));
    }
View Full Code Here

Examples of htsjdk.variant.vcf.VCFCodec

                " -V " + privateTestDir + "gatkCommandLineInHeader.vcf"
                + " -o %s",
                1, Arrays.asList(""));
        spec.disableShadowBCF();
        final File vcf = executeTest("testMultipleGATKVersionsInVCF", spec).first.get(0);
        final VCFCodec codec = new VCFCodec();
        final VCFHeader header = (VCFHeader) codec.readActualHeader(codec.makeSourceFromStream(new FileInputStream(vcf)));

        boolean foundHC = false;
        boolean foundSV = false;
        for ( final VCFHeaderLine line : header.getMetaDataInInputOrder() ) {
            if ( line.getKey().equals(GATKVCFUtils.GATK_COMMAND_LINE_KEY) ) {
View Full Code Here

Examples of htsjdk.variant.vcf.VCFCodec

        final File outputVCF = executeTest("testOnTheFlySampleRenamingSingleSampleVCF", spec).first.get(0);
        verifySampleRenaming(outputVCF, "newSampleForNA12878");
    }

    private void verifySampleRenaming( final File outputVCF, final String newSampleName ) throws IOException {
        final Pair<VCFHeader, GATKVCFUtils.VCIterable<LineIterator>> headerAndVCIter = GATKVCFUtils.readAllVCs(outputVCF, new VCFCodec());
        final VCFHeader header = headerAndVCIter.getFirst();
        final GATKVCFUtils.VCIterable<LineIterator> iter = headerAndVCIter.getSecond();

        // Verify that sample renaming occurred at both the header and record levels (checking only the first 10 records):
View Full Code Here

Examples of htsjdk.variant.vcf.VCFCodec

    @Test
    public void testDisableAutoIndexGeneration() throws IOException {
        final File unindexedVCF = new File(privateTestDir + "unindexed.vcf");
        final File unindexedVCFIndex = Tribble.indexFile(unindexedVCF);

        Index index = builder.loadIndex(unindexedVCF, new VCFCodec());

        Assert.assertFalse(unindexedVCFIndex.exists());
        Assert.assertNotNull(index);
    }
View Full Code Here

Examples of htsjdk.variant.vcf.VCFCodec

        final Index index = builder.loadFromDisk(tempVCFWithCorrectIndex, tempVCFIndexFile);

        Assert.assertNotNull(index);
        Assert.assertTrue(tempVCFIndexFile.exists());

        final Index inMemoryIndex = builder.createIndexInMemory(tempVCFWithCorrectIndex, new VCFCodec());
        Assert.assertTrue(index.equalsIgnoreProperties(inMemoryIndex));
    }
View Full Code Here

Examples of htsjdk.variant.vcf.VCFCodec

    public void testCloseFilePointers() throws IOException {
        final String chr = "20";
        IndexedFastaSequenceFile seq = new CachingIndexedFastaSequenceFile(new File(BaseTest.hg19Reference));
        GenomeLocParser parser = new GenomeLocParser(seq);
        File file = new File(privateTestDir + "NA12878.hg19.example1.vcf");
        VCFCodec codec = new VCFCodec();
        TestFeatureReader reader = new TestFeatureReader(file.getAbsolutePath(), codec);
        CheckableCloseableTribbleIterator<Feature> tribbleIterator = reader.query(chr, 1, 100000);
        FeatureToGATKFeatureIterator gatkIterator = new FeatureToGATKFeatureIterator(parser, tribbleIterator, "test");
        Assert.assertTrue(gatkIterator.hasNext(), "GATK feature iterator does not have a next value.");
        GenomeLoc gatkLocation = gatkIterator.next().getLocation();
View Full Code Here

Examples of htsjdk.variant.vcf.VCFCodec

            final File tmpFile = createTempFile("RMDTrackBuilderUnitTest", "");
            final File tmpIndex = Tribble.indexFile(tmpFile);
            tmpIndex.deleteOnExit();

            copyFile(vcfFile, tmpFile);
            final Index inMemoryIndex = builder.createIndexInMemory(tmpFile, new VCFCodec());
            final LittleEndianOutputStream indexOutputStream = new LittleEndianOutputStream(new FileOutputStream(tmpIndex));

            // If requested, modify the tribble file after the index. Otherwise, modify the index last.
            if ( createOutOfDateIndex ) {
                inMemoryIndex.write(indexOutputStream);
View Full Code Here

Examples of htsjdk.variant.vcf.VCFCodec

        final int extension = 50;
        final int minRegionSize = 50;
        final int maxRegionSize = 300;

        final File file = new File(path);
        final VCFCodec codec = new VCFCodec();
        final Pair<VCFHeader, GATKVCFUtils.VCIterable<LineIterator>> reader = GATKVCFUtils.readAllVCs(file, codec);

        final List<ActiveRegion> incRegions = new ArrayList<ActiveRegion>();
        final BandPassActivityProfile incProfile = new BandPassActivityProfile(genomeLocParser, null, MAX_PROB_PROPAGATION_DISTANCE, ACTIVE_PROB_THRESHOLD);
        final BandPassActivityProfile fullProfile = new BandPassActivityProfile(genomeLocParser, null, MAX_PROB_PROPAGATION_DISTANCE, ACTIVE_PROB_THRESHOLD);
View Full Code Here

Examples of htsjdk.variant.vcf.VCFCodec

        FeatureReader<VariantContext> reader = null;
        switch(fileType) {
            case VCF:
            case BLOCK_COMPRESSED_VCF:
                // getFeatureReader will handle both block-compressed and plain text VCFs
                reader = AbstractFeatureReader.getFeatureReader(file.getAbsolutePath(), new VCFCodec(), false);
                break;
            case BCF:
                reader = AbstractFeatureReader.getFeatureReader(file.getAbsolutePath(), new BCF2Codec(), false);
                break;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.