Пример #1
0
def loadData():
    f_dir = "/home/arya/storage/LD_analysis"
    my_global_functions.my_mkdir(f_dir)
    fname="%s/sim.sel.msms"%f_dir
    w = 1000e3
    theta = 50*w/50e3
    rho = 25*w/50e3
    nu0 = 0.5
    s = 0.05
    window=50
    _=mymsms.run_msms_simulator(fname, s=s,freq=nu0, n = 200,rho=rho, theta=theta, window_size=w);[M, snp_pos, ba_ind, oc] = mymsms.read_msms_file_info(fname);
    M=pd.DataFrame(M,columns=(pd.Series(snp_pos)*w).round().astype(int).values).astype(int);
    M.L=w
    M.siteUnderSelection=ba_ind
    M.posUnderSelection=M.columns[ba_ind]
    M.oc=oc
    return M
Пример #2
0
        n = 1.0 * N / (np.unique(haf).shape[0])
        f = Mw.mean(0)
        p = myHAF.neutrality_divergence_likelihood_2(h, n, f, method=3)
        I = np.argsort(p)[::-1]
        top_kw = len(I)
        P += list(p[I[:top_kw]])
        x += list(w_st + I[:top_kw])
        w_st += w_step
        if Mw.shape[1] < w_size:
            break
    d = pd.DataFrame([x, P]).T
    D = d.groupby(0).mean().reset_index()
    return D

f_dir = "/home/arya/storage/LD_analysis"
my_global_functions.my_mkdir(f_dir)
fname="%s/sim.sel.msms"%f_dir
w = 1000e3
theta = 50*w/50e3
rho = 25*w/50e3
nu0 = 0.5
s = 0.5
window=50
mymsms.run_msms_simulator(fname, s=s,freq=nu0, n = 200,rho=rho, theta=theta, window_size=w);[M, snp_pos, ba_ind, oc] = mymsms.read_msms_file_info(fname);M=pd.DataFrame(M,columns=(pd.Series(snp_pos)*w).round().astype(int).values);
# D=est.Estimate.LD(M).round(2)
# E=D.copy(True)
# D
# E[E<0]=None
# E
# F=E.applymap(lambda x: x**200).sum(1)
# F2=D.applymap(lambda x: x**200).sum(1)