def main(argv):
    global out_base, freq_loc, table_loc, bfile, covar_loc, annot
    global weight_min, build, fix_args, table_type
    cl_arguments(argv)
    fix_it.main(fix_args)
    gene_region_list = pc_toolbox.create_region_list(region_loc)
    annot_dict_loc = fix_it.locate_annot_dict(build)
    annot_dict = fix_it.build_annot_dict('LOG',annot_dict_loc)
##    print("Annotation Dictionary as Follows:")
##    print annot_dict
##    gene_list = sorted(key_list,key=lambda gene:gene_region_dict[gene][0])
    #head, tail = os.path.split(out_file)
    #keep_loc = os.path.join(out_file,'_plink_keep.txt')
    keep_loc = out_base+'_plink_keep.txt'
    plink_out = out_base+'_sigs_inCC'
    fixed_table_loc = fix_it.locate_fixed_table(table_loc, build)
    z_list, lw_list = find_leastP_SNPs(gene_region_list, fixed_table_loc, out_base, freq_loc, keep_loc, table_type, annot_dict)
    if bfile is not None and covar_loc is not None:
        plink_it(keep_loc, bfile, covar_loc, plink_out)
    repair_for_zs(z_list, lw_list, fixed_table_loc, build, table_type)