}

The tskit library provides the underlying functionality used to load, examine, and manipulate tree sequences, including efficient methods for calculating genetic statistics. It often forms part of an installation of other software packages such as msprime, SLiM, fwdpp, and tsinfer.

ts = tskit.load("example.trees")
afs = ts.allele_frequency_spectrum()