# Bio.PopGen.GenePop package

## Submodules

- Bio.PopGen.GenePop.FileParser module
  - `read()`
  - `FileRecord`
    - `FileRecord.__init__()`
    - `FileRecord.__str__()`
    - `FileRecord.start_read()`
    - `FileRecord.skip_header()`
    - `FileRecord.seek_position()`
    - `FileRecord.skip_population()`
    - `FileRecord.get_individual()`
    - `FileRecord.remove_population()`
    - `FileRecord.remove_locus_by_position()`
    - `FileRecord.remove_loci_by_position()`
    - `FileRecord.remove_locus_by_name()`
    - `FileRecord.remove_loci_by_name()`
    - `FileRecord.__annotate_func__`
    - `FileRecord.__annotations_cache__`
    - `FileRecord.__firstlineno__`
    - `FileRecord.__static_attributes__`
- Bio.PopGen.GenePop.LargeFileParser module
  - `get_indiv()`
  - `read()`
  - `Record`
    - `Record.__init__()`
    - `Record.data_generator()`
    - `Record.__annotate_func__`
    - `Record.__annotations_cache__`
    - `Record.__firstlineno__`
    - `Record.__static_attributes__`

## Module contents

Code to work with GenePop.

See http://wbiomed.curtin.edu.au/genepop/ , the format is documented here: http://wbiomed.curtin.edu.au/genepop/help_input.html .

Classes: Record Holds GenePop data.

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

Partially inspired by MedLine Code.

Bio.PopGen.GenePop.get_indiv(line)

  Extract the details of the individual information on the line.

Bio.PopGen.GenePop.read(handle)

  Parse a handle containing a GenePop file.

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

class Bio.PopGen.GenePop.Record

  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.

  > - 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 or 1 for haploids): Example:

      [
          [
              ('Ind1', [(1,2),    (3,3), (200,201)],
              ('Ind2', [(2,None), (3,3), (None,None)],
          ],
          [
              ('Other1', [(1,1),  (4,3), (200,200)],
          ]
      ]

  __init__()

    Initialize the class.

  __str__()

    Return (reconstruct) a GenePop textual representation.

  split_in_pops(pop_names)

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

    Arguments: - pop_names - Population names

  split_in_loci(gp)

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

  remove_population(pos)

    Remove a population (by position).

  remove_locus_by_position(pos)

    Remove a locus by position.

  remove_locus_by_name(name)

    Remove a locus by name.

  __annotate_func__ = None
  __annotations_cache__ = {}
  __firstlineno__ = 97
  __static_attributes__ = ('comment_line', 'loci_list', 'marker_len', 'pop_list', 'populations')

Biopython v: 1.86

Versions
  Previous
  Latest
  Develop

Biopython Project
  Homepage
  On GitHub