예제 #1
0
def write_fixations(pops, fixationsFileName, repid):
    x = fp.view_fixations(pops)
    #hdf=pd.HDFStore(fixationsFileName,'a',complevel=6,complib='zlib')
    con = sqlite3.connect(fixationsFileName)
    df = [pd.DataFrame(i) for i in x]
    for i in df:
        i['rep'] = [repid] * len(i.index)
        repid += 1
        i.to_sql('fixations', con, if_exists='append', index=False)
        #hdf.append('fixations',i)
    con.close()
예제 #2
0
 def testFixationViews(self):
     temp = fwdpy.view_fixations(pops[0])
예제 #3
0
nlist = np.array([N]*10*N,dtype=np.uint32)

rng = fp.GSLrng(101)

pops = fp.evolve_regions(rng,       #The random number generator
                         4,         #The number of pops to simulate = number of threads to use.
                         N,         #Initial population size for each of the 4 demes
                         nlist[0:], #List of population sizes over time.
                         0.005,     #Neutral mutation rate (per gamete, per generation)
                         0.01,      #Deleterious mutation rate (per gamete, per generation)
                         0.005,     #Recombination rate (per diploid, per generation)
                         nregions,  #Defined above
                         sregions,  #Defined above
                         recregions)#Defined above
##Get fixation views:
fixations = [fp.view_fixations(i) for i in pops]
##Get mutation views:
mviews = fp.view_mutations(pops)

class test_sample_details(unittest.TestCase):
    def test_CompareUsingView(self):
        """
        Evolve some population, take samples,
        get details of those samples, make sure
        those details match up what 'views' think should
        be in the population.
        """
        samples = [fp.get_samples(rng,i,100) for i in pops]
        
        details = [fp.get_sample_details(i[1],j) for i,j in zip(samples,pops)]
예제 #4
0
 def testFixationViews(self):
     temp = fwdpy.view_fixations(pops[0])