Back to index

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

List of all members.

Public Member Functions

def setUp
def tearDown
def test_ddatacal
def test_dfdist
def atest_dfdist_force_fst
def test_cplot2
def test_pv2

Public Attributes

 ctrl
 dirname

Private Member Functions

def _copyfile

Detailed Description

Tests the Dfdist suite of applications.

Definition at line 34 of file test_PopGen_DFDist.py.


Member Function Documentation

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

Definition at line 37 of file test_PopGen_DFDist.py.

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

Test dfdist execution approximating Fst.
   THIS IS TOO SLOW

Definition at line 81 of file test_PopGen_DFDist.py.

00081 
00082     def atest_dfdist_force_fst(self):
00083         """Test dfdist execution approximating Fst.
00084            THIS IS TOO SLOW
00085         """
00086         #The number of simulations in real life should be at least 10000,
00087         #see the fdist2 documentation.
00088         fst = self.ctrl.run_fdist_force_fst(npops = 15, nsamples = 10,
00089                 fst = 0.1,
00090                 sample_size = 20, mut = 0, num_sims = 100,
00091                 data_dir = self.dirname, is_dominant=True)
00092         self.assertTrue(abs(fst - 0.09) < 0.05,
00093                         "Stochastic result, expected %f close to 0.09" % fst)

Definition at line 42 of file test_PopGen_DFDist.py.

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

Definition at line 50 of file test_PopGen_DFDist.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 cplot2 execution.

Definition at line 94 of file test_PopGen_DFDist.py.

00094 
00095     def test_cplot2(self):
00096         """Test cplot2 execution.
00097         """
00098         cpl_interval =self.ctrl.run_cplot(data_dir = self.dirname, version=2)
00099         self.assertEqual(len(cpl_interval), 300)

Test Ddatacal execution.

Definition at line 58 of file test_PopGen_DFDist.py.

00058 
00059     def test_ddatacal(self):
00060         """Test Ddatacal execution.
00061         """
00062         fst, samp_size, loci, pops, F, obs = \
00063             self.ctrl.run_datacal(data_dir = self.dirname, version=2)
00064         self.assertTrue(fst - 0.23 < 0.02)
00065         self.assertEqual(samp_size, 32)
00066         self.assertEqual(loci, 300)
00067         self.assertEqual(pops, 2)
00068         self.assertTrue(F - 0.11 < 0.01)
00069         self.assertEqual(obs, 300)

Test Dfdist execution.

Definition at line 70 of file test_PopGen_DFDist.py.

00070 
00071     def test_dfdist(self):
00072         """Test Dfdist execution.
00073         """
00074         #The number of simulations in real life should be at least 10000,
00075         #see the fdist2 documentation.
00076         fst = self.ctrl.run_fdist(npops = 15, nsamples = 10, fst = 0.1,
00077                 sample_size = 20, mut = 0, num_sims = 100,
00078                 data_dir = self.dirname, is_dominant = True)
00079         self.assertTrue(abs(fst - 0.1) < 0.025,
00080                         "Stochastic result, expected %f close to 0.1" % fst)

Test pv2 execution.

Definition at line 100 of file test_PopGen_DFDist.py.

00100 
00101     def test_pv2(self):
00102         """Test pv2 execution.
00103         """
00104         pv_data = self.ctrl.run_pv(data_dir = self.dirname, version=2)
00105         self.assertEqual(len(pv_data), 300)
00106 


Member Data Documentation

Definition at line 43 of file test_PopGen_DFDist.py.

Definition at line 44 of file test_PopGen_DFDist.py.


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