use of htsjdk.tribble.index.Index 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"));
}
use of htsjdk.tribble.index.Index 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"));
}
use of htsjdk.tribble.index.Index 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"));
}
use of htsjdk.tribble.index.Index 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.Index in project gatk by broadinstitute.
the class IndexUtilsUnitTest method testFailLoadTribbleIndex.
@Test(dataProvider = "failTribbleIndexFiles")
public void testFailLoadTribbleIndex(final File featureFile) throws Exception {
final Index index = IndexUtils.loadTribbleIndex(featureFile);
Assert.assertNull(index);
}
Aggregations