Example #1
0
def phaser_stages13(debug=False, print_times=False):
    return new_phaser_chain([
                             prepare_phaser(),
                             trivial_phaser(),
                             family_phaser(),
                             family_child_comparison_phaser(),
                             ], debug=debug, print_times=print_times)
Example #2
0
 def setUp(self):
     '''Load test data and expected results.'''
     unittest.TestCase.setUp(self)
     # Test phaser, doesn't matter which here
     self.phaser = new_phaser_chain([trivial_phaser()])
     # Generate a non-trivial Problem
     self.problem = itu.Templates.problem_family(itu.FAMILY13, haplotype=True)
Example #3
0
def family_sib_comparison_phaser(next_filter=None, debug=False, print_times=False):
    chain = [
             FamilyPhaser(family_handle=__handle_sib_comparison, name='* Sibs', genotyped_families=False),
             phased_samples_phaser  # In selected samples mode, reset all non-selected haplotypes back to the original values 
             ]     
    return new_phaser_chain(chain, name='Family Sib', next_filter=next_filter,
                            debug=debug, print_times=print_times)
Example #4
0
def trivial_phaser(next_filter=None, debug=False, print_times=False):
    return new_phaser_chain([
                             Filter(name='* Hom SNPs', handle=__handle_hom_entries),
                             Filter(name='* Hom Parent', handle=__handle_hom_parent),
                             Filter(name='* Impute Parent', handle=__handle_impute_parent),
                             phased_samples_phaser  # In selected samples mode, reset all non-selected haplotypes back to the original values 
                             ], name='Trivial Cases', debug=debug, print_times=print_times)
Example #5
0
 def setUp(self):
     '''Load test data and expected results.'''
     unittest.TestCase.setUp(self)
     # The way to load a pedigree in conjunction with a genotype set is to recode
     # its sample IDs to consecutive for easier access by phasers.
     self.problem = io.read_plink(pedigree=itu.HUTT_PED, prefix=itu.GENOTYPE_SAMPLE, haplotype=None)
     self.phaser = new_phaser_chain([trivial_phaser()])
Example #6
0
def prepare_phaser(next_filter=None, debug=False, print_times=False):
    return new_phaser_chain(
        [estimate_frequencies_phaser, phased_samples_phaser],
        name="Pre-Processing",
        debug=debug,
        print_times=print_times,
    )
Example #7
0
def family_child_comparison_phaser(next_filter=None, debug=False, print_times=False): 
    chain = [
             Filter(name='* Child Comparison', handle=__handle_child_comparison),
             phased_samples_phaser  # In selected samples mode, reset all non-selected haplotypes back to the original values 
             ]
    return new_phaser_chain(chain, name='Family Children', next_filter=next_filter,
                            debug=debug, print_times=print_times)
Example #8
0
def save_stats_processor(next_filter=None, debug=False, print_times=False):
    return new_phaser_chain([
        estimate_frequencies_phaser,
        Filter(name='* Save stats', handle=__handle_save_stats)
    ],
                            name='Save Stats',
                            debug=debug,
                            print_times=print_times)
Example #9
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 #10
0
def prepare_phaser(next_filter=None, debug=False, print_times=False):
    return new_phaser_chain([
        estimate_frequencies_phaser,
        phased_samples_phaser,
    ],
                            name='Pre-Processing',
                            debug=debug,
                            print_times=print_times)
Example #11
0
 def setUp(self):
     '''Load test data and expected results.'''
     unittest.TestCase.setUp(self)
     # The way to load a pedigree in conjunction with a genotype set is to recode
     # its sample IDs to consecutive for easier access by phasers.
     self.problem = io.read_plink(pedigree=itu.HUTT_PED,
                                  prefix=itu.GENOTYPE_SAMPLE,
                                  haplotype=None)
     self.phaser = new_phaser_chain([trivial_phaser()])
Example #12
0
def phaser_stages13(debug=False, print_times=False):
    return new_phaser_chain([
        prepare_phaser(),
        trivial_phaser(),
        family_phaser(),
        family_child_comparison_phaser(),
    ],
                            debug=debug,
                            print_times=print_times)
Example #13
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 #14
0
def family_phaser(next_filter=None, debug=False, single_family=False, print_times=False):
    chain = [
             Filter(name='* Outer Duos', handle=__handle_outer_duos, debug=debug),
             # Phaser(name='* All Duos', handle=__handle_all_duos, debug=debug),
             FamilyPhaser(family_handle=__handle_parent_child, genotyped_families=True, min_children=0,
                          name='* Phased Parent->Child'),
             phased_samples_phaser  # In selected samples mode, reset all non-selected haplotypes back to the original values 
             ] 
    return new_phaser_chain(chain, name='Family Parent-Child', next_filter=next_filter,
                            debug=debug, print_times=print_times)
