def test_keep_mutation_parent(self): ts = msprime.simulate(12, recombination_rate=3, random_seed=3) ts = tsutil.insert_branch_mutations(ts) self.assertGreater(ts.num_sites, 2) other = msprime.mutate(ts, rate=1, random_seed=1, keep=True) self.assertGreater(other.num_sites, ts.num_sites) self.verify_sites(ts, other)
def test_single_tree_regular_mutations(self): ts = msprime.simulate(self.num_test_sites, length=self.num_test_sites) ts = tsutil.insert_branch_mutations(ts) # We don't support back mutations, so this should fail. with pytest.raises(_tskit.LibraryError): self.verify_matrix(ts) with pytest.raises(_tskit.LibraryError): self.verify_max_distance(ts)
def test_keep_mutation_parent_zero_rate(self): ts = msprime.simulate(12, recombination_rate=3, random_seed=3) ts = tsutil.insert_branch_mutations(ts) self.assertGreater(ts.num_sites, 2) other = msprime.mutate(ts, rate=0, random_seed=1, keep=True) t1 = ts.dump_tables() t2 = other.dump_tables() t1.provenances.clear() t2.provenances.clear() self.assertEqual(t1, t2)
def test_back_mutations(self): base_ts = msprime.simulate(10, random_seed=2) for j in [1, 2, 3]: ts = tsutil.insert_branch_mutations(base_ts, mutations_per_branch=j) self.verify_tree_sequence(ts)
def recurrent_mutation_example(): ts = msprime.simulate(10, recombination_rate=1, length=10, random_seed=2) return tsutil.insert_branch_mutations(ts)
def test_single_tree_regular_mutations(self): ts = msprime.simulate(self.num_test_sites, length=self.num_test_sites) ts = tsutil.insert_branch_mutations(ts) # We don't support back mutations, so this should fail. self.assertRaises(_msprime.LibraryError, self.verify_matrix, ts) self.assertRaises(_msprime.LibraryError, self.verify_max_distance, ts)
def test_branch_mutations(self): ts = tsutil.insert_branch_mutations( msprime.simulate(10, recombination_rate=1, random_seed=2)) self.assertGreater(ts.num_sites, 1) self.verify(ts, 3, random_seed=7)