Package Bio :: Package PopGen :: Package GenePop :: Module Controller :: Class GenePopController
[hide private]
[frames] | no frames]

Class GenePopController

source code

object --+
         |
        GenePopController

Instance Methods [hide private]
 
__init__(self, genepop_dir=None)
Initializes the controller.
source code
 
_get_opts(self, dememorization, batches, iterations, enum_test=None) source code
 
_run_genepop(self, extensions, option, fname, opts={}) source code
 
_test_pop_hz_both(self, fname, type, ext, enum_test=True, dememorization=10000, batches=20, iterations=5000)
Hardy-Weinberg test for heterozygote deficiency/excess.
source code
 
_test_global_hz_both(self, fname, type, ext, enum_test=True, dememorization=10000, batches=20, iterations=5000)
Global Hardy-Weinberg test for heterozygote deficiency/excess.
source code
 
test_pop_hz_deficiency(self, fname, enum_test=True, dememorization=10000, batches=20, iterations=5000)
Hardy-Weinberg test for heterozygote deficiency.
source code
 
test_pop_hz_excess(self, fname, enum_test=True, dememorization=10000, batches=20, iterations=5000)
Hardy-Weinberg test for heterozygote deficiency.
source code
 
test_pop_hz_prob(self, fname, ext, enum_test=False, dememorization=10000, batches=20, iterations=5000)
Hardy-Weinberg test based on probability.
source code
 
test_global_hz_deficiency(self, fname, enum_test=True, dememorization=10000, batches=20, iterations=5000)
Global Hardy-Weinberg test for heterozygote deficiency.
source code
 
test_global_hz_excess(self, fname, enum_test=True, dememorization=10000, batches=20, iterations=5000)
Global Hardy-Weinberg test for heterozygote excess.
source code
 
test_ld(self, fname, dememorization=10000, batches=20, iterations=5000) source code
 
create_contingency_tables(self, fname) source code
 
test_genic_diff_all(self, fname, dememorization=10000, batches=20, iterations=5000) source code
 
test_genic_diff_pair(self, fname, dememorization=10000, batches=20, iterations=5000) source code
 
test_genotypic_diff_all(self, fname, dememorization=10000, batches=20, iterations=5000) source code
 
test_genotypic_diff_pair(self, fname, dememorization=10000, batches=20, iterations=5000) source code
 
estimate_nm(self, fname) source code
 
calc_allele_genotype_freqs(self, fname)
Calculates allele and genotype frequencies per locus and per sample.
source code
 
_calc_diversities_fis(self, fname, ext) source code
 
calc_diversities_fis_with_identity(self, fname) source code
 
calc_diversities_fis_with_size(self, fname) source code
 
calc_fst_all(self, fname)
Executes GenePop and gets Fst/Fis/Fit (all populations)
source code
 
calc_fst_pair(self, fname) source code
 
calc_rho_all(self, fname) source code
 
calc_rho_pair(self, fname) source code
 
_calc_ibd(self, fname, sub, stat='a', scale='Log', min_dist=1e-05)
Calculates isolation by distance statistics
source code
 
calc_ibd_diplo(self, fname, stat='a', scale='Log', min_dist=1e-05)
Calculates isolation by distance statistics for diploid data.
source code
 
calc_ibd_haplo(self, fname, stat='a', scale='Log', min_dist=1e-05)
Calculates isolation by distance statistics for haploid data.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, genepop_dir=None)
(Constructor)

source code 

Initializes the controller.

genepop_dir is the directory where GenePop is.

The binary should be called Genepop (capital G)

Overrides: object.__init__

_test_pop_hz_both(self, fname, type, ext, enum_test=True, dememorization=10000, batches=20, iterations=5000)

source code 

Hardy-Weinberg test for heterozygote deficiency/excess.

Returns a population iterator containing a dictionary where dictionary[locus]=(P-val, SE, Fis-WC, Fis-RH, steps).

Some loci have a None if the info is not available. SE might be none (for enumerations).

_test_global_hz_both(self, fname, type, ext, enum_test=True, dememorization=10000, batches=20, iterations=5000)

source code 

Global Hardy-Weinberg test for heterozygote deficiency/excess.

Returns a triple with:

  • A list per population containing (pop_name, P-val, SE, switches). Some pops have a None if the info is not available. SE might be none (for enumerations).
  • A list per loci containing (locus_name, P-val, SE, switches). Some loci have a None if the info is not available. SE might be none (for enumerations).
  • Overall results (P-val, SE, switches).

