Exemplo n.º 1
0
 def GP(data, init_haps, positions, N, r, times, numThreads=1, pool=None):
     if numThreads==1:
         results=[GP.singleLocus(data[:, (i,), :],init_haps[:, (i,)], N, r, times, pos) for i, pos in enumerate(positions)]
     else:
         params=[{'X':data[:, (i,), :],'initHaps':init_haps[:, (i,)], 'N':N, 'r': r, 'times':times, 'pos':pos } for i, pos in enumerate(positions)]
         results=pool.map(gpHelper,params)
     df=pd.DataFrame(map(lambda x:x.values(),results),columns=results[0].keys()).astype(float);df.index=df.pos.astype(int);df.drop('pos',axis=1,inplace=True)
     return df
Exemplo n.º 2
0
Arquivo: Run.py Projeto: airanmehr/bio
def runGPTimes():
    import popgen.TimeSeries.GaussianProcess.Estimate as GP
    reload(GP)
    sim=Simulation.Simulation.Load(s=0.1)
    times=[]
    for nloci in [1, 3, 5, 7, 10]:
        for _ in range(200):
            l=np.sort(np.random.choice(sim.X.shape[1],nloci,replace=False))
            times+=[(nloci,GP.multipleLocus(sim.X[:, l, :],sim.H0.values[:,l], sim.N, sim.r, sim.getGenerationTimes(), np.array(sim.positions)[l]).Time, sim.X[0,l[0]].mean())]
            print times[-1]
    df=pd.DataFrame(times,columns=['n','time','x0'])

    df.to_pickle(utl.outpath+'ROC/GPTimes.df')
Exemplo n.º 3
0
def gpHelper(args):
    return GP.singleLocus(**args)