Bio.PopGen.GenePop.LargeFileParser module

Large file parsing of Genepop files.

The standard parser loads the whole file into memory. This parser provides an iterator over data.

Classes: - LargeRecord - Holds GenePop data.

Functions: - read - Parses a GenePop record (file) into a Record object.

Bio.PopGen.GenePop.LargeFileParser.get_indiv(line)

Get individual’s data from line.

Bio.PopGen.GenePop.LargeFileParser.read(handle)

Parse a handle containing a GenePop file.

Arguments: - handle is a file-like object that contains a GenePop record.

class Bio.PopGen.GenePop.LargeFileParser.Record(handle)

Bases: object

Hold information from a GenePop record.

Members: marker_len The marker length (2 or 3 digit code per allele).

comment_line Comment line.

loci_list List of loci names.

data_generator Iterates over population data.

The generator will only work once. If you want to read a handle twice you have to re-open it!

data_generator can either be () - an empty tuple - marking a new population or an individual. An individual is something like (‘Ind1’, [(1,1), (3,None), (200,201)], In the case above the individual is called Ind1, has three diploid loci. For the second loci, one of the alleles is unknown.

__init__(handle)

Initialize the class.

data_generator()

Extract population data.