Search in sources :

Example 1 with TabixIndex

use of htsjdk.tribble.index.tabix.TabixIndex in project gatk by broadinstitute.

the class IndexFeatureFileIntegrationTest method testVCFGZIndex_inferredName.

@Test
public void testVCFGZIndex_inferredName() {
    //made by bgzip
    final File ORIG_FILE = getTestFile("test_variants_for_index.vcf.blockgz.gz");
    final String[] args = { "--feature_file", ORIG_FILE.getAbsolutePath() };
    final Object res = this.runCommandLine(args);
    final File tabixIndex = new File(ORIG_FILE.getAbsolutePath() + TabixUtils.STANDARD_INDEX_EXTENSION);
    Assert.assertEquals(res, tabixIndex.getAbsolutePath());
    tabixIndex.deleteOnExit();
    Assert.assertTrue(tabixIndex.exists(), tabixIndex + " does not exists");
    final Index index = IndexFactory.loadIndex(tabixIndex.toString());
    Assert.assertTrue(index instanceof TabixIndex);
    Assert.assertEquals(index.getSequenceNames(), Arrays.asList("1", "2", "3", "4"));
    checkIndex(index, Arrays.asList("1", "2", "3", "4"));
}
Also used : TabixIndex(htsjdk.tribble.index.tabix.TabixIndex) LinearIndex(htsjdk.tribble.index.linear.LinearIndex) Index(htsjdk.tribble.index.Index) TabixIndex(htsjdk.tribble.index.tabix.TabixIndex) File(java.io.File) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 2 with TabixIndex

use of htsjdk.tribble.index.tabix.TabixIndex in project gatk by broadinstitute.

the class IndexFeatureFileIntegrationTest method testSAMPileupGZIndex.

@Test
public void testSAMPileupGZIndex() {
    // made with bgzip
    final File ORIG_FILE = getTestFile("test_sampileup_for_index.pileup.gz");
    final File outName = createTempFile(ORIG_FILE.getName(), TabixUtils.STANDARD_INDEX_EXTENSION);
    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 TabixIndex);
    for (int chr : new int[] { 1, 2, 3, 4 }) {
        //note: unusual loop
        Assert.assertTrue(index.containsChromosome(String.valueOf(chr)), String.valueOf(chr));
    }
    for (int chr : new int[] { 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 }) {
        //note: unusual loop
        Assert.assertFalse(index.containsChromosome(String.valueOf(chr)), String.valueOf(chr));
    }
    for (final String chr : Arrays.asList("X", "Y", "MT")) {
        Assert.assertFalse(index.containsChromosome(chr), String.valueOf(chr));
    }
    Assert.assertEquals(index.getSequenceNames(), Arrays.asList("1", "2", "3", "4"));
}
Also used : TabixIndex(htsjdk.tribble.index.tabix.TabixIndex) LinearIndex(htsjdk.tribble.index.linear.LinearIndex) Index(htsjdk.tribble.index.Index) TabixIndex(htsjdk.tribble.index.tabix.TabixIndex) File(java.io.File) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Example 3 with TabixIndex

use of htsjdk.tribble.index.tabix.TabixIndex in project gatk by broadinstitute.

the class IndexFeatureFileIntegrationTest method testVCFGZIndex_tabix.

@Test
public void testVCFGZIndex_tabix() {
    //made by bgzip
    final File ORIG_FILE = getTestFile("test_variants_for_index.vcf.blockgz.gz");
    final File outName = createTempFile("test_variants_for_index.blockgz.gz.", TabixUtils.STANDARD_INDEX_EXTENSION);
    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 TabixIndex);
    Assert.assertEquals(index.getSequenceNames(), Arrays.asList("1", "2", "3", "4"));
    checkIndex(index, Arrays.asList("1", "2", "3", "4"));
}
Also used : TabixIndex(htsjdk.tribble.index.tabix.TabixIndex) LinearIndex(htsjdk.tribble.index.linear.LinearIndex) Index(htsjdk.tribble.index.Index) TabixIndex(htsjdk.tribble.index.tabix.TabixIndex) File(java.io.File) Test(org.testng.annotations.Test) CommandLineProgramTest(org.broadinstitute.hellbender.CommandLineProgramTest)

Aggregations

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