Package htsjdk.tribble.index

Examples of htsjdk.tribble.index.Index


    @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


    public void testLoadOnDiskIndex() {
        final File originalVCF = new File(privateTestDir + "vcf4.1.example.vcf");
        final File tempVCFWithCorrectIndex = createTempVCFFileAndIndex(originalVCF, false);
        final File tempVCFIndexFile = Tribble.indexFile(tempVCFWithCorrectIndex);

        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

    public void testLoadOnDiskOutdatedIndex() {
        final File originalVCF = new File(privateTestDir + "vcf4.1.example.vcf");
        final File tempVCFWithOutdatedIndex = createTempVCFFileAndIndex(originalVCF, true);
        final File tempVCFIndexFile = Tribble.indexFile(tempVCFWithOutdatedIndex);

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

        // loadFromDisk() should return null to indicate that the index is outdated and should not be used,
        // but should not delete the index since our builder has disableAutoIndexCreation set to true
        Assert.assertNull(index);
        Assert.assertTrue(tempVCFIndexFile.exists());
View Full Code Here

            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);
                indexOutputStream.close();
                Thread.sleep(2000);
                copyFile(vcfFile, tmpFile);
            }
            else {
                copyFile(vcfFile, tmpFile);
                Thread.sleep(2000);
                inMemoryIndex.write(indexOutputStream);
                indexOutputStream.close();
            }

            return tmpFile;
        } catch (IOException e) {
View Full Code Here

        String name = fileDescriptor.getName();
        File inputFile = new File(fileDescriptor.getFile());
        FeatureManager.FeatureDescriptor descriptor = getFeatureManager().getByTriplet(fileDescriptor);
        FeatureCodec codec = getFeatureManager().createCodec(descriptor, name, genomeLocParser, null);
        TestFeatureReader featureReader;
        Index index;
        try {
            // Create a feature reader that creates checkable tribble iterators.
            index = loadIndex(inputFile, codec);
            featureReader = new TestFeatureReader(inputFile.getAbsolutePath(), codec);
        } catch (IOException e) {
View Full Code Here

        spec.disableShadowBCF();

        File outVCF = executeTest(name, spec).first.get(0);
        File outIdx = new File(outVCF.getAbsolutePath() + Tribble.STANDARD_INDEX_EXTENSION);

        final Index actualIndex = IndexFactory.loadIndex(outIdx.getAbsolutePath());
        final Index expectedIndex = testSpec.getIndex(outVCF);

        if (testSpec.type.equals("LINEAR"))
            Assert.assertTrue(actualIndex instanceof LinearIndex, "Index is not a LinearIndex");
        else if (testSpec.type.equals("INTERVAL"))
            Assert.assertTrue(actualIndex instanceof IntervalTreeIndex, "Index is not a IntervalTreeIndex");
View Full Code Here

        File outTribbleIdx = new File(outVCF.getAbsolutePath() + Tribble.STANDARD_INDEX_EXTENSION);
        Assert.assertFalse(outTribbleIdx.exists(), "testBlockCompressedIndexCreation: Want Tabix index but Tribble index exists: " + outTribbleIdx);

        File outTabixIdx = new File(outVCF.getAbsolutePath() + TabixUtils.STANDARD_INDEX_EXTENSION);
        final Index actualIndex = IndexFactory.loadIndex(outTabixIdx.toString());
        Assert.assertTrue(actualIndex instanceof TabixIndex, "testBlockCompressedIndexCreation: Want Tabix index but index is not Tabix: " + outTabixIdx);
    }
View Full Code Here

TOP

Related Classes of htsjdk.tribble.index.Index

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.