private static boolean isDeNovoVariant(Member member, Variant variant) {
        // We assume the variant iterator will always contain information for one study
        StudyEntry study = variant.getStudies().get(0);

        Genotype childGt = new Genotype(study.getSampleData(member.getId(), "GT"));

        int[] childAlleles = childGt.getAllelesIdx();
        if (childAlleles.length > 0) {
            // If the individual has parents

            if (member.getFather() != null && StringUtils.isNotEmpty(member.getFather().getId()) && member.getMother() != null
                    && StringUtils.isNotEmpty(member.getMother().getId())) {
                Genotype fatherGt = new Genotype(study.getSampleData(member.getFather().getId(), "GT"));
                Genotype motherGt = new Genotype(study.getSampleData(member.getMother().getId(), "GT"));

                int[] fatherAlleles = fatherGt.getAllelesIdx();
                int[] motherAlleles = motherGt.getAllelesIdx();

                if (fatherAlleles.length == 2 && motherAlleles.length == 2 && childAlleles.length == 2 && childAlleles[0] >= 0
                        && childAlleles[1] >= 0) { // ChildAlleles cannot be -1
                    Set<Integer> fatherAllelesSet = new HashSet<>();
                    for (int fatherAllele : fatherAlleles) {
                        fatherAllelesSet.add(fatherAllele);
                    }
                    Set<Integer> motherAllelesSet = new HashSet<>();
                    for (int motherAllele : motherAlleles) {
                        motherAllelesSet.add(motherAllele);
                    }

                    int allele1 = childAlleles[0];
                    int allele2 = childAlleles[1];
                    if (fatherAllelesSet.contains(allele1) && motherAllelesSet.contains(allele1)) {
                        // both parents have the same allele. We need to check for allele 2 in both parents as well
                        if (!fatherAllelesSet.contains(allele2) && !motherAllelesSet.contains(allele2) && !fatherAllelesSet.contains(-1)
                                && !motherAllelesSet.contains(-1)) {
                            // None of them have allele 2 -> de novo !
                            return true;
                        }
                    } else if (fatherAllelesSet.contains(allele2) && motherAllelesSet.contains(allele2)) {
                        // both parents have the same allele. We need to check for allele 1 in both parents as well
                        if (!fatherAllelesSet.contains(allele1) && !motherAllelesSet.contains(allele1) && !fatherAllelesSet.contains(-1)
                                && !motherAllelesSet.contains(-1)) {
                            // None of them have allele 2 -> de novo !
                            return true;
                        }
                    } else if (fatherAllelesSet.contains(allele1) && !motherAllelesSet.contains(-1)) {
                        // only the father has the same allele1
                        // None of them have allele 2 -> de novo !
                        return !motherAllelesSet.contains(allele2);
                    } else if (motherAllelesSet.contains(allele1) && !fatherAllelesSet.contains(-1)) {
                        // only the mother has the same allele1
                        // None of them have allele 2 -> de novo !
                        return !fatherAllelesSet.contains(allele2);
                    } else if (fatherAllelesSet.contains(allele2) && !motherAllelesSet.contains(-1)) {
                        // only the father has the same allele2
                        // None of them have allele 1 -> de novo !
                        return !motherAllelesSet.contains(allele1);
                    } else if (motherAllelesSet.contains(allele2) && !fatherAllelesSet.contains(-1)) {
                        // only the mother has the same allele2
                        // None of them have allele 1 -> de novo !
                        return !fatherAllelesSet.contains(allele1);
                    } else {
                        return true;
                    }

                }
            }
        }
        return false;
    }
private static boolean isDeNovoVariant ( Member member , Variant variant ) { StudyEntry study = variant . getStudies ( ) . get ( 0 ) ; Genotype childGt = new Genotype ( study . getSampleData ( member . getId ( ) , "GT" ) ) ; int [ ] childAlleles = childGt . getAllelesIdx ( ) ; if ( childAlleles . length > 0 ) { if ( member . getFather ( ) != null && StringUtils . isNotEmpty ( member . getFather ( ) . getId ( ) ) && member . getMother ( ) != null && StringUtils . isNotEmpty ( member . getMother ( ) . getId ( ) ) ) { Genotype fatherGt = new Genotype ( study . getSampleData ( member . getFather ( ) . getId ( ) , "GT" ) ) ; Genotype motherGt = new Genotype ( study . getSampleData ( member . getMother ( ) . getId ( ) , "GT" ) ) ; int [ ] fatherAlleles = fatherGt . getAllelesIdx ( ) ; int [ ] motherAlleles = motherGt . getAllelesIdx ( ) ; if ( fatherAlleles . length == 2 && motherAlleles . length == 2 && childAlleles . length == 2 && childAlleles [ 0 ] >= 0 && childAlleles [ 1 ] >= 0 ) { Set < Integer > fatherAllelesSet = new HashSet < > ( ) ; for ( int fatherAllele : fatherAlleles ) { fatherAllelesSet . add ( fatherAllele ) ; } Set < Integer > motherAllelesSet = new HashSet < > ( ) ; for ( int motherAllele : motherAlleles ) { motherAllelesSet . add ( motherAllele ) ; } int allele1 = childAlleles [ 0 ] ; int allele2 = childAlleles [ 1 ] ; if ( fatherAllelesSet . contains ( allele1 ) && motherAllelesSet . contains ( allele1 ) ) { if ( ! fatherAllelesSet . contains ( allele2 ) && ! motherAllelesSet . contains ( allele2 ) && ! fatherAllelesSet . contains ( - 1 ) && ! motherAllelesSet . contains ( - 1 ) ) { return true ; } } else if ( fatherAllelesSet . contains ( allele2 ) && motherAllelesSet . contains ( allele2 ) ) { if ( ! fatherAllelesSet . contains ( allele1 ) && ! motherAllelesSet . contains ( allele1 ) && ! fatherAllelesSet . contains ( - 1 ) && ! motherAllelesSet . contains ( - 1 ) ) { return true ; } } else if ( fatherAllelesSet . contains ( allele1 ) && ! motherAllelesSet . contains ( - 1 ) ) { return ! motherAllelesSet . contains ( allele2 ) ; } else if ( motherAllelesSet . contains ( allele1 ) && ! fatherAllelesSet . contains ( - 1 ) ) { return ! fatherAllelesSet . contains ( allele2 ) ; } else if ( fatherAllelesSet . contains ( allele2 ) && ! motherAllelesSet . contains ( - 1 ) ) { return ! motherAllelesSet . contains ( allele1 ) ; } else if ( motherAllelesSet . contains ( allele2 ) && ! fatherAllelesSet . contains ( - 1 ) ) { return ! fatherAllelesSet . contains ( allele1 ) ; } else { return true ; } } } } return false ; }
Method to check whether a variant is de novo.

@param member      Child proband.
@param variant         Variant to be checked.
@return a boolean indicating whether the variant is de novo.