Back to index

python-biopython  1.60
Public Member Functions
test_PopGen_GenePop.AppTest Class Reference

List of all members.

Public Member Functions

def test_allele_genotype_frequencies
def test_calc_diversities_fis_with_identity
def test_estimate_nm
def test_fst_all
def test_haploidy

Detailed Description

Tests genepop execution via biopython.

Definition at line 28 of file test_PopGen_GenePop.py.


Member Function Documentation

Test genepop execution on basic allele and genotype frequencies.

Definition at line 32 of file test_PopGen_GenePop.py.

00032 
00033     def test_allele_genotype_frequencies(self):
00034         """Test genepop execution on basic allele and genotype frequencies.
00035         """
00036         ctrl = GenePopController()
00037         pop_iter, locus_iter = ctrl.calc_allele_genotype_freqs("PopGen" + os.sep + "big.gen")
00038         #print pop, loci
00039         #for popc in pop_iter:
00040         #    pop_name, loci_content = popc
00041         #    print pop_name
00042         #    for locus in loci_content.keys():
00043         #        geno_list, hets, freq_fis = loci_content[locus]
00044         #        print locus
00045         #        print hets
00046         #        print freq_fis
00047         #        print geno_list
00048         #    print

Test calculations of diversities ...

Definition at line 49 of file test_PopGen_GenePop.py.

00049 
00050     def test_calc_diversities_fis_with_identity(self):
00051         """Test calculations of diversities ...
00052         """
00053         ctrl = GenePopController()
00054         iter, avg_fis, avg_Qintra = ctrl.calc_diversities_fis_with_identity(
00055             "PopGen" + os.sep + "big.gen")
00056         liter = list(iter)
00057         assert len(liter) == 37
00058         assert liter[0][0] == "Locus1"
00059         assert len(avg_fis)==10
00060         assert len(avg_Qintra)==10

Test Nm estimation.

Definition at line 61 of file test_PopGen_GenePop.py.

00061 
00062     def test_estimate_nm(self):
00063         """Test Nm estimation.
00064         """
00065         ctrl = GenePopController()
00066         mean_sample_size, mean_priv_alleles, mig10, mig25, mig50, mig_corrected =\
00067             ctrl.estimate_nm("PopGen" + os.sep + "big.gen")
00068         assert (mean_sample_size, mean_priv_alleles, mig10, mig25, mig50, mig_corrected) == \
00069                (28.0, 0.016129, 52.5578, 15.3006, 8.94583, 13.6612)
00070 

Test genepop execution on all fst.

Definition at line 71 of file test_PopGen_GenePop.py.

00071 
00072     def test_fst_all(self):
00073         """Test genepop execution on all fst.
00074         """
00075         ctrl = GenePopController()
00076         (allFis, allFst, allFit), itr = ctrl.calc_fst_all("PopGen" + os.sep + "c2line.gen")
00077         results = list(itr)
00078         assert (len(results) == 3)
00079         assert (results[0][0] == "136255903")
00080         assert (results[1][3] - 0.33 < 0.01)

Test haploidy.

Definition at line 81 of file test_PopGen_GenePop.py.

00081 
00082     def test_haploidy(self):
00083         """Test haploidy.
00084         """
00085         ctrl = GenePopController()
00086         (allFis, allFst, allFit), itr = ctrl.calc_fst_all("PopGen" + os.sep + "haplo.gen")
00087         litr = list(itr)
00088         assert not type(allFst) == int
00089         assert len(litr) == 37
00090         assert litr[36][0] == "Locus37" 


The documentation for this class was generated from the following file: