LocalFrequencyDao implements FrequencyDao { @Caching(cacheable = { @Cacheable(cacheNames = "hg19.local", keyGenerator = "variantKeyGenerator", condition = "#variant.genomeAssembly == T(org.monarchinitiative.exomiser.core.genome.GenomeAssembly).HG19"), @Cacheable(cacheNames = "hg38.local", keyGenerator = "variantKeyGenerator", condition = "#variant.genomeAssembly == T(org.monarchinitiative.exomiser.core.genome.GenomeAssembly).HG38"), }) @Override public FrequencyData getFrequencyData(Variant variant) { logger.debug("Getting LOCAL_FREQ data for {}", variant); return processResults(variant); } LocalFrequencyDao(TabixDataSource localFrequencyTabixDataSource); @Caching(cacheable = { @Cacheable(cacheNames = "hg19.local", keyGenerator = "variantKeyGenerator", condition = "#variant.genomeAssembly == T(org.monarchinitiative.exomiser.core.genome.GenomeAssembly).HG19"), @Cacheable(cacheNames = "hg38.local", keyGenerator = "variantKeyGenerator", condition = "#variant.genomeAssembly == T(org.monarchinitiative.exomiser.core.genome.GenomeAssembly).HG38"), }) @Override FrequencyData getFrequencyData(Variant variant);  }
@Test public void variantNotInFile() { Mockito.when(tabixReader.query("1:12345-12345")) .thenReturn(MockTabixIterator.empty()); assertThat(instance.getFrequencyData(variant(1, 12345, "A", "T")), equalTo(FrequencyData.empty())); }
@Test public void testAutosomalSnp() { Mockito.when(tabixReader.query("1:12345-12345")) .thenReturn(MockTabixIterator.of("1\t12345\tA\tT\t23.0")); assertThat(instance.getFrequencyData(variant(1, 12345, "A", "T")), equalTo(localFrequencyData(23.0f))); }
@Test public void testSexXsnp() { Mockito.when(tabixReader.query("X:12345-12345")) .thenReturn(MockTabixIterator.of("X\t12345\tA\tT\t23.0")); assertThat(instance.getFrequencyData(variant(23, 12345, "A", "T")), equalTo(localFrequencyData(23.0f))); }
@Test public void testSexYsnp() { Mockito.when(tabixReader.query("Y:12345-12345")) .thenReturn(MockTabixIterator.of("Y\t12345\tA\tT\t23.0")); assertThat(instance.getFrequencyData(variant(24, 12345, "A", "T")), equalTo(localFrequencyData(23.0f))); }
@Test public void testMitochondrialSnp() { Mockito.when(tabixReader.query("MT:12345-12345")) .thenReturn(MockTabixIterator.of("MT\t12345\tA\tT\t23.0")); assertThat(instance.getFrequencyData(variant(25, 12345, "A", "T")), equalTo(localFrequencyData(23.0f))); }
@Test public void testInsertionIndel(){ Mockito.when(tabixReader.query("1:12345-12345")) .thenReturn(MockTabixIterator.of("1\t12345\tA\tTG\t0.01")); assertThat(instance.getFrequencyData(variant(1, 12345, "A", "TG")), equalTo(localFrequencyData(0.01f))); }
@Test public void testSnpAndInsertionAtSamePositionInSourceFile(){ Mockito.when(tabixReader.query("1:12345-12345")) .thenReturn(MockTabixIterator.of("1\t12345\tA\tT\t23.0", "1\t12345\tA\tTG\t0.01")); assertThat(instance.getFrequencyData(variant(1, 12345, "A", "TG")), equalTo(localFrequencyData(0.01f))); }
@Test public void testDeletionIndel(){ Mockito.when(tabixReader.query("1:12345-12345")) .thenReturn(MockTabixIterator.of("1\t12345\tAT\tG\t0.02")); assertThat(instance.getFrequencyData(variant(1, 12345, "AT", "G")), equalTo(localFrequencyData(0.02f))); }
@Test public void testInsertion(){ Mockito.when(tabixReader.query("1:12345-12345")) .thenReturn(MockTabixIterator.of("1\t12345\tA\tAT\t0.03")); assertThat(instance.getFrequencyData(variant(1, 12345, "A", "AT")), equalTo(localFrequencyData(0.03f))); }
@Test public void testDeletion(){ Mockito.when(tabixReader.query("1:12345-12345")) .thenReturn(MockTabixIterator.of("1\t12345\tAT\tA\t0.03")); assertThat(instance.getFrequencyData(variant(1, 12345, "AT", "A")), equalTo(localFrequencyData(0.03f))); }