コード例 #1
0
 def test_zero_has_parent(self):
     tables = tskit.TableCollection(1)
     tables.nodes.add_row(time=1, flags=0)
     tables.nodes.add_row(time=2, flags=0)
     tables.edges.add_row(0, 1, 1, 0)
     with self.assertRaises(ValueError):
         tsinfer.check_ancestors_ts(tables.tree_sequence())
コード例 #2
0
 def test_zero_has_no_children(self):
     tables = tskit.TableCollection(1)
     tables.nodes.add_row(time=1, flags=0)
     tables.nodes.add_row(time=2, flags=0)
     tables.nodes.add_row(time=3, flags=0)
     tables.edges.add_row(0, 1, 2, 1)
     with pytest.raises(ValueError):
         tsinfer.check_ancestors_ts(tables.tree_sequence())
コード例 #3
0
 def test_many_mutations(self):
     tables = tskit.TableCollection(1)
     tables.nodes.add_row(time=2, flags=0)
     tables.nodes.add_row(time=1, flags=0)
     tables.edges.add_row(0, 1, 0, 1)
     tables.sites.add_row(position=0.5, ancestral_state="0")
     tables.mutations.add_row(site=0, node=0, derived_state="1")
     tables.mutations.add_row(site=0, node=1, derived_state="0")
     tsinfer.check_ancestors_ts(tables.tree_sequence())
コード例 #4
0
ファイル: test_evaluation.py プロジェクト: dianalir/tsinfer
 def verify_from_source(self, remove_leaves):
     ts = msprime.simulate(15, recombination_rate=1, mutation_rate=2, random_seed=3)
     samples = tsinfer.SampleData.from_tree_sequence(ts)
     ancestors_ts = tsinfer.make_ancestors_ts(
         samples, ts, remove_leaves=remove_leaves)
     tsinfer.check_ancestors_ts(ancestors_ts)
     for engine in [tsinfer.PY_ENGINE, tsinfer.C_ENGINE]:
         final_ts = tsinfer.match_samples(samples, ancestors_ts, engine=engine)
     tsinfer.verify(samples, final_ts)
コード例 #5
0
 def test_disconnected_subtrees(self):
     tables = tskit.TableCollection(1)
     tables.nodes.add_row(time=4, flags=1)
     tables.nodes.add_row(time=3, flags=1)
     tables.nodes.add_row(time=2, flags=1)
     tables.nodes.add_row(time=1, flags=1)
     tables.edges.add_row(0, 1, 2, 3)
     tables.edges.add_row(0, 1, 0, 1)
     with self.assertRaises(ValueError):
         tsinfer.check_ancestors_ts(tables.tree_sequence())
コード例 #6
0
 def test_tsinfer_output(self):
     ts = msprime.simulate(10, mutation_rate=1, random_seed=1)
     samples = tsinfer.SampleData.from_tree_sequence(ts)
     ts = tsinfer.infer(samples)
     with self.assertRaises(ValueError):
         tsinfer.check_ancestors_ts(ts)
コード例 #7
0
 def test_msprime_output(self):
     ts = msprime.simulate(10, mutation_rate=1, random_seed=1)
     with self.assertRaises(ValueError):
         tsinfer.check_ancestors_ts(ts)
コード例 #8
0
 def test_one_edge(self):
     tables = tskit.TableCollection(1)
     tables.nodes.add_row(time=2, flags=0)
     tables.nodes.add_row(time=1, flags=0)
     tables.edges.add_row(0, 1, 0, 1)
     tsinfer.check_ancestors_ts(tables.tree_sequence())
コード例 #9
0
 def test_zero_time(self):
     tables = tskit.TableCollection(1)
     tables.nodes.add_row(time=0, flags=0)
     with self.assertRaises(ValueError):
         tsinfer.check_ancestors_ts(tables.tree_sequence())
コード例 #10
0
 def test_empty(self):
     tables = tskit.TableCollection(1)
     tsinfer.check_ancestors_ts(tables.tree_sequence())
コード例 #11
0
 def test_tsinfer_output(self, small_sd_fixture):
     ts = tsinfer.infer(small_sd_fixture)
     with pytest.raises(ValueError):
         tsinfer.check_ancestors_ts(ts)
コード例 #12
0
 def test_msprime_output(self, small_ts_fixture):
     with pytest.raises(ValueError):
         tsinfer.check_ancestors_ts(small_ts_fixture)
コード例 #13
0
 def test_zero_edges(self):
     tables = tskit.TableCollection(1)
     tables.nodes.add_row(time=1, flags=0)
     with pytest.raises(ValueError):
         tsinfer.check_ancestors_ts(tables.tree_sequence())