def make_result_folder(args=None, which='cnv', fun=None):
    feature_genes = []
    gene_lists = {}
    color_length = {}
    os.chdir(args.outdir)
    i = datetime.datetime.now()
    two_group = [args.group1[0].split('/')[(- 2)], args.group2[0].split('/')[(- 2)]]
    target = (((args.group1[0].split('/')[(- 2)] + '_VS_') + args.group2[0].split('/')[(- 2)]) + ('_%s%s%s_%s%s' % (i.year, i.month, i.day, i.hour, i.minute)))
    try:
        os.mkdir(target)
    except FileExistsError:
        sh.rm('-rf', target)
        os.mkdir(target)
    if (which == 'cnv'):
        name = ('cnv_median_' + args.data_type)
        (gene_list, a_group, b_group) = fun(args=args)
    else:
        if (args.cal_type == 'num'):
            name = 'snv_number'
        else:
            name = 'snv_mean'
        (gene_list, a_group, b_group) = fun(args=args)
    feature_gene = feature_select(gene_list, a_group, b_group, args=args)
    feature_genes.append(feature_gene)
    gene_lists[two_group[0]] = gene_list[a_group]
    gene_lists[two_group[1]] = gene_list[b_group]
    os.chdir(target)
    save_parameters(args=args)
    group_dic = {two_group[0]: a_group, two_group[1]: b_group}
    color_length[two_group[0]] = a_group
    color_length[two_group[1]] = b_group
    (color, length) = make_col_color_heatmap(group_dic, args=args)
    save_data_pdf(gene_list, ('host_gene_%s' % name), length, color, group_dic, which, args=args)
    pd.DataFrame({'gene': feature_gene}).to_csv(('feature_gene_pval%0.2f.txt' % args.pval), sep='\t', index=False)
    feature_gene_cnv = gene_list.ix[feature_gene]
    evaluate_model(gene_list, a_group, b_group, feature_gene, name=('feature_gene_%s' % name), args=args)
    save_data_pdf(feature_gene_cnv, ('feature_gene_%s' % name), length, color, group_dic, which, args=args)
    os.chdir(args.outdir)
def make_result_folder(args=None, which='cnv', fun=None):
    feature_genes = []
    gene_lists = {}
    color_length = {}
    os.chdir(args.outdir)
    i = datetime.datetime.now()
    two_group = [args.group1[0].split('/')[(- 2)], args.group2[0].split('/')[(- 2)]]
    target = (((args.group1[0].split('/')[(- 2)] + '_VS_') + args.group2[0].split('/')[(- 2)]) + ('_%s%s%s_%s%s' % (i.year, i.month, i.day, i.hour, i.minute)))
    try:
        os.mkdir(target)
    except FileExistsError:
        sh.rm('-rf', target)
        os.mkdir(target)
    if (which == 'cnv'):
        name = ('cnv_median_' + args.data_type)
        (gene_list, a_group, b_group) = fun(args=args)
    else:
        if (args.cal_type == 'num'):
            name = 'snv_number'
        else:
            name = 'snv_mean'
        (gene_list, a_group, b_group) = fun(args=args)
    feature_gene = feature_select(gene_list, a_group, b_group, args=args)
    feature_genes.append(feature_gene)
    gene_lists[two_group[0]] = gene_list[a_group]
    gene_lists[two_group[1]] = gene_list[b_group]
    os.chdir(target)
    save_parameters(args=args)
    group_dic = {two_group[0]: a_group, two_group[1]: b_group}
    color_length[two_group[0]] = a_group
    color_length[two_group[1]] = b_group
    (color, length) = make_col_color_heatmap(group_dic, args=args)
    save_data_pdf(gene_list, ('host_gene_%s' % name), length, color, group_dic, which, args=args)
    pd.DataFrame({'gene': feature_gene}).to_csv(('feature_gene_pval%0.2f.txt' % args.pval), sep='\t', index=False)
    feature_gene_cnv = gene_list.ix[feature_gene]
    evaluate_model(gene_list, a_group, b_group, feature_gene, name=('feature_gene_%s' % name), args=args)
    save_data_pdf(feature_gene_cnv, ('feature_gene_%s' % name), length, color, group_dic, which, args=args)
    os.chdir(args.outdir)