tskit-dev / pyslim

Tools for dealing with tree sequences coming to and from SLiM.
MIT License
26 stars 23 forks source link

Potential to use .frequencies() method in /tutorial.html #336

Open hyanwong opened 8 months ago

hyanwong commented 8 months ago

At the moment the tutorial.html page says:

"At time of writing, we don’t have a built-in allele_frequency method, so we’ll use the following snippet"

But now we have Variant.frequencies():

import msprime
ts = msprime.sim_mutations(msprime.sim_ancestry(10, sequence_length=10, random_seed=1), rate=1, random_seed=1)
for v in ts.variants(samples=np.arange(5)):
    print(v.frequencies())

I didn't fully look at the example, but would this make the whole thing easier, @petrelharp ?