Exemple #1
0
def run_eVIP(infile=None, zscore_gct = None, out_directory=None, sig_info =None, c=None, r=None, num_reps=None,
         ie_filter=None,ie_col=None, i=None, allele_col=None, conn_null=None, conn_thresh=None,
         mut_wt_rep_rank_diff=None, use_c_pval=None, cell_id=None, plate_id=None, ref_allele_mode=None,
         x_thresh=None, y_thresh=None, annotate=None, by_gene_color=None, pdf=None, xmin=None,
         xmax=None, ymin=None, ymax=None, viz_ymin=None, viz_ymax=None, corr_val=None,mut_wt_rep_thresh=None,disting_thresh=None,sparkler_off=None,viz_off=None,cond_median_max_diff_thresh=None):

    #different sig_gctx for exp an z inputs used in viz

    sig_gctx_val = out_directory+ "/z_scores.gct"
    # if args.zscore_gct :
    #     sig_gctx_val = args.zscore_gct


    # run eVIP_corr.py
    # print('calculating correlations...')
    run_corr = eVIP_corr.run_main(input=infile,zscore_gct=zscore_gct, out_dir= out_directory)

    # print('comparing...')
    run_compare = eVIP_compare.run_main(sig_info=sig_info, gctx = out_directory+"/spearman_rank_matrix.gct",
                allele_col = allele_col, o= out_directory+"/compare", r = r,
             c = c, i = i, conn_null = conn_null, ie_col = ie_col,
             ie_filter = ie_filter, num_reps = num_reps, cell_id = cell_id, plate_id = plate_id)

    # print('predicting...')
    run_predict = eVIP_predict.run_main(out_directory+"/compare.txt", out_directory+"/predict", conn_thresh,
                mut_wt_rep_thresh, mut_wt_rep_rank_diff,
                disting_thresh, use_c_pval,cond_median_max_diff_thresh)


    if not sparkler_off:
        # print "making sparkler plots..."
        run_sparkler = eVIP_sparkler.eVIP_run_main(pred_file = out_directory+"/predict.txt", ref_allele_mode=ref_allele_mode,
                y_thresh = y_thresh , x_thresh = x_thresh,
                use_c_pval= use_c_pval,annotate=annotate, by_gene_color= by_gene_color, pdf= pdf,
                xmin= xmin, xmax = xmax, ymin = ymin, ymax = ymax, out_dir = out_directory+"/sparkler_plots")

    if not viz_off:
        # print "making visualizations..."
        if conn_null:
            null_conn = conn_null
        else:
            null_conn = out_directory + "/compare_conn_null.txt"

        run_viz = eVIP_viz.eVIP_run_main(pred_file= out_directory+"/predict.txt", sig_info = sig_info, gctx=out_directory+"/spearman_rank_matrix.gct",
                sig_gctx = sig_gctx_val, ref_allele_mode = ref_allele_mode, null_conn = null_conn,
                out_dir = out_directory+"/viz",ymin = viz_ymin, ymax= viz_ymax, allele_col = allele_col, use_c_pval = use_c_pval,
                 pdf = pdf, cell_id = cell_id, plate_id = plate_id, corr_val_str= corr_val)
Exemple #2
0
def run_eVIP_multiple_testing_pt1(infile=None, zscore_gct = None, out_directory=None, sig_info =None, c=None, r=None, num_reps=None,
         ie_filter=None,ie_col=None, i=None, allele_col=None, conn_null=None, conn_thresh=None,
         mut_wt_rep_rank_diff=None, use_c_pval=None, cell_id=None, plate_id=None, ref_allele_mode=None,
         x_thresh=None, y_thresh=None, annotate=None, by_gene_color=None, pdf=None, xmin=None,
         xmax=None, ymin=None, ymax=None, viz_ymin=None, viz_ymax=None, corr_val=None,sparkler_off=None,viz_off=None):

    #runs eVIP_corr and compare and returns the p values from compare
    #different sig_gctx for exp an z inputs used in viz

    sig_gctx_val = out_directory+ "/z_scores.gct"


    #run eVIP_corr.py
    # print('calculating correlations...')
    run_corr = eVIP_corr.run_main(input=infile,zscore_gct=zscore_gct, out_dir= out_directory)

    #run eVIP_compare.py
    # print('comparing...')
    run_compare = eVIP_compare.run_main(sig_info, out_directory+"/spearman_rank_matrix.gct", allele_col , out_directory+"/compare", r ,c , i , conn_null , ie_col, ie_filter, num_reps, cell_id , plate_id)

    #getting the p values from the pathway compare file
    mut_wt_rep_pvals_from_compare = []
    mut_wt_conn_null_pvals_from_compare = []
    wt_mut_rep_vs_wt_mut_conn_pvals_from_compare = []

    num_test_alleles = None

    with open(out_directory+"/compare.txt", "r") as compare_file:
        file_reader = csv.DictReader(compare_file, delimiter="\t")

        for row in file_reader:
            mut_wt_rep_pvals_from_compare.append(row['mut_wt_rep_pval'])
            mut_wt_conn_null_pvals_from_compare.append(row['mut_wt_conn_null_pval'])
            wt_mut_rep_vs_wt_mut_conn_pvals_from_compare.append(row['wt_mut_rep_vs_wt_mut_conn_pval'])


    #counting the number of mutations being tested
    with open(out_directory + "/compare.txt", "r") as compare_file:
        file_reader = csv.DictReader(compare_file, delimiter="\t")
        each_line = list(file_reader)
        num_test_alleles=len(each_line)

    return mut_wt_rep_pvals_from_compare, mut_wt_conn_null_pvals_from_compare, wt_mut_rep_vs_wt_mut_conn_pvals_from_compare,num_test_alleles