Example #15
0
def trivial_phaser(next_filter=None, debug=False, print_times=False):
    return new_phaser_chain(
        [
            Filter(name='* Hom SNPs', handle=__handle_hom_entries),
            Filter(name='* Hom Parent', handle=__handle_hom_parent),
            Filter(name='* Impute Parent', handle=__handle_impute_parent),
            phased_samples_phaser  # In selected samples mode, reset all non-selected haplotypes back to the original values 
        ],
        name='Trivial Cases',
        debug=debug,
        print_times=print_times)
Example #16
0
def distant_phaser(next_filter=None, debug=False, print_times=False,
                   max_samples=np.inf, single_sample=None):
    chain = [
             __ParentDistantPhaser(name='* Distant IBD',
                                   max_samples=max_samples,
                                   single_sample=single_sample,
                                   debug=debug),
             phased_samples_phaser  # In selected samples mode, reset all non-selected haplotypes back to the original values 
             ]    
    return new_phaser_chain(chain, name='Distant IBD', next_filter=next_filter,
                            debug=debug, print_times=print_times)
Example #17
0
def family_child_comparison_phaser(next_filter=None,
                                   debug=False,
                                   print_times=False):
    chain = [
        Filter(name='* Child Comparison', handle=__handle_child_comparison),
        phased_samples_phaser  # In selected samples mode, reset all non-selected haplotypes back to the original values 
    ]
    return new_phaser_chain(chain,
                            name='Family Children',
                            next_filter=next_filter,
                            debug=debug,
                            print_times=print_times)
Example #18
0
def family_sib_comparison_phaser(next_filter=None,
                                 debug=False,
                                 print_times=False):
    chain = [
        FamilyPhaser(family_handle=__handle_sib_comparison,
                     name='* Sibs',
                     genotyped_families=False),
        phased_samples_phaser  # In selected samples mode, reset all non-selected haplotypes back to the original values 
    ]
    return new_phaser_chain(chain,
                            name='Family Sib',
                            next_filter=next_filter,
                            debug=debug,
                            print_times=print_times)
Example #19
0
def distant_phaser(next_filter=None,
                   debug=False,
                   print_times=False,
                   max_samples=np.inf,
                   single_sample=None):
    chain = [
        __ParentDistantPhaser(name='* Distant IBD',
                              max_samples=max_samples,
                              single_sample=single_sample,
                              debug=debug),
        phased_samples_phaser  # In selected samples mode, reset all non-selected haplotypes back to the original values 
    ]
    return new_phaser_chain(chain,
                            name='Distant IBD',
                            next_filter=next_filter,
                            debug=debug,
                            print_times=print_times)
Example #20
0
def family_phaser(next_filter=None,
                  debug=False,
                  single_family=False,
                  print_times=False):
    chain = [
        Filter(name='* Outer Duos', handle=__handle_outer_duos, debug=debug),
        # Phaser(name='* All Duos', handle=__handle_all_duos, debug=debug),
        FamilyPhaser(family_handle=__handle_parent_child,
                     genotyped_families=True,
                     min_children=0,
                     name='* Phased Parent->Child'),
        phased_samples_phaser  # In selected samples mode, reset all non-selected haplotypes back to the original values 
    ]
    return new_phaser_chain(chain,
                            name='Family Parent-Child',
                            next_filter=next_filter,
                            debug=debug,
                            print_times=print_times)
Example #21
0
 def setUp(self):
     '''Load test data and expected results.'''
     unittest.TestCase.setUp(self)
     # The way to load a pedigree in conjunction with a genotype set is to recode
     # its sample IDs to consecutive for easier access by phasers.
     self.phaser = new_phaser_chain([trivial_phaser(), family_phaser(), family_child_comparison_phaser()])
Example #22
0
def prepare_and_trivial_phaser(debug=False, print_times=False):
    return new_phaser_chain(
        [prepare_phaser(), trivial_phaser()],
        debug=debug,
        print_times=print_times)
Example #23
0
def build_phasing_pipeline(options):
    '''Bulid and return the entire phasing processing chain by options - factory method.'''
    chain = __build_phaser(options) + __build_post_chain(options)
    return new_phaser_chain(chain,
                            debug=options.debug,
                            print_times=options.print_times)
Example #24
0
def save_stats_processor(next_filter=None, debug=False, print_times=False):
    return new_phaser_chain([
                             estimate_frequencies_phaser,
                             Filter(name='* Save stats', handle=__handle_save_stats)
                             ], name='Save Stats', debug=debug, print_times=print_times)
Example #25
0
def build_phasing_pipeline(options):
    '''Bulid and return the entire phasing processing chain by options - factory method.'''
    chain = __build_phaser(options) + __build_post_chain(options)
    return new_phaser_chain(chain, debug=options.debug, print_times=options.print_times)
Example #26
0
def prepare_and_trivial_phaser(debug=False, print_times=False):
    return new_phaser_chain([
                             prepare_phaser(),
                             trivial_phaser()
                             ], debug=debug, print_times=print_times)