@Test
public void testAnalyseMultipleInheritanceModesForSingleSample() {

    List<Allele> hetAltAlleles = buildAlleles("A", "T", "C");
    Genotype hetAltGenotype = buildPhasedSampleGenotype("Cain", hetAltAlleles.get(2), hetAltAlleles.get(2));
    VariantContext variantContext = buildVariantContext(1, 12345, hetAltAlleles, hetAltGenotype);
    VariantEvaluation hetAltVar1 = filteredVariant(1, 12345, "A", "T", FilterResult.pass(FilterType.FREQUENCY_FILTER), variantContext);
    VariantEvaluation hetAltVar2 = filteredVariant(1, 12345, "A", "C", FilterResult.pass(FilterType.FREQUENCY_FILTER), variantContext);
    List<Allele> homAlt = buildAlleles("C", "G");
    Genotype homAltGenotype = buildPhasedSampleGenotype("Cain", homAlt.get(1), homAlt.get(1));
    VariantContext homAltVariantContext = buildVariantContext(1, 12345, homAlt, homAltGenotype);
    VariantEvaluation homAltVar = filteredVariant(1, 12355, "C", "G", FilterResult.pass(FilterType.FREQUENCY_FILTER), homAltVariantContext);
    List<Allele> het1 = buildAlleles("C", "G");
    Genotype hetGenotype1 = buildPhasedSampleGenotype("Cain", het1.get(0), het1.get(1));
    VariantContext hetVariantContext1 = buildVariantContext(1, 12365, het1, hetGenotype1);
    VariantEvaluation hetVar1 = filteredVariant(1, 12365, "C", "G", FilterResult.pass(FilterType.FREQUENCY_FILTER), hetVariantContext1);
    List<Allele> het2 = buildAlleles("G", "T");
    Genotype hetGenotype2 = buildPhasedSampleGenotype("Cain", het2.get(0), het2.get(1));
    VariantContext hetVariantContext2 = buildVariantContext(1, 12375, het2, hetGenotype2);
    VariantEvaluation hetVar2 = filteredVariant(1, 12375, "G", "T", FilterResult.pass(FilterType.FREQUENCY_FILTER), hetVariantContext2);
    Gene gene = newGene();
    gene.addVariant(hetAltVar1);
    gene.addVariant(hetAltVar2);
    gene.addVariant(homAltVar);
    gene.addVariant(hetVar1);
    gene.addVariant(hetVar2);
    Pedigree pedigree = Pedigree.justProband("Cain");
    InheritanceModeAnalyser instance = newInstanceForModes(pedigree, ModeOfInheritance.AUTOSOMAL_DOMINANT, ModeOfInheritance.AUTOSOMAL_RECESSIVE);
    instance.analyseInheritanceModes(gene);
    assertThat(gene.isCompatibleWith(ModeOfInheritance.ANY), is(true));
    assertThat(gene.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT), is(true));
    assertThat(gene.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_RECESSIVE), is(true));
    assertThat(hetAltVar1.getCompatibleInheritanceModes(), equalTo(EnumSet.of(ModeOfInheritance.AUTOSOMAL_RECESSIVE)));
    assertThat(hetAltVar2.getCompatibleInheritanceModes(), equalTo(EnumSet.of(ModeOfInheritance.AUTOSOMAL_RECESSIVE)));
    assertThat(homAltVar.getCompatibleInheritanceModes(), equalTo(EnumSet.of(ModeOfInheritance.AUTOSOMAL_RECESSIVE)));
    assertThat(hetVar1.getCompatibleInheritanceModes(), equalTo(EnumSet.of(ModeOfInheritance.AUTOSOMAL_DOMINANT, ModeOfInheritance.AUTOSOMAL_RECESSIVE)));
    assertThat(hetVar2.getCompatibleInheritanceModes(), equalTo(EnumSet.of(ModeOfInheritance.AUTOSOMAL_DOMINANT, ModeOfInheritance.AUTOSOMAL_RECESSIVE)));
}