def test_Tajimas_D_per_site(sample_size): ts = simulate_ts(sample_size, random_seed=1234) ds = ts_to_dataset(ts) ds, subsets = add_cohorts(ds, ts, cohort_key_names=None) ds = Tajimas_D(ds) d = ds.stat_Tajimas_D.compute().squeeze() ts_d = ts.Tajimas_D(windows="sites") np.testing.assert_allclose(d, ts_d)
def test_Tajimas_D(sample_size): ts = simulate_ts(sample_size) ds = ts_to_dataset(ts) ds, subsets = add_cohorts(ds, ts, cohort_key_names=None) n_variants = ds.dims["variants"] ds = window_by_variant(ds, size=n_variants) # single window ds = Tajimas_D(ds) d = ds.stat_Tajimas_D.compute() ts_d = ts.Tajimas_D() np.testing.assert_allclose(d, ts_d)
def test_Tajimas_D(sample_size): ts = msprime.simulate(sample_size, length=100, mutation_rate=0.05, random_seed=42) ds = ts_to_dataset(ts) # type: ignore[no-untyped-call] ds, subsets = add_cohorts( ds, ts, cohort_key_names=None) # type: ignore[no-untyped-call] n_variants = ds.dims["variants"] ds = window(ds, size=n_variants) # single window ds = Tajimas_D(ds) d = ds.stat_Tajimas_D.compute() ts_d = ts.Tajimas_D() np.testing.assert_allclose(d, ts_d)