Back to index

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

List of all members.

Public Member Functions

def setUp
def tearDown
def test_datacal
def test_fdist
def test_fdist_force_fst
def test_cplot
def test_pv

Public Attributes

 ctrl
 dirname

Private Member Functions

def _copyfile

Detailed Description

Tests the fdist suite of applications.

Definition at line 34 of file test_PopGen_FDist.py.


Member Function Documentation

def test_PopGen_FDist.AppTest._copyfile (   self,
  inname,
  outname 
) [private]

Definition at line 37 of file test_PopGen_FDist.py.

00037 
00038     def _copyfile(self, inname, outname):
00039         shutil.copyfile(
00040             'PopGen' + os.sep + inname,
00041             self.dirname + os.sep + outname)

Definition at line 42 of file test_PopGen_FDist.py.

00042 
00043     def setUp(self):
00044         self.ctrl = Controller.FDistController()
00045         self.dirname = tempfile.mkdtemp()
00046         self._copyfile('data_fst_outfile', 'data_fst_outfile')
00047         self._copyfile('fdist1', 'infile')
00048         self._copyfile('out.dat', 'out.dat')
00049         self._copyfile('out.cpl', 'out.cpl')

Definition at line 50 of file test_PopGen_FDist.py.

00050 
00051     def tearDown(self):
00052         #Not sure how exactly, but its possible the temp directory
00053         #may not (still) exist.
00054         if os.path.isdir(self.dirname):
00055             for file in os.listdir(self.dirname):
00056                 os.remove(self.dirname + os.sep + file)
00057             os.rmdir(self.dirname)

Test cplot execution.

Definition at line 88 of file test_PopGen_FDist.py.

00088 
00089     def test_cplot(self):
00090         """Test cplot execution.
00091         """
00092         cpl_interval =self.ctrl.run_cplot(data_dir = self.dirname)
00093         self.assertEqual(len(cpl_interval), 8)

Test datacal execution.

Definition at line 58 of file test_PopGen_FDist.py.

00058 
00059     def test_datacal(self):
00060         """Test datacal execution.
00061         """
00062         fst, samp_size = self.ctrl.run_datacal(data_dir = self.dirname)
00063         self.assertTrue(fst - 0.44 < 0.01)
00064         self.assertEqual(samp_size, 11)

Test fdist execution.

Definition at line 65 of file test_PopGen_FDist.py.

00065 
00066     def test_fdist(self):
00067         """Test fdist execution.
00068         """
00069         #The number of simulations in real life should be at least 10000,
00070         #see the fdist2 documentation.
00071         fst = self.ctrl.run_fdist(npops = 15, nsamples = 10, fst = 0.1,
00072                 sample_size = 20, mut = 0, num_sims = 100,
00073                 data_dir = self.dirname)
00074         self.assertTrue(abs(fst - 0.1) < 0.025,
00075                         "Stochastic result, expected %f close to 0.1" % fst)

Test fdist execution approximating Fst.

Definition at line 76 of file test_PopGen_FDist.py.

00076 
00077     def test_fdist_force_fst(self):
00078         """Test fdist execution approximating Fst.
00079         """
00080         #The number of simulations in real life should be at least 10000,
00081         #see the fdist2 documentation.
00082         fst = self.ctrl.run_fdist_force_fst(npops = 15, nsamples = 10,
00083                 fst = 0.1,
00084                 sample_size = 20, mut = 0, num_sims = 100,
00085                 data_dir = self.dirname)
00086         self.assertTrue(abs(fst - 0.09) < 0.05,
00087                         "Stochastic result, expected %f close to 0.09" % fst)

Test pv execution.

Definition at line 94 of file test_PopGen_FDist.py.

00094 
00095     def test_pv(self):
00096         """Test pv execution.
00097         """
00098         pv_data = self.ctrl.run_pv(data_dir = self.dirname)
00099         self.assertEqual(len(pv_data), 4)
00100 


Member Data Documentation

Definition at line 43 of file test_PopGen_FDist.py.

Definition at line 44 of file test_PopGen_FDist.py.


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