Package Bio :: Package PopGen :: Package GenePop :: Class Record
[hide private]
[frames] | no frames]

Class Record

source code

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

pop_list           List of population names.

populations        List of population data.

In most genepop files, the population name is not trustable.
It is strongly recommended that populations are referred by index.

populations has one element per population. Each element is itself
a list of individuals, each individual is a pair composed by individual
name and a list of alleles (2 per marker): Example
[
    [
        ('Ind1', [(1,2),    (3,3), (200,201)],
        ('Ind2', [(2,None), (3,3), (None,None)],
    ],
    [
        ('Other1', [(1,1),  (4,3), (200,200)],
    ]
]

Instance Methods [hide private]
 
__init__(self) source code
 
__str__(self)
Returns (reconstructs) a GenePop textual representation.
source code
 
split_in_pops(self, pop_names)
Splits a GP record in a dictionary with 1 pop per entry.
source code
 
split_in_loci(self, gp)
Splits a GP record in a dictionary with 1 locus per entry.
source code
 
remove_population(self, pos)
Removes a population (by position).
source code
 
remove_locus_by_position(self, pos)
Removes a locus by position.
source code
 
remove_locus_by_name(self, name)
Removes a locus by name.
source code
Method Details [hide private]

split_in_pops(self, pop_names)

source code 

Splits a GP record in a dictionary with 1 pop per entry.

Given a record with n pops and m loci returns a dictionary of records (key pop_name) where each item is a record with a single pop and m loci.

Parameters: pop_names - Population names

split_in_loci(self, gp)

source code 

Splits a GP record in a dictionary with 1 locus per entry.

Given a record with n pops and m loci returns a dictionary of records (key locus name) where each item is a record with a single locus and n pops.