CanonicalAnnotation { @NotNull public Optional<SnpEffAnnotation> canonicalSnpEffAnnotation(@NotNull final List<SnpEffAnnotation> allAnnotations) { final List<SnpEffAnnotation> transcriptAnnotations = allAnnotations.stream().filter(SnpEffAnnotation::isTranscriptFeature).collect(Collectors.toList()); return pickCanonicalFavourDriverGene(transcriptAnnotations); } CanonicalAnnotation(@NotNull final List<DriverGene> driverGenes, @NotNull final List<CanonicalTranscript> transcripts); @NotNull Optional<SnpEffAnnotation> canonicalSnpEffAnnotation(@NotNull final List<SnpEffAnnotation> allAnnotations);  }
@Test public void favourCDKN2ASnpEffAnnotation() { SnpEffAnnotation p16 = createSnpEffAnnotation("CDKN2A", CDKN2A, VariantConsequence.MISSENSE_VARIANT); SnpEffAnnotation p14 = createSnpEffAnnotation("CDKN2A", CDKN2A_P14ARF, VariantConsequence.MISSENSE_VARIANT); SnpEffAnnotation other = createSnpEffAnnotation("CDKN2A", CDKN2A_OTHER, VariantConsequence.MISSENSE_VARIANT); List<SnpEffAnnotation> all = Lists.newArrayList(other, p14, p16); CanonicalAnnotation victim = new CanonicalAnnotation(genePanel.driverGenes(), transcripts); assertEquals(p16, victim.canonicalSnpEffAnnotation(all).get()); assertFalse(victim.canonicalSnpEffAnnotation(Lists.newArrayList(p14)).isPresent()); }