public static Map < Variant , List < String > > alldeNovoVariants ( Pedigree pedigree , Iterator < Variant > variantIterator ) { PedigreeManager pedigreeManager = new PedigreeManager ( pedigree ) ; // We get all children so we can check upwards List < Member > allChildren = pedigreeManager . getWithoutChildren ( ) ; Map < Variant , List < String > > retDenovoVariants = new HashMap <> ( ) ; while ( variantIterator . hasNext ( ) ) { Variant variant = variantIterator . next ( ) ; // List of individuals with de novo variants List < String > individualIds = new ArrayList <> ( ) ; Queue < String > queue = new LinkedList <> ( ) ; queue . addAll ( allChildren . stream ( ) . map ( Member :: getId ) . collect ( Collectors . toList ( ) ) ) ; while ( ! queue . isEmpty ( ) ) { String individualId = queue . remove ( ) ; Member childMember = pedigreeManager . getIndividualMap ( ) . get ( individualId ) ; if ( isDeNovoVariant ( childMember , variant ) ) { individualIds . add ( individualId ) ; } // Add parents to the queue if ( childMember . getFather ( ) != null ) { if ( ! queue . contains ( childMember . getFather ( ) . getId ( ) ) ) { queue . add ( childMember . getFather ( ) . getId ( ) ) ; } } if ( childMember . getMother ( ) != null ) { if ( ! queue . contains ( childMember . getMother ( ) . getId ( ) ) ) { queue . add ( childMember . getMother ( ) . getId ( ) ) ; } } } if ( ! individualIds . isEmpty ( ) ) { retDenovoVariants . put ( variant , individualIds ) ; } } return retDenovoVariants ; }
Get all the de novo variants identified .