def check_prior_recovery(net_fn, priors_fn): (net, genes, tfs) = load_network(net_fn) (p, sign) = load_priors(priors_fn, '1') pcon = fl.priors_to_constraints(['1'], [genes],[tfs],p,0.5) prior_inter = [] for con in pcon: prior_inter.append(net[con.c1.r, con.c1.c]) return (np.array(prior_inter), np.array(sign))
def check_prior_corr(expr_fn, tfs_fn, priors_fn): (e, t, genes, tfs) = load_bacteria(expr_fn, tfs_fn) (p, s) = load_priors(priors_fn,'1') pcon = fl.priors_to_constraints(['1'], [genes],[tfs],p,0.5) prior_corr = [] for con in pcon: tfi = con.c1.r gi = con.c1.c tf_expr = t[:, tfi] g_expr = e[:, gi] corr = np.corrcoef(tf_expr, g_expr)[0,1] prior_corr.append(corr) return (prior_corr, s)