Example #1
0
def nuclear_family_phaser(debug=False, print_times=False):
    return new_phaser_chain([
                             prepare_phaser(),
                             trivial_phaser(),
                             family_phaser(),
                             family_child_comparison_phaser(),
                             family_sib_comparison_phaser(),
                             ], debug=debug, print_times=print_times)
Example #2
0
def __build_phaser(options):
    '''Bulid and return the phasing processing chain by options - factory method.'''
    if options.stage == 0:
        # 07-DEC-12: disabling stage 4 (family_sib_comparison_phaser) since it degrades phasing & imputation
        chain = [
                 prepare_phaser(),
                 trivial_phaser(),
                 family_phaser(),
                 family_child_comparison_phaser(),
                 phase_distant.family_sib_comparison_phaser(),
                 phase_distant.distant_phaser()
                 ]
    elif options.stage == 1: chain = [prepare_phaser(), trivial_phaser()]
    elif options.stage == 2: chain = [family_phaser()]
    elif options.stage == 3: chain = [family_child_comparison_phaser()]
    elif options.stage == 4: chain = [phase_distant.family_sib_comparison_phaser()]
    elif options.stage == 5: chain = [phase_distant.distant_phaser()]
    return chain
Example #3
0
def nuclear_family_phaser(debug=False, print_times=False):
    return new_phaser_chain([
        prepare_phaser(),
        trivial_phaser(),
        family_phaser(),
        family_child_comparison_phaser(),
        family_sib_comparison_phaser(),
    ],
                            debug=debug,
                            print_times=print_times)
    def test_family_12(self):
        '''Test comparing sibs with non-genotyped parents (stage 4).'''
        problem = io.read_npz(itu.FAMILY12_STAGE2)
        itu.assert_size_equals(problem.genotype, 3218, 7)
        itu.assert_problem_stats(problem, 45052, 42162, 237)
        assert_equal(len(list(problem.families(genotyped=False))), 1, 'Incorrect number of families')

        phaser = family_sib_comparison_phaser()
        phaser.run(problem, PhaseParam(single_member=1))

        itu.assert_problem_stats(problem, 45052, 42162, 237)
    def test_family_963(self):
        '''Test comparing sibs with non-genotyped parents (stage 4). This was a problematic family.'''
        problem = io.read_npz(itu.FAMILY963_STAGE4)
        itu.assert_size_equals(problem.genotype, 3218, 3)
        itu.assert_problem_stats(problem, 19308, 19286, 23)
        assert_equal(len(list(problem.families(genotyped=False))), 1, 'Incorrect number of families')

        phaser = family_sib_comparison_phaser()
        phaser.run(problem)

        itu.assert_problem_stats(problem, 19308, 19286, 23)
Example #6
0
    def test_family_12(self):
        '''Test comparing sibs with non-genotyped parents (stage 4).'''
        problem = io.read_npz(itu.FAMILY12_STAGE2)
        itu.assert_size_equals(problem.genotype, 3218, 7)
        itu.assert_problem_stats(problem, 45052, 42162, 237)
        assert_equal(len(list(problem.families(genotyped=False))), 1,
                     'Incorrect number of families')

        phaser = family_sib_comparison_phaser()
        phaser.run(problem, PhaseParam(single_member=1))

        itu.assert_problem_stats(problem, 45052, 42162, 237)
Example #7
0
    def test_family_963(self):
        '''Test comparing sibs with non-genotyped parents (stage 4). This was a problematic family.'''
        problem = io.read_npz(itu.FAMILY963_STAGE4)
        itu.assert_size_equals(problem.genotype, 3218, 3)
        itu.assert_problem_stats(problem, 19308, 19286, 23)
        assert_equal(len(list(problem.families(genotyped=False))), 1,
                     'Incorrect number of families')

        phaser = family_sib_comparison_phaser()
        phaser.run(problem)

        itu.assert_problem_stats(problem, 19308, 19286, 23)
Example #8
0
def __build_phaser(options):
    '''Bulid and return the phasing processing chain by options - factory method.'''
    if options.stage == 0:
        # 07-DEC-12: disabling stage 4 (family_sib_comparison_phaser) since it degrades phasing & imputation
        chain = [
            prepare_phaser(),
            trivial_phaser(),
            family_phaser(),
            family_child_comparison_phaser(),
            phase_distant.family_sib_comparison_phaser(),
            phase_distant.distant_phaser()
        ]
    elif options.stage == 1:
        chain = [prepare_phaser(), trivial_phaser()]
    elif options.stage == 2:
        chain = [family_phaser()]
    elif options.stage == 3:
        chain = [family_child_comparison_phaser()]
    elif options.stage == 4:
        chain = [phase_distant.family_sib_comparison_phaser()]
    elif options.stage == 5:
        chain = [phase_distant.distant_phaser()]
    return chain
    def test_family_2003_need_poo_alignment(self):
        '''Test comparing sibs with non-genotyped parents (stage 4). This case highlights
        the need to align POO-phases, i.e., swap founder haps to correctly patch families at individual
        ID 28412 (our original index 386; in this problem, index 10).'''
        problem = io.read_npz(itu.FAMILY2003_STAGE3)
        itu.assert_size_equals(problem.genotype, 3218, 9)
        itu.assert_problem_stats(problem, 57924, 43339, 85)
        assert_equal(len(list(problem.families(genotyped=False))), 1, 'Incorrect number of families')

        #f = problem.families(genotyped=False)[0]
        #print f.member_list
        #print problem.pedigree.sample_id
        phaser = family_sib_comparison_phaser()
        phaser.run(problem)

        itu.assert_problem_stats(problem, 57924, 57515, 85)
Example #10
0
    def test_family_2003_need_poo_alignment(self):
        '''Test comparing sibs with non-genotyped parents (stage 4). This case highlights
        the need to align POO-phases, i.e., swap founder haps to correctly patch families at individual
        ID 28412 (our original index 386; in this problem, index 10).'''
        problem = io.read_npz(itu.FAMILY2003_STAGE3)
        itu.assert_size_equals(problem.genotype, 3218, 9)
        itu.assert_problem_stats(problem, 57924, 43339, 85)
        assert_equal(len(list(problem.families(genotyped=False))), 1,
                     'Incorrect number of families')

        #f = problem.families(genotyped=False)[0]
        #print f.member_list
        #print problem.pedigree.sample_id
        phaser = family_sib_comparison_phaser()
        phaser.run(problem)

        itu.assert_problem_stats(problem, 57924, 57515, 85)