def test_wright_fisher_trees(self): tables = wf.wf_sim(20, 10, seed=1, deep_history=False) tables.sort() ts = tables.tree_sequence() self.verify(ts, rate=10) ts = ts.simplify() self.verify(ts, rate=10)
def get_wf_base(N, ngens, survival=0.0, num_loci=10, seed=1): """ Returns a forward time simulation suitable for using with simulate-from. """ tables = wf.wf_sim( N, ngens, seed=seed, survival=survival, deep_history=False, initial_generation_samples=True, num_loci=num_loci) tables.sort() tables.simplify() # Unmark the ancient samples flags = tables.nodes.flags flags = np.zeros_like(flags) flags[tables.nodes.time == 0] = msprime.NODE_IS_SAMPLE tables.nodes.set_columns( flags=flags, population=tables.nodes.population, time=tables.nodes.time) return tables.tree_sequence()
def get_wf_base(N, ngens, survival=0.0, num_loci=10, seed=1): """ Returns a forward time simulation suitable for using with simulate-from. """ tables = wf.wf_sim(N, ngens, seed=seed, survival=survival, deep_history=False, initial_generation_samples=True, num_loci=num_loci) tables.sort() tables.simplify() # Unmark the ancient samples flags = tables.nodes.flags flags = np.zeros_like(flags) flags[tables.nodes.time == 0] = msprime.NODE_IS_SAMPLE tables.nodes.set_columns(flags=flags, population=tables.nodes.population, time=tables.nodes.time) return tables.tree_sequence()