test_pop_hz_deficiency(self, fname, enum_test=True, dememorization=10000, batches=20, iterations=5000)

source code 

Hardy-Weinberg test for heterozygote deficiency.

Returns a population iterator containing a dictionary wehre dictionary[locus]=(P-val, SE, Fis-WC, Fis-RH, steps).

Some loci have a None if the info is not available. SE might be none (for enumerations).

test_pop_hz_excess(self, fname, enum_test=True, dememorization=10000, batches=20, iterations=5000)

source code 

Hardy-Weinberg test for heterozygote deficiency.

Returns a population iterator containing a dictionary where dictionary[locus]=(P-val, SE, Fis-WC, Fis-RH, steps).

Some loci have a None if the info is not available. SE might be none (for enumerations).

test_pop_hz_prob(self, fname, ext, enum_test=False, dememorization=10000, batches=20, iterations=5000)

source code 

Hardy-Weinberg test based on probability.

Returns 2 iterators and a final tuple:

  1. Returns a loci iterator containing:
    • A dictionary[pop_pos]=(P-val, SE, Fis-WC, Fis-RH, steps). Some pops have a None if the info is not available. SE might be none (for enumerations).
    • Result of Fisher's test (Chi2, deg freedom, prob).
  2. Returns a population iterator containing:
    • A dictionary[locus]=(P-val, SE, Fis-WC, Fis-RH, steps). Some loci have a None if the info is not available. SE might be none (for enumerations).
    • Result of Fisher's test (Chi2, deg freedom, prob).
  3. Final tuple (Chi2, deg freedom, prob).

test_global_hz_deficiency(self, fname, enum_test=True, dememorization=10000, batches=20, iterations=5000)

source code 

Global Hardy-Weinberg test for heterozygote deficiency.

Returns a triple with:

  • An list per population containing (pop_name, P-val, SE, switches). Some pops have a None if the info is not available. SE might be none (for enumerations).
  • An list per loci containing (locus_name, P-val, SE, switches). Some loci have a None if the info is not available. SE might be none (for enumerations).
  • Overall results (P-val, SE, switches).

test_global_hz_excess(self, fname, enum_test=True, dememorization=10000, batches=20, iterations=5000)

source code 

Global Hardy-Weinberg test for heterozygote excess.

Returns a triple with:

  • A list per population containing (pop_name, P-val, SE, switches). Some pops have a None if the info is not available. SE might be none (for enumerations).
  • A list per loci containing (locus_name, P-val, SE, switches). Some loci have a None if the info is not available. SE might be none (for enumerations).
  • Overall results (P-val, SE, switches)

calc_allele_genotype_freqs(self, fname)

source code 

Calculates allele and genotype frequencies per locus and per sample.

Parameters:

  • fname - file name

Returns tuple with 2 elements:

  • Population iterator with
    • population name
    • Locus dictionary with key = locus name and content tuple as Genotype List with (Allele1, Allele2, observed, expected) (expected homozygotes, observed hm, expected heterozygotes, observed ht)
    • Allele frequency/Fis dictionary with allele as key and (count, frequency, Fis Weir & Cockerham)
    • Totals as a pair
    • count
    • Fis Weir & Cockerham,
    • Fis Robertson & Hill
  • Locus iterator with
    • Locus name
    • allele list
    • Population list with a triple
      • population name
      • list of allele frequencies in the same order as allele list above
      • number of genes

Will create a file called fname.INF

calc_fst_all(self, fname)

source code 

Executes GenePop and gets Fst/Fis/Fit (all populations)

Parameters:

  • fname - file name

Returns:

  • (multiLocusFis, multiLocusFst, multiLocus Fit),
  • Iterator of tuples (Locus name, Fis, Fst, Fit, Qintra, Qinter)

Will create a file called fname.FST .

This does not return the genotype frequencies.

calc_ibd_diplo(self, fname, stat='a', scale='Log', min_dist=1e-05)

source code 

Calculates isolation by distance statistics for diploid data.

See _calc_ibd for parameter details. Note that each pop can only have a single individual and the individual name has to be the sample coordinates.

calc_ibd_haplo(self, fname, stat='a', scale='Log', min_dist=1e-05)

source code 

Calculates isolation by distance statistics for haploid data.

See _calc_ibd for parameter details. Note that each pop can only have a single individual and the individual name has to be the sample coordinates.