Back to index

python-biopython  1.60
Public Member Functions | Public Attributes | Static Public Attributes
test_PAML_yn00.ModTest Class Reference

List of all members.

Public Member Functions

def tearDown
def setUp
def testAlignmentFileIsValid
def testAlignmentExists
def testWorkingDirValid
def testOutputFileValid
def testOptionExists
def testAlignmentSpecified
def testOutputFileSpecified
def testCtlFileValidOnRun
def testCtlFileExistsOnRun
def testCtlFileValidOnRead
def testCtlFileExistsOnRead
def testResultsValid
def testResultsExist
def testResultsParsable
def testParseAllVersions

Public Attributes

 yn00

Static Public Attributes

tuple align_dir = os.path.join("PAML", "Alignments")
tuple tree_dir = os.path.join("PAML", "Trees")
tuple ctl_dir = os.path.join("PAML", "Control_files")
tuple results_dir = os.path.join("PAML", "Results")
tuple working_dir = os.path.join("PAML", "yn00_test")
tuple align_file = os.path.join(align_dir, "alignment.phylip")
tuple out_file = os.path.join(results_dir, "test.out")
tuple results_file = os.path.join(results_dir, "bad_results.out")
tuple bad_ctl_file1 = os.path.join(ctl_dir, "bad1.ctl")
tuple bad_ctl_file2 = os.path.join(ctl_dir, "bad2.ctl")
tuple ctl_file = os.path.join(ctl_dir, "yn00", "yn00.ctl")

Detailed Description

Definition at line 12 of file test_PAML_yn00.py.


Member Function Documentation

Definition at line 40 of file test_PAML_yn00.py.

00040 
00041     def setUp(self):
00042         self.yn00 = yn00.Yn00()
        
Just in case yn00 creates some junk files, do a clean-up.

Definition at line 27 of file test_PAML_yn00.py.

00027 
00028     def tearDown(self):
00029         """Just in case yn00 creates some junk files, do a clean-up."""
00030         del_files = [self.out_file, "2YN.dN", "2YN.dS", "2YN.t", "rst",
00031             "rst1", "rub"]
00032         for filename in del_files:
00033             if os.path.exists(filename):
00034                 os.remove(filename)
00035         if os.path.exists(self.working_dir):
00036             for filename in os.listdir(self.working_dir):
00037                 filepath = os.path.join(self.working_dir, filename)
00038                 os.remove(filepath)
00039             os.rmdir(self.working_dir)
    

Definition at line 51 of file test_PAML_yn00.py.

00051 
00052     def testAlignmentExists(self):
00053         self.assertRaises((EnvironmentError, IOError), yn00.Yn00, 
00054             alignment = "nonexistent")
00055         self.yn00.alignment = "nonexistent"
00056         self.yn00.out_file = self.out_file
00057         self.assertRaises(IOError, self.yn00.run)

Definition at line 43 of file test_PAML_yn00.py.

00043 
00044     def testAlignmentFileIsValid(self):
00045         self.assertRaises((AttributeError, TypeError),
00046             yn00.Yn00, alignment = 1)
00047         self.yn00.alignment = 1
00048         self.yn00.out_file = self.out_file
00049         self.assertRaises((AttributeError, TypeError),
00050             self.yn00.run)
        

Definition at line 77 of file test_PAML_yn00.py.

00077 
00078     def testAlignmentSpecified(self):
00079         self.yn00.out_file = self.out_file
00080         self.assertRaises((AttributeError, ValueError),
00081             self.yn00.run)
        

Definition at line 120 of file test_PAML_yn00.py.

00120 
00121     def testCtlFileExistsOnRead(self):
00122         self.assertRaises(IOError,
00123             self.yn00.read_ctl_file, ctl_file = "nonexistent")
        

Definition at line 99 of file test_PAML_yn00.py.

00099 
00100     def testCtlFileExistsOnRun(self):
00101         self.yn00.alignment = self.align_file
00102         self.yn00.out_file = self.out_file
00103         self.assertRaises(IOError,
00104             self.yn00.run, ctl_file = "nonexistent")
            

Definition at line 105 of file test_PAML_yn00.py.

00105 
00106     def testCtlFileValidOnRead(self):
00107         self.assertRaises((AttributeError, TypeError),
00108             self.yn00.read_ctl_file, 1)
00109         self.assertRaises((AttributeError, KeyError), 
00110             self.yn00.read_ctl_file, self.bad_ctl_file1)
00111         self.assertRaises(AttributeError, 
00112             self.yn00.read_ctl_file, self.bad_ctl_file2)
00113         target_options = {"verbose": 1,
00114                         "icode": 0,
00115                         "weighting": 0,
00116                         "commonf3x4": 0,
00117                         "ndata": 1}
00118         self.yn00.read_ctl_file(self.ctl_file)
00119         self.assertEqual(self.yn00._options, target_options)
        

