Take a look at the following steps:
- Let's load population names and execute Genepop externally to compute genotypic frequencies, as follows:
from Bio.PopGen.GenePop import Controller as gpcctrl = gpc.GenePopController()my_pops = [l.rstrip() for l in open('hapmap10_auto_noofs_2.pops')]num_pops = len(my_pops)pop_iter, loci_iter = ctrl.calc_allele_genotype_freqs('hapmap10_auto_noofs_2.gp')
First, we create a controller (an object that allows you to interact with the Genepop application). Then, we load population names. Finally, we compute the genotypic information, which may take some time. Our controller will return two iterators, exposing results per population and per loci.