Пример #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
        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)
# F.rolling(window=1000,center=True).mean().plot();plt.axvline(M.columns[ba_ind],color='r');
# G=pd.concat([D.abs().sum(1),M.mean()],axis=1)
# G.sort_values([0])
idx=(M.mean()>0.1)
N=M.iloc[:,idx.values]
ba_indn=np.where(N.columns==500000)[0][0]