Package Bio :: Package PopGen :: Package GenePop :: Module FileParser :: Class FileRecord
[hide private]
[frames] | no frames]

Class FileRecord

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.

Functions:
get_individual     Returns the next individual of the current population.

skip_population    Skips the current population.

skip_population skips the individuals of the current population, returns
True if there are more populations.

get_individual returns an individual of the current population (or None
if the list ended).
Each individual is a pair composed by individual
name and a list of alleles (2 per marker or 1 for haploid data).
Examples
        ('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, fname) source code
 
__str__(self)
Returns (reconstructs) a GenePop textual representation.
source code
 
start_read(self)
Starts parsing a file containing a GenePop file.
source code
 
skip_header(self)
Skips the Header.
source code
 
seek_position(self, pop, indiv)
Seeks a certain position in the file.
source code
 
skip_population(self)
Skips the current population.
source code
 
get_individual(self)
Gets the next individual.
source code
 
remove_population(self, pos)
Removes a population (by position).
source code
 
remove_locus_by_position(self, pos, fw)
Removes a locus by position.
source code
 
remove_locus_by_name(self, name, fw)
Removes a locus by name.
source code
Method Details [hide private]

__str__(self)
(Informal representation operator)

source code 

Returns (reconstructs) a GenePop textual representation.

This might take a lot of memory. Marker length will be 3.

skip_header(self)

source code 

Skips the Header. To be done after a re-open.

seek_position(self, pop, indiv)

source code 

Seeks a certain position in the file.

pop - pop position (0 is first) indiv - individual in pop

skip_population(self)

source code 

Skips the current population. Returns true if there is another pop.

get_individual(self)

source code 

Gets the next individual.

Returns individual information if there are more individuals in the current population. Returns True if there are no more individuals in the current population, but there are more populations. Next read will be of the following pop. Returns False if at end of file.

remove_population(self, pos)

source code 

Removes a population (by position).

pos - position fw - A file handle (write enabled) to write the new record

remove_locus_by_position(self, pos, fw)

source code 

Removes a locus by position.

pos - position fw - A file handle (write enabled) to write the new record

remove_locus_by_name(self, name, fw)

source code 

Removes a locus by name.

name - name fw - A file handle (write enabled) to write the new record