def test_CountFixationsInSample4(self): samples = [fp.ms_sample(rng,i,100) for i in pops] ##Checks that no "true fixations" are in vector for i in range(len(fixations)): FOUND=0 for f in fixations[i]: mm=[X for X in samples[i] if X[0] == f['pos']] FOUND+=len(mm) self.assertEqual(FOUND,0) ##Checks that no polymorphisms are present as fixations in sample for i in samples: for j in i: self.assertTrue(j[1].count(b'1')<100)
def test_CountFixationsInSample1(self): """ Evolve some pops, take samples w/o removing fixations, Make sure that all mutations in a view of fixations are also present in the sample. Ultimately, this is just a test of whether or not fwdpy passes the correct args to fwdpp. """ #False = DO NOT remove fixed variants samples = [fp.ms_sample(rng,i,100,False) for i in pops] #This fxn merges all selected + neutral variants into 1 object per replicate #for each collection of fixations... for i in range(len(fixations)): #...go thru each fixation... FOUND=0 for f in fixations[i]: #...find it in the sample object for the correct replicate... mm=[X for X in samples[i] if X[0] == f['pos']] FOUND+=len(mm) self.assertEqual(FOUND,len(fixations[i]))