@Test(dataProvider = "queryableData") public void testQueryable(final File vcf, boolean expectedQueryable) { try(VCFFileReader reader = new VCFFileReader(vcf, false)) { Assert.assertEquals(reader.isQueryable(), expectedQueryable); } }
@Test(dataProvider = "queryableData") public void testIsQueriable(final File vcf, final boolean expectedQueryable) throws Exception { Assert.assertEquals(new VCFFileReader(vcf, false).isQueryable(), expectedQueryable); }
/** * Loads genotypes from the supplied file into one or more Fingerprint objects and returns them in a * Map of Sample->Fingerprint. * * @param fingerprintFile - VCF file containing genotypes for one or more samples * @param specificSample - null to load genotypes for all samples contained in the file or the name * of an individual sample to load (and exclude all others). * @return a Map of Sample name to Fingerprint */ public Map<String, Fingerprint> loadFingerprints(final Path fingerprintFile, final String specificSample) { SequenceUtil.assertSequenceDictionariesEqual(this.haplotypes.getHeader().getSequenceDictionary(), VCFFileReader.getSequenceDictionary(fingerprintFile)); final VCFFileReader reader = new VCFFileReader(fingerprintFile, false); if (reader.isQueryable()) { return loadFingerprintsFromQueriableReader(reader, specificSample, fingerprintFile); } else { log.warn("Couldn't find index for file " + fingerprintFile + " going to read through it all."); return loadFingerprintsFromVariantContexts(reader, specificSample, fingerprintFile); } }
/** * Loads genotypes from the supplied file into one or more Fingerprint objects and returns them in a * Map of Sample->Fingerprint. * * @param fingerprintFile - VCF file containing genotypes for one or more samples * @param specificSample - null to load genotypes for all samples contained in the file or the name * of an individual sample to load (and exclude all others). * @return a Map of Sample name to Fingerprint */ public Map<String, Fingerprint> loadFingerprints(final Path fingerprintFile, final String specificSample) { SequenceUtil.assertSequenceDictionariesEqual(this.haplotypes.getHeader().getSequenceDictionary(), VCFFileReader.getSequenceDictionary(fingerprintFile)); final VCFFileReader reader = new VCFFileReader(fingerprintFile, false); if (reader.isQueryable()) { return loadFingerprintsFromQueriableReader(reader, specificSample, fingerprintFile); } else { log.warn("Couldn't find index for file " + fingerprintFile + " going to read through it all."); return loadFingerprintsFromVariantContexts(reader, specificSample, fingerprintFile); } }