@Test
public void testAnalyseMultipleInheritanceModesMultipleGenesForSingleSample() {

    List<Allele> hetAltAlleles1 = buildAlleles("A", "T");
    Genotype hetAltGenotype1 = buildPhasedSampleGenotype("Cain", hetAltAlleles1.get(0), hetAltAlleles1.get(1));
    VariantContext hetAltVariantContext1 = buildVariantContext(1, 12345, hetAltAlleles1, hetAltGenotype1);
    VariantEvaluation hetAltVar1 = filteredVariant(1, 12345, "A", "T", FilterResult.pass(FilterType.FREQUENCY_FILTER), hetAltVariantContext1);
      hetAltVar1.setSampleGenotype("Sample", SampleGenotype.of(AlleleCall.REF, AlleleCall.ALT));
    List<Allele> hetAltAlleles2 = buildAlleles("G", "C");
    Genotype hetAltGenotype2 = buildPhasedSampleGenotype("Cain", hetAltAlleles2.get(0), hetAltAlleles2.get(1));
    VariantContext hetAltVariantContext2 = buildVariantContext(1, 12355, hetAltAlleles2, hetAltGenotype2);
    VariantEvaluation hetAltVar2 = filteredVariant(1, 12355, "A", "C", FilterResult.pass(FilterType.FREQUENCY_FILTER), hetAltVariantContext2);
    Gene geneRecessiveAutosomal = newGene();
    geneRecessiveAutosomal.addVariant(hetAltVar1);
    geneRecessiveAutosomal.addVariant(hetAltVar2);
    List<Allele> homAlt = buildAlleles("C", "G");
    Genotype homAltGenotype = buildPhasedSampleGenotype("Cain", homAlt.get(1), homAlt.get(1));
    VariantContext homAltVariantContext = buildVariantContext(23, 12345, homAlt, homAltGenotype);
    VariantEvaluation homAltXVar = filteredVariant(23, 12355, "C", "G", FilterResult.pass(FilterType.FREQUENCY_FILTER), homAltVariantContext);
    Gene geneRecessiveX = newGene();
    geneRecessiveX.addVariant(homAltXVar);
    List<Allele> het1 = buildAlleles("C", "G");
    Genotype hetGenotype1 = buildPhasedSampleGenotype("Cain", het1.get(0), het1.get(1));
    VariantContext hetVariantContext1 = buildVariantContext(22, 12365, het1, hetGenotype1);
    VariantEvaluation autoHetVar = filteredVariant(2, 12365, "C", "G", FilterResult.pass(FilterType.FREQUENCY_FILTER), hetVariantContext1);
    Gene geneDominantAutosomal = newGene();
    geneDominantAutosomal.addVariant(autoHetVar);
    List<Allele> het2 = buildAlleles("G", "T");
    Genotype hetGenotype2 = buildPhasedSampleGenotype("Cain", het2.get(0), het2.get(1));
    VariantContext hetVariantContext2 = buildVariantContext(25, 12375, het2, hetGenotype2);
    VariantEvaluation mitoHetVar = filteredVariant(25, 12375, "G", "T", FilterResult.pass(FilterType.FREQUENCY_FILTER), hetVariantContext2);
    Gene geneMitochondrial = newGene();
    geneMitochondrial.addVariant(mitoHetVar);
    Pedigree pedigree = Pedigree.justProband("Cain");
    EnumSet<ModeOfInheritance> wantedModes = EnumSet.of(ModeOfInheritance.AUTOSOMAL_RECESSIVE, ModeOfInheritance.AUTOSOMAL_DOMINANT, ModeOfInheritance.X_RECESSIVE, ModeOfInheritance.X_DOMINANT, ModeOfInheritance.MITOCHONDRIAL);
    InheritanceModeAnalyser instance = new InheritanceModeAnalyser(new InheritanceModeAnnotator(pedigree, InheritanceModeOptions.defaults()));
    instance.analyseInheritanceModes(Arrays.asList(geneRecessiveAutosomal, geneRecessiveX, geneDominantAutosomal, geneMitochondrial));
    assertThat(geneRecessiveAutosomal.isCompatibleWith(ModeOfInheritance.ANY), is(true));
    assertThat(geneRecessiveAutosomal.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT), is(true));
    assertThat(geneRecessiveAutosomal.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_RECESSIVE), is(true));
    assertThat(geneRecessiveAutosomal.isCompatibleWith(ModeOfInheritance.X_DOMINANT), is(false));
    assertThat(geneRecessiveAutosomal.isCompatibleWith(ModeOfInheritance.X_RECESSIVE), is(false));
    assertThat(geneRecessiveAutosomal.isCompatibleWith(ModeOfInheritance.MITOCHONDRIAL), is(false));
    assertThat(hetAltVar1.getCompatibleInheritanceModes(), equalTo(EnumSet.of(ModeOfInheritance.AUTOSOMAL_DOMINANT, ModeOfInheritance.AUTOSOMAL_RECESSIVE)));
    assertThat(hetAltVar2.getCompatibleInheritanceModes(), equalTo(EnumSet.of(ModeOfInheritance.AUTOSOMAL_DOMINANT, ModeOfInheritance.AUTOSOMAL_RECESSIVE)));
    assertThat(geneRecessiveX.isCompatibleWith(ModeOfInheritance.ANY), is(true));
    assertThat(geneRecessiveX.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT), is(false));
    assertThat(geneRecessiveX.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_RECESSIVE), is(false));
    assertThat(geneRecessiveX.isCompatibleWith(ModeOfInheritance.X_DOMINANT), is(true));
    assertThat(geneRecessiveX.isCompatibleWith(ModeOfInheritance.X_RECESSIVE), is(true));
    assertThat(geneRecessiveX.isCompatibleWith(ModeOfInheritance.MITOCHONDRIAL), is(false));
    assertThat(homAltXVar.getCompatibleInheritanceModes(), equalTo(EnumSet.of(ModeOfInheritance.X_RECESSIVE, ModeOfInheritance.X_DOMINANT)));
    assertThat(geneDominantAutosomal.isCompatibleWith(ModeOfInheritance.ANY), is(true));
    assertThat(geneDominantAutosomal.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT), is(true));
    assertThat(geneDominantAutosomal.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_RECESSIVE), is(false));
    assertThat(geneDominantAutosomal.isCompatibleWith(ModeOfInheritance.X_DOMINANT), is(false));
    assertThat(geneDominantAutosomal.isCompatibleWith(ModeOfInheritance.X_RECESSIVE), is(false));
    assertThat(geneDominantAutosomal.isCompatibleWith(ModeOfInheritance.MITOCHONDRIAL), is(false));
    assertThat(autoHetVar.getCompatibleInheritanceModes(), equalTo(EnumSet.of(ModeOfInheritance.AUTOSOMAL_DOMINANT)));
    assertThat(geneMitochondrial.isCompatibleWith(ModeOfInheritance.ANY), is(true));
    assertThat(geneMitochondrial.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_DOMINANT), is(false));
    assertThat(geneMitochondrial.isCompatibleWith(ModeOfInheritance.AUTOSOMAL_RECESSIVE), is(false));
    assertThat(geneMitochondrial.isCompatibleWith(ModeOfInheritance.X_DOMINANT), is(false));
    assertThat(geneMitochondrial.isCompatibleWith(ModeOfInheritance.X_RECESSIVE), is(false));
    assertThat(geneMitochondrial.isCompatibleWith(ModeOfInheritance.MITOCHONDRIAL), is(true));
    assertThat(mitoHetVar.getCompatibleInheritanceModes(), equalTo(EnumSet.of(ModeOfInheritance.MITOCHONDRIAL)));
}