Exemple #3
0
def run_eVIP(infile=None,
             zscore_gct=None,
             out_directory=None,
             sig_info=None,
             c=None,
             r=None,
             num_reps=None,
             ie_filter=None,
             ie_col=None,
             i=None,
             allele_col=None,
             conn_null=None,
             conn_thresh=None,
             mut_wt_rep_rank_diff=None,
             use_c_pval=None,
             cell_id=None,
             plate_id=None,
             ref_allele_mode=None,
             x_thresh=None,
             y_thresh=None,
             annotate=None,
             by_gene_color=None,
             pdf=None,
             xmin=None,
             xmax=None,
             ymin=None,
             ymax=None,
             viz_ymin=None,
             viz_ymax=None,
             corr_val=None):

    #different sig_gctx for exp an z inputs used in viz
    if args.infile:
        sig_gctx_val = out_directory + "/z_scores.gct"
    if args.zscore_gct:
        sig_gctx_val = args.zscore_gct

    # run eVIP_corr.py
    print('calculating correlations...')
    run_corr = eVIP_corr.run_main(input=infile,
                                  zscore_gct=zscore_gct,
                                  out_dir=out_directory)

    print('comparing...')
    run_compare = eVIP_compare.run_main(sig_info=sig_info,
                                        gctx=out_directory +
                                        "/spearman_rank_matrix.gct",
                                        allele_col=args.allele_col,
                                        o=out_directory + "/compare",
                                        r=args.r,
                                        c=args.c,
                                        i=args.i,
                                        conn_null=args.conn_null,
                                        ie_col=args.ie_col,
                                        ie_filter=args.ie_filter,
                                        num_reps=args.num_reps,
                                        cell_id=args.cell_id,
                                        plate_id=args.plate_id)

    print('predicting...')
    run_predict = eVIP_predict.run_main(
        i=out_directory + "/compare.txt",
        o=out_directory + "/predict",
        conn_thresh=args.conn_thresh,
        mut_wt_rep_thresh=args.mut_wt_rep_thresh,
        mut_wt_rep_rank_diff=args.mut_wt_rep_rank_diff,
        disting_thresh=args.disting_thresh,
        use_c_pval=args.use_c_pval)

    if not args.sparkler_off:
        print "making sparkler plots..."
        run_sparkler = eVIP_sparkler.eVIP_run_main(
            pred_file=out_directory + "/predict.txt",
            ref_allele_mode=args.ref_allele_mode,
            y_thresh=args.y_thresh,
            x_thresh=args.x_thresh,
            use_c_pval=args.use_c_pval,
            annotate=args.annotate,
            by_gene_color=args.by_gene_color,
            pdf=args.pdf,
            xmin=args.xmin,
            xmax=args.xmax,
            ymin=args.ymin,
            ymax=args.ymax,
            out_dir=out_directory + "/sparkler_plots")

    if not args.viz_off:
        print "making visualizations..."
        if args.conn_null:
            null_conn = args.conn_null
        else:
            null_conn = out_directory + "/compare_conn_null.txt"

        run_viz = eVIP_viz.eVIP_run_main(
            pred_file=out_directory + "/predict.txt",
            sig_info=args.sig_info,
            gctx=out_directory + "/spearman_rank_matrix.gct",
            sig_gctx=sig_gctx_val,
            ref_allele_mode=args.ref_allele_mode,
            null_conn=null_conn,
            out_dir=out_directory + "/viz",
            ymin=args.viz_ymin,
            ymax=args.viz_ymax,
            allele_col=args.allele_col,
            use_c_pval=args.use_c_pval,
            pdf=args.pdf,
            cell_id=args.cell_id,
            plate_id=args.plate_id,
            corr_val_str=args.corr_val)