Example #1
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 #2
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 #3
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 #4
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 #5
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 #6
0
def fill_missing_processor(next_filter=None, debug=False, print_times=False):
    return Filter(name='* Fill Missing',
                  handle=__handle_fill_missing_genotypes)
Example #7
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)