Esempio n. 1
0
def __handle_all_duos(self, request):
    '''Similar to __FamilyParentChildPhaser, only works with parent-child duos and does not compare
    multiple children in a family. Handles all duos; processes children in pre-ordering (top-to-bottom
    in the pedigree).'''
    problem, params = request.problem, request.params
    # Build all duos
    duos = np.empty((0, 3), dtype=int)
    for parent_type in constants.ALLELES:
        d = problem.duos(parent_type)
        duos = np.concatenate((duos,
                               np.concatenate(
                                   (d, np.tile(parent_type, (d.shape[0], 1))),
                                   axis=1)))
    # Pre-order nodes
    duos = duos[np.argsort([problem.pedigree.depth[x] for x in duos[:, 0]]), :]

    h = problem.haplotype
    for child, parent, parent_type in duos:
        ibd.phase_by_ibd(
            problem,
            ip.ibd_segments_in_duo(
                h,
                parent,
                child,
                parent_type,
                parent_het_fill_threshold=params.het_fill_threshold,
                debug=params.debug),
            'max',
            debug=params.debug)
    return False
Esempio n. 2
0
def __handle_outer_duos(self, request):
    '''Similar to __FamilyParentChildPhaser, only works with parent-child duos and does not compare
    multiple children in a family. Handles only children outside nuclear families.'''
    problem, params = request.problem, request.params
    h = problem.haplotype
    family_members = problem.families_union(min_children=0)
    for parent_type in constants.ALLELES:
        for child, parent in pt.selected_duos(problem, params, parent_type):
            if not util.is_member(family_members, [child]):
                ibd.phase_by_ibd(request, ip.ibd_segments_in_duo(h, parent, child, parent_type,
                                                                 parent_het_fill_threshold=params.het_fill_threshold,
                                                                 debug=params.debug), 'max')
    return False
Esempio n. 3
0
def __handle_outer_duos(self, request):
    '''Similar to __FamilyParentChildPhaser, only works with parent-child duos and does not compare
    multiple children in a family. Handles only children outside nuclear families.'''
    problem, params = request.problem, request.params
    h = problem.haplotype
    family_members = problem.families_union(min_children=0)
    for parent_type in constants.ALLELES:
        for child, parent in pt.selected_duos(problem, params, parent_type):
            if not util.is_member(family_members, [child]):
                ibd.phase_by_ibd(
                    request,
                    ip.ibd_segments_in_duo(
                        h,
                        parent,
                        child,
                        parent_type,
                        parent_het_fill_threshold=params.het_fill_threshold,
                        debug=params.debug), 'max')
    return False
Esempio n. 4
0
def __handle_all_duos(self, request):
    '''Similar to __FamilyParentChildPhaser, only works with parent-child duos and does not compare
    multiple children in a family. Handles all duos; processes children in pre-ordering (top-to-bottom
    in the pedigree).'''    
    problem, params = request.problem, request.params
    # Build all duos 
    duos = np.empty((0, 3), dtype=int)
    for parent_type in constants.ALLELES:
        d = problem.duos(parent_type)
        duos = np.concatenate((duos, np.concatenate((d, np.tile(parent_type, (d.shape[0], 1))), axis=1)))
    # Pre-order nodes
    duos = duos[np.argsort([problem.pedigree.depth[x] for x in duos[:, 0]]), :]
    
    h = problem.haplotype
    for child, parent, parent_type in duos:
        ibd.phase_by_ibd(problem,
                         ip.ibd_segments_in_duo(h, parent, child, parent_type,
                                                parent_het_fill_threshold=params.het_fill_threshold,
                                                debug=params.debug),
                                 'max', debug=params.debug)
    return False