TopologicalDomain implements ChromosomalRegion { public boolean containsPosition(VariantCoordinates variantCoordinates) { if (variantCoordinates.getChromosome() == chromosome) { int variantPosition = variantCoordinates.getPosition(); return start <= variantPosition && end >= variantPosition; } return false; } TopologicalDomain(int chromosome, int start, int end, Map<String, Integer> genes); @Override int getChromosome(); @Override int getStart(); @Override int getEnd(); Map<String, Integer> getGenes(); boolean containsPosition(VariantCoordinates variantCoordinates); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testVariantIsWithinDomain() { VariantCoordinates variant = new SimpleVariantCoordinates(GenomeAssembly.HG19, 1, 5, "A", "T"); instance = new TopologicalDomain(1, 1, 10, new HashMap<>()); assertThat(instance.containsPosition(variant), is(true)); }
@Test public void testVariantIsOutsideDomain() { VariantCoordinates variant = new SimpleVariantCoordinates(GenomeAssembly.HG19, 1, 5, "A", "T"); instance = new TopologicalDomain(1, 1000, 10000, new HashMap<>()); assertThat(instance.containsPosition(variant), is(false)); }