Example #1
0
 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
Example #2
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 #3
0
 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
Example #4
0
 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
Example #5
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 #6
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 #7
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 #8
0
    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)
Example #9
0
 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
Example #10
0
def fill_missing_processor(next_filter=None, debug=False, print_times=False):
    return Filter(name='* Fill Missing',
                  handle=__handle_fill_missing_genotypes)
Example #11
0
def impute_processor(next_filter=None, debug=False, print_times=False):
    return Filter(name='* Impute from Fully-Called',
                  handle=__handle_impute_from_fully_called)
Example #12
0
 def __init__(self, increment, next_filter=None):
     '''Initialize a filter.'''
     Filter.__init__(self, next_filter)
     self.increment = increment
Example #13
0
 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
Example #14
0
 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
Example #15
0
 def __init__(self, increment, next_filter=None):
     '''Initialize a filter.'''
     Filter.__init__(self, next_filter)
     self.increment = increment