def __init__(self, family_handle, next_filter=None, name=None, genotyped_families=True, min_children=0): '''Initialize a filter that uses the filter processor to process SNP+trio combinations. Use single_family in debugging to process only the first encountered family.''' Filter.__init__(self, name=name, next_filter=next_filter) self.family_handle = family_handle self.genotyped_families = genotyped_families self.min_children = min_children
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)
def __init__(self, next_filter=None, name=None, single_sample=None, max_samples=np.inf, debug=False): Filter.__init__(self, name=name, next_filter=next_filter) # Debugging options self.single_sample = single_sample self.debug = debug self.max_samples = max_samples
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)
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)
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)
in selected_samples are to be phased, while the remaining are already phased.''' # Load problem fields if request.params.selected_mode: phased = np.array( list( set(range(request.problem.num_samples)) - set(request.params.selected_samples))) g, h = request.problem.data h[:, phased, :] = g[:, phased, :] return False #################################################################################### '''Main pre-processing chain - a facade.''' 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) estimate_frequencies_phaser = Filter( name='* Genotype Freq', handle=__handle_estimate_genotype_frequencies) phased_samples_phaser = Filter(name='* Phased Samples', handle=__handle_phased_samples)
def __init__(self, delegate, next_filter=None): '''Initialize a decorator of the delegate Filter. fmt specifies the printout format string that accepts one string argument for the filter's name.''' Filter.__init__(self, next_filter=next_filter, name=delegate.name) self.delegate = delegate
def fill_missing_processor(next_filter=None, debug=False, print_times=False): return Filter(name='* Fill Missing', handle=__handle_fill_missing_genotypes)
def impute_processor(next_filter=None, debug=False, print_times=False): return Filter(name='* Impute from Fully-Called', handle=__handle_impute_from_fully_called)
def __init__(self, increment, next_filter=None): '''Initialize a filter.''' Filter.__init__(self, next_filter) self.increment = increment