Пример #1
0
 def test_small_smc(self):
     base_ts = get_smc_simulation(5, L=1, recombination_rate=10, seed=111)
     assert base_ts.num_trees > 1
     for engine in [tsinfer.PY_ENGINE, tsinfer.C_ENGINE]:
         ts, inferred_ts = tsinfer.run_perfect_inference(base_ts,
                                                         engine=engine)
         self.verify_perfect_inference(ts, inferred_ts)
Пример #2
0
 def test_small_smc_no_time_chunking(self):
     base_ts = get_smc_simulation(10, L=1, recombination_rate=10, seed=113)
     self.assertGreater(base_ts.num_trees, 1)
     for engine in [tsinfer.PY_ENGINE, tsinfer.C_ENGINE]:
         ts, inferred_ts = tsinfer.run_perfect_inference(
             base_ts, engine=engine, time_chunking=False)
         self.verify_perfect_inference(ts, inferred_ts)
Пример #3
0
 def test_small_smc_threads(self):
     base_ts = get_smc_simulation(5, L=1, recombination_rate=10, seed=112)
     self.assertGreater(base_ts.num_trees, 1)
     for engine in [tsinfer.PY_ENGINE, tsinfer.C_ENGINE]:
         ts, inferred_ts = tsinfer.run_perfect_inference(
             base_ts, engine=engine, num_threads=4)
         self.verify_perfect_inference(ts, inferred_ts)
Пример #4
0
 def test_small_use_ts(self):
     base_ts = msprime.simulate(5, recombination_rate=10, random_seed=112)
     self.assertGreater(base_ts.num_trees, 1)
     for engine in [tsinfer.PY_ENGINE, tsinfer.C_ENGINE]:
         ts, inferred_ts = tsinfer.run_perfect_inference(
                 base_ts, use_ts=True, engine=engine)
         self.verify_perfect_inference(ts, inferred_ts)
Пример #5
0
 def test_sample_20_use_ts(self):
     base_ts = msprime.simulate(20,
                                length=5,
                                recombination_rate=10,
                                random_seed=111)
     self.assertGreater(base_ts.num_trees, 5)
     ts, inferred_ts = tsinfer.run_perfect_inference(base_ts, use_ts=True)
     self.verify_perfect_inference(ts, inferred_ts)
Пример #6
0
 def test_sample_20_smc_path_compression(self):
     base_ts = get_smc_simulation(20, L=5, recombination_rate=10, seed=111)
     self.assertGreater(base_ts.num_trees, 5)
     ts, inferred_ts = tsinfer.run_perfect_inference(base_ts, path_compression=True)
     # We can't just compare tables when doing path compression because
     # we'll find different ways of expressing the same trees.
     breakpoints, distances = tsinfer.compare(ts, inferred_ts)
     self.assertTrue(np.all(distances == 0))
Пример #7
0
 def test_small_use_ts_path_compression(self):
     base_ts = msprime.simulate(5, recombination_rate=10, random_seed=112)
     self.assertGreater(base_ts.num_trees, 1)
     for engine in [tsinfer.PY_ENGINE, tsinfer.C_ENGINE]:
         ts, inferred_ts = tsinfer.run_perfect_inference(
             base_ts, use_ts=True, path_compression=True, engine=engine)
         # We can't just compare tables when doing path compression because
         # we'll find different ways of expressing the same trees.
         breakpoints, distances = tsinfer.compare(ts, inferred_ts)
         self.assertTrue(np.all(distances == 0))
Пример #8
0
 def test_small_smc_path_compression(self):
     base_ts = get_smc_simulation(5, L=1, recombination_rate=10, seed=111)
     assert base_ts.num_trees > 1
     for engine in [tsinfer.PY_ENGINE, tsinfer.C_ENGINE]:
         ts, inferred_ts = tsinfer.run_perfect_inference(
             base_ts, engine=engine, path_compression=True)
         # We can't just compare tables when doing path compression because
         # we'll find different ways of expressing the same trees.
         breakpoints, distances = tsinfer.compare(ts, inferred_ts)
         assert np.all(distances == 0)
Пример #9
0
 def test_single_tree_defaults(self):
     base_ts = msprime.simulate(5, random_seed=234)
     for engine in [tsinfer.PY_ENGINE, tsinfer.C_ENGINE]:
         ts, inferred_ts = tsinfer.run_perfect_inference(base_ts,
                                                         engine=engine)
         self.verify_perfect_inference(ts, inferred_ts)