Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
test_PopGen_GenePop_EasyController.AppTest Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def test_basic_info
def test_get_heterozygosity_info
def test_get_alleles
def test_get_alleles_all_pops
def test_get_fis
def test_get_allele_frequency
def test_get_genotype_count
def test_estimate_nm
def test_get_avg_fis
def test_get_multilocus_f_stats
def test_get_f_stats

Public Attributes

 ctrl

Detailed Description

Tests genepop execution via biopython using EasyController.

Definition at line 30 of file test_PopGen_GenePop_EasyController.py.


Member Function Documentation

Definition at line 34 of file test_PopGen_GenePop_EasyController.py.

00034 
00035     def setUp(self):
00036         #Genepop likes to be on the directory where the file is.
00037         os.chdir("PopGen")
00038         self.ctrl = EasyController("big.gen")

Definition at line 39 of file test_PopGen_GenePop_EasyController.py.

00039 
00040     def tearDown(self):
00041         os.chdir(cur_dir)

Test basic info.

Definition at line 42 of file test_PopGen_GenePop_EasyController.py.

00042 
00043     def test_basic_info(self):
00044         """Test basic info.
00045         """
00046         pops, loci = self.ctrl.get_basic_info()
00047         self.assertEqual(len(pops), 10)
00048         self.assertEqual(len(loci), 37)

Test Nm estimation.

Definition at line 86 of file test_PopGen_GenePop_EasyController.py.

00086 
00087     def test_estimate_nm(self):
00088         """Test Nm estimation.
00089         """
00090         nms = self.ctrl.estimate_nm()
00091         self.assertEqual(nms[0], 28.0)
00092 
00093 #These tests are frequently failing, possibly due to a Genepop problem.
00094 #    def test_get_avg_fst_pair_locus(self):
00095 #        """Test get average Fst for pairwise pops on a locus.
00096 #        """
00097 #        self.assertEqual(len(self.ctrl.get_avg_fst_pair_locus("Locus4")), 45)
00098 #
00099 #    def test_get_avg_fst_pair(self):
00100 #        """Test get pairwise Fst.
00101 #        """
00102 #        pop_fis =  self.ctrl.get_avg_fst_pair()
00103 #        self.assertEqual(len(pop_fis), 45)

Test allele frequency.

Definition at line 74 of file test_PopGen_GenePop_EasyController.py.

00074 
00075     def test_get_allele_frequency(self):
00076         """Test allele frequency.
00077         """
00078         tot_genes, alleles = self.ctrl.get_allele_frequency(0,"Locus2")
00079         self.assertEqual(tot_genes, 62)
00080         self.assertTrue(abs(alleles[20] - 0.113) < 0.05)

Test get alleles.

Definition at line 56 of file test_PopGen_GenePop_EasyController.py.

00056 
00057     def test_get_alleles(self):
00058         """Test get alleles.
00059         """
00060         #Returns keys of a dict, so order is Python implementation dependent
00061         self.assertEqual(set(self.ctrl.get_alleles(0,"Locus3")), set([3, 20]))

Test get alleles for all populations.

Definition at line 62 of file test_PopGen_GenePop_EasyController.py.

00062 
00063     def test_get_alleles_all_pops(self):
00064         """Test get alleles for all populations.
00065         """
00066         self.assertEqual(self.ctrl.get_alleles_all_pops("Locus4"), [1, 3])

Test average Fis.

Definition at line 104 of file test_PopGen_GenePop_EasyController.py.

00104 
00105     def test_get_avg_fis(self):
00106         """Test average Fis.
00107         """
00108         self.ctrl.get_avg_fis()

Test F stats.

Definition at line 116 of file test_PopGen_GenePop_EasyController.py.

00116 
00117     def test_get_f_stats(self):
00118         """Test F stats.
00119         """
00120         fs = self.ctrl.get_f_stats("Locus2")
00121         self.assertEqual(len(fs), 5)
00122         self.assertTrue(fs[0]<0)

Test get Fis.

Definition at line 67 of file test_PopGen_GenePop_EasyController.py.

00067 
00068     def test_get_fis(self):
00069         """Test get Fis.
00070         """
00071         alleles, overall = self.ctrl.get_fis(0,"Locus2")
00072         self.assertEqual(alleles[3][0], 55)
00073         self.assertEqual(overall[0], 62)

Test genotype count.

Definition at line 81 of file test_PopGen_GenePop_EasyController.py.

00081 
00082     def test_get_genotype_count(self):
00083         """Test genotype count.
00084         """
00085         self.assertEqual(len(self.ctrl.get_genotype_count(0,"Locus2")), 3)

Test heterozygosity info.

Definition at line 49 of file test_PopGen_GenePop_EasyController.py.

00049 
00050     def test_get_heterozygosity_info(self):
00051         """Test heterozygosity info.
00052         """
00053         hz_info = self.ctrl.get_heterozygosity_info(0, "Locus2")
00054         self.assertEqual(hz_info[1], 24)
00055         self.assertEqual(hz_info[3], 7)

Test multilocus F stats.

Definition at line 109 of file test_PopGen_GenePop_EasyController.py.

00109 
00110     def test_get_multilocus_f_stats(self):
00111         """Test multilocus F stats.
00112         """
00113         mf = self.ctrl.get_multilocus_f_stats()
00114         self.assertEqual(len(mf), 3)
00115         self.assertTrue(mf[0]<0.1)


Member Data Documentation

Definition at line 37 of file test_PopGen_GenePop_EasyController.py.


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