JannovarAnnotationService { public VariantAnnotations annotateVariant(String contig, int pos, String ref, String alt) { GenomeVariant genomeVariant = buildOneBasedFwdStrandGenomicVariant(contig, pos, ref, alt); return annotateGenomeVariant(genomeVariant); } JannovarAnnotationService(JannovarData jannovarData); VariantAnnotations annotateVariant(String contig, int pos, String ref, String alt);  }
@Test public void testAnnotateKnownGenomeVariant() { VariantAnnotations variantAnnotations = instance.annotateVariant("10", 123256215, "T", "G"); assertThat(variantAnnotations.getChrName(), equalTo("10")); assertThat(variantAnnotations.getChr(), equalTo(10)); assertThat(variantAnnotations.getPos(), equalTo(123256214)); assertThat(variantAnnotations.getRef(), equalTo("T")); assertThat(variantAnnotations.getAlt(), equalTo("G")); assertThat(variantAnnotations.hasAnnotation(), is(true)); assertThat(variantAnnotations.getHighestImpactEffect(), equalTo(VariantEffect.MISSENSE_VARIANT)); }
@Test public void testAnnotateInvalidGenomeVariant() { VariantAnnotations variantAnnotations = instance.annotateVariant("10", 0, "", ""); assertThat(variantAnnotations.getChrName(), equalTo("10")); assertThat(variantAnnotations.getChr(), equalTo(10)); assertThat(variantAnnotations.getPos(), equalTo(-1)); assertThat(variantAnnotations.getRef(), equalTo("")); assertThat(variantAnnotations.getAlt(), equalTo("")); assertThat(variantAnnotations.hasAnnotation(), is(false)); assertThat(variantAnnotations.getHighestImpactEffect(), equalTo(VariantEffect.SEQUENCE_VARIANT)); }
@Test public void testGetAnnotationsForUnknownContigVariant() { VariantAnnotations variantAnnotations = instance.annotateVariant("UNKNOWN", 1, "A", "T"); System.out.println(variantAnnotations); assertThat(variantAnnotations, not(nullValue())); assertThat(variantAnnotations.getChr(), equalTo(0)); assertThat(variantAnnotations.getPos(), equalTo(0)); assertThat(variantAnnotations.getRef(), equalTo("A")); assertThat(variantAnnotations.getAlt(), equalTo("T")); }
@Test public void testGetAnnotationsForKnownContigVariant() { VariantAnnotations variantAnnotations = instance.annotateVariant("chr1", 1, "A", "T"); assertThat(variantAnnotations.getChr(), equalTo(1)); assertThat(variantAnnotations.getPos(), equalTo(0)); assertThat(variantAnnotations.getRef(), equalTo("A")); assertThat(variantAnnotations.getAlt(), equalTo("T")); }
@Test public void testGetAnnotationsForKnownExonicVariant() { int pos = 123256215; String ref = "T"; String alt = "G"; VariantAnnotations variantAnnotations = instance.annotateVariant("10", pos, ref, alt); assertThat(variantAnnotations.getChr(), equalTo(10)); assertThat(variantAnnotations.getPos(), equalTo(pos - 1)); assertThat(variantAnnotations.getRef(), equalTo(ref)); assertThat(variantAnnotations.getAlt(), equalTo(alt)); }
@Test public void testGetAnnotationsForUnTrimmedInsertionJannovarShiftsRight() { int pos = 118608471; String ref = "GT"; String alt = "GTT"; VariantAnnotations variantAnnotations = instance.annotateVariant("X", pos, ref, alt); assertThat(variantAnnotations.getChr(), equalTo(23)); assertThat(variantAnnotations.getPos(), equalTo(118608471 + 1)); assertThat(variantAnnotations.getRef(), equalTo("")); assertThat(variantAnnotations.getAlt(), equalTo("T")); }
@Test public void testGetAnnotationsForUnTrimmedInsertion() { int pos = 118608470; String ref = "AGT"; String alt = "AGTT"; VariantAnnotations variantAnnotations = instance.annotateVariant("X", pos, ref, alt); assertThat(variantAnnotations.getChr(), equalTo(23)); assertThat(variantAnnotations.getPos(), equalTo(118608470 + 2)); assertThat(variantAnnotations.getRef(), equalTo("")); assertThat(variantAnnotations.getAlt(), equalTo("T")); }
@Test public void testGetAnnotationsForUnTrimmedDeletionJannovarShiftsRight() { int pos = 118608470; String ref = "AGTT"; String alt = "AGT"; VariantAnnotations variantAnnotations = instance.annotateVariant("X", pos, ref, alt); assertThat(variantAnnotations.getChr(), equalTo(23)); assertThat(variantAnnotations.getPos(), equalTo(118608471 + 1)); assertThat(variantAnnotations.getRef(), equalTo("T")); assertThat(variantAnnotations.getAlt(), equalTo("")); }