Search in sources :

Example 1 with LinearIndex

use of htsjdk.tribble.index.linear.LinearIndex in project gatk by broadinstitute.

the class IndexFeatureFileIntegrationTest method testVCFIndex.

@Test
public void testVCFIndex() {
    final File ORIG_FILE = getTestFile("test_variants_for_index.vcf");
    final File outName = createTempFile("test_variants_for_index.vcf", ".idx");
    final String[] args = { "--feature_file", ORIG_FILE.getAbsolutePath(), "-O", outName.getAbsolutePath() };
    final Object res = this.runCommandLine(args);
    Assert.assertEquals(res, outName.getAbsolutePath());
    final Index index = IndexFactory.loadIndex(res.toString());
    Assert.assertTrue(index instanceof LinearIndex);
    Assert.assertEquals(index.getSequenceNames(), Arrays.asList("1", "2", "3", "4"));
    checkIndex(index, Arrays.asList("1", "2", "3", "4"));
}
Also used : LinearIndex(htsjdk.tribble.index.linear.LinearIndex) Index(htsjdk.tribble.index.Index) TabixIndex(htsjdk.tribble.index.tabix.TabixIndex) File(java.io.File) LinearIndex(htsjdk.tribble.index.linear.LinearIndex) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 2 with LinearIndex

use of htsjdk.tribble.index.linear.LinearIndex in project gatk by broadinstitute.

the class IndexFeatureFileIntegrationTest method testGVCFIndex.

@Test
public void testGVCFIndex() {
    final File ORIG_FILE = getTestFile("test_variants_for_index.g.vcf");
    final File outName = createTempFile("test_variants_for_index.g.vcf.", ".idx");
    final String[] args = { "--feature_file", ORIG_FILE.getAbsolutePath(), "-O", outName.getAbsolutePath() };
    final Object res = this.runCommandLine(args);
    Assert.assertEquals(res, outName.getAbsolutePath());
    final Index index = IndexFactory.loadIndex(res.toString());
    Assert.assertTrue(index instanceof LinearIndex);
    Assert.assertEquals(index.getSequenceNames(), Arrays.asList("1"));
    checkIndex(index, Arrays.asList("1"));
}
Also used : LinearIndex(htsjdk.tribble.index.linear.LinearIndex) Index(htsjdk.tribble.index.Index) TabixIndex(htsjdk.tribble.index.tabix.TabixIndex) File(java.io.File) LinearIndex(htsjdk.tribble.index.linear.LinearIndex) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 3 with LinearIndex

use of htsjdk.tribble.index.linear.LinearIndex in project gatk by broadinstitute.

the class IndexFeatureFileIntegrationTest method testBCFIndex.

@Test
public void testBCFIndex() {
    final File ORIG_FILE = getTestFile("test_variants_for_index.bcf");
    final File outName = createTempFile("test_variants_for_index.bcf.", ".idx");
    final String[] args = { "--feature_file", ORIG_FILE.getAbsolutePath(), "-O", outName.getAbsolutePath() };
    final Object res = this.runCommandLine(args);
    Assert.assertEquals(res, outName.getAbsolutePath());
    final Index index = IndexFactory.loadIndex(res.toString());
    Assert.assertTrue(index instanceof LinearIndex);
    Assert.assertEquals(index.getSequenceNames(), Arrays.asList("1"));
    checkIndex(index, Arrays.asList("1"));
}
Also used : LinearIndex(htsjdk.tribble.index.linear.LinearIndex) Index(htsjdk.tribble.index.Index) TabixIndex(htsjdk.tribble.index.tabix.TabixIndex) File(java.io.File) LinearIndex(htsjdk.tribble.index.linear.LinearIndex) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 4 with LinearIndex

use of htsjdk.tribble.index.linear.LinearIndex in project gatk by broadinstitute.

the class IndexFeatureFileIntegrationTest method testGVCFTreatedAsVCFIndex.

@Test
public void testGVCFTreatedAsVCFIndex() {
    // Here we're testing what happens when we have a GVCF that is treated by the tool as a
    // regular VCF due to the lack of a .g.vcf extension
    final File ORIG_FILE = getTestFile("test_variants_for_index.gvcf_treated_as_vcf.vcf");
    final File outName = createTempFile("test_variants_for_index.gvcf_treated_as_vcf.vcf.", ".idx");
    final String[] args = { "--feature_file", ORIG_FILE.getAbsolutePath(), "-O", outName.getAbsolutePath() };
    final Object res = this.runCommandLine(args);
    Assert.assertEquals(res, outName.getAbsolutePath());
    final Index index = IndexFactory.loadIndex(res.toString());
    Assert.assertTrue(index instanceof LinearIndex);
    Assert.assertEquals(index.getSequenceNames(), Arrays.asList("1"));
    checkIndex(index, Arrays.asList("1"));
}
Also used : LinearIndex(htsjdk.tribble.index.linear.LinearIndex) Index(htsjdk.tribble.index.Index) TabixIndex(htsjdk.tribble.index.tabix.TabixIndex) File(java.io.File) LinearIndex(htsjdk.tribble.index.linear.LinearIndex) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 5 with LinearIndex

use of htsjdk.tribble.index.linear.LinearIndex in project gatk by broadinstitute.

the class IndexFeatureFileIntegrationTest method testVCFIndex_inferredName.

@Test
public void testVCFIndex_inferredName() {
    final File ORIG_FILE = getTestFile("test_variants_for_index.vcf");
    final String[] args = { "--feature_file", ORIG_FILE.getAbsolutePath() };
    final Object res = this.runCommandLine(args);
    final File tribbleIndex = Tribble.indexFile(ORIG_FILE);
    Assert.assertEquals(res, tribbleIndex.getAbsolutePath());
    tribbleIndex.deleteOnExit();
    final Index index = IndexFactory.loadIndex(res.toString());
    Assert.assertTrue(index instanceof LinearIndex);
    Assert.assertEquals(index.getSequenceNames(), Arrays.asList("1", "2", "3", "4"));
    checkIndex(index, Arrays.asList("1", "2", "3", "4"));
}
Also used : LinearIndex(htsjdk.tribble.index.linear.LinearIndex) Index(htsjdk.tribble.index.Index) TabixIndex(htsjdk.tribble.index.tabix.TabixIndex) File(java.io.File) LinearIndex(htsjdk.tribble.index.linear.LinearIndex) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Aggregations

Index (htsjdk.tribble.index.Index)5 LinearIndex (htsjdk.tribble.index.linear.LinearIndex)5 TabixIndex (htsjdk.tribble.index.tabix.TabixIndex)5 File (java.io.File)5 CommandLineProgramTest (org.broadinstitute.hellbender.CommandLineProgramTest)5 Test (org.testng.annotations.Test)5