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"));
}
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"));
}
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"));
}
Aggregations