Definition at line 93 of file test_PAML_yn00.py.

00093 
00094     def testCtlFileValidOnRun(self):
00095         self.yn00.alignment = self.align_file
00096         self.yn00.out_file = self.out_file
00097         self.assertRaises((AttributeError, TypeError),
00098             self.yn00.run, ctl_file = 1)
        

Definition at line 71 of file test_PAML_yn00.py.

00071 
00072     def testOptionExists(self):
00073         self.assertRaises((AttributeError, KeyError),
00074                           self.yn00.set_options, xxxx=1)
00075         self.assertRaises((AttributeError, KeyError),
00076             self.yn00.get_option, "xxxx")
    

Definition at line 82 of file test_PAML_yn00.py.

00082 
00083     def testOutputFileSpecified(self):
00084         self.yn00.alignment = self.align_file
00085         self.assertRaises((AttributeError, ValueError),
00086             self.yn00.run)
        

Definition at line 65 of file test_PAML_yn00.py.

00065 
00066     def testOutputFileValid(self):
00067         self.yn00.alignment = self.align_file
00068         self.yn00.out_file = 1
00069         self.assertRaises((AttributeError, TypeError),
00070             self.yn00.run)
    

Definition at line 135 of file test_PAML_yn00.py.

00135 
00136     def testParseAllVersions(self):
00137         folder = os.path.join(self.results_dir, "yn00")
00138         for results_file in os.listdir(folder):
00139             file_path = os.path.join(folder, results_file)
00140             results = yn00.read(file_path)
00141             self.assertEqual(len(results), 5)
00142             self.assertEqual(len(results["Homo_sapie"]), 4)
00143             self.assertEqual(len(results["Homo_sapie"]["Pan_troglo"]),
00144                 5)
        

Definition at line 128 of file test_PAML_yn00.py.

00128 
00129     def testResultsExist(self):
00130         self.assertRaises((EnvironmentError, IOError),
00131             yn00.read, "nonexistent")
        

Definition at line 132 of file test_PAML_yn00.py.

00132 
00133     def testResultsParsable(self):
00134         self.assertRaises(ValueError, yn00.read, self.results_file)
        

Definition at line 124 of file test_PAML_yn00.py.

00124 
00125     def testResultsValid(self):
00126         self.assertRaises((AttributeError, TypeError),
00127             yn00.read, 1)
    

Definition at line 58 of file test_PAML_yn00.py.

00058 
00059     def testWorkingDirValid(self):
00060         self.yn00.alignment = self.align_file
00061         self.yn00.out_file = self.out_file
00062         self.yn00.working_dir = 1
00063         self.assertRaises((AttributeError, TypeError),
00064             self.yn00.run)
    

Member Data Documentation

tuple test_PAML_yn00.ModTest.align_dir = os.path.join("PAML", "Alignments") [static]

Definition at line 14 of file test_PAML_yn00.py.

tuple test_PAML_yn00.ModTest.align_file = os.path.join(align_dir, "alignment.phylip") [static]

Definition at line 20 of file test_PAML_yn00.py.

tuple test_PAML_yn00.ModTest.bad_ctl_file1 = os.path.join(ctl_dir, "bad1.ctl") [static]

Definition at line 23 of file test_PAML_yn00.py.

tuple test_PAML_yn00.ModTest.bad_ctl_file2 = os.path.join(ctl_dir, "bad2.ctl") [static]

Definition at line 24 of file test_PAML_yn00.py.

tuple test_PAML_yn00.ModTest.ctl_dir = os.path.join("PAML", "Control_files") [static]

Definition at line 16 of file test_PAML_yn00.py.

tuple test_PAML_yn00.ModTest.ctl_file = os.path.join(ctl_dir, "yn00", "yn00.ctl") [static]

Definition at line 25 of file test_PAML_yn00.py.

tuple test_PAML_yn00.ModTest.out_file = os.path.join(results_dir, "test.out") [static]

Definition at line 21 of file test_PAML_yn00.py.

tuple test_PAML_yn00.ModTest.results_dir = os.path.join("PAML", "Results") [static]

Definition at line 17 of file test_PAML_yn00.py.

tuple test_PAML_yn00.ModTest.results_file = os.path.join(results_dir, "bad_results.out") [static]

Definition at line 22 of file test_PAML_yn00.py.

tuple test_PAML_yn00.ModTest.tree_dir = os.path.join("PAML", "Trees") [static]

Definition at line 15 of file test_PAML_yn00.py.

tuple test_PAML_yn00.ModTest.working_dir = os.path.join("PAML", "yn00_test") [static]

Definition at line 18 of file test_PAML_yn00.py.

Definition at line 41 of file test_PAML_yn00.py.


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