How to do it...

Take a look at the following steps:

  1. 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.

We will use a relatively small dataset, which makes ...

Get Bioinformatics with Python Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.