Back to index

python-biopython  1.60
Public Member Functions | Public Attributes
test_Prank_tool.PrankApplication Class Reference

List of all members.

Public Member Functions

def setUp
def tearDown
def test_Prank_simple
def test_Prank_simple_with_NEXUS_output
def test_Prank_complex_command_line

Public Attributes

 infile1

Detailed Description

Definition at line 50 of file test_Prank_tool.py.


Member Function Documentation

Definition at line 52 of file test_Prank_tool.py.

00052 
00053     def setUp(self):
00054         self.infile1 = "Fasta/fa01"

output.1.dnd  output.1.fas  output.1.xml  output.2.dnd  output.2.fas  output.2.xml

Definition at line 55 of file test_Prank_tool.py.

00055 
00056     def tearDown(self):
00057         """
00058         output.1.dnd  output.1.fas  output.1.xml  output.2.dnd  output.2.fas  output.2.xml
00059         """
00060         if os.path.isfile("output.1.dnd"):
00061             os.remove("output.1.dnd")
00062         if os.path.isfile("output.1.fas"):
00063             os.remove("output.1.fas")
00064         if os.path.isfile("output.1.xml"):
00065             os.remove("output.1.xml")
00066         if os.path.isfile("output.2.dnd"):
00067             os.remove("output.2.dnd")
00068         if os.path.isfile("output.2.fas"):
00069             os.remove("output.2.fas")
00070         if os.path.isfile("output.2.xml"):
00071             os.remove("output.2.xml")
00072         if os.path.isfile("output.1.nex"):
00073             os.remove("output.1.nex")
00074         if os.path.isfile("output.2.nex"):
00075             os.remove("output.2.nex")

Round-trip with complex command line.

Definition at line 118 of file test_Prank_tool.py.

00118 
00119     def test_Prank_complex_command_line(self):
00120         """Round-trip with complex command line."""
00121         cmdline = PrankCommandline(prank_exe)
00122         cmdline.set_parameter("d", self.infile1)
00123         cmdline.set_parameter("-noxml", True)
00124         cmdline.set_parameter("notree", True)
00125         cmdline.set_parameter("-gaprate", 0.321)
00126         cmdline.set_parameter("gapext", 0.6)
00127         cmdline.set_parameter("-dots", 1) #i.e. True
00128         #Try using a property:
00129         cmdline.kappa = 3
00130         cmdline.skipins = True
00131         cmdline.set_parameter("-once", True)
00132         cmdline.realbranches = True
00133         self.assertEqual(str(cmdline), prank_exe + " -d=Fasta/fa01 -noxml" + \
00134                          " -notree -dots -gaprate=0.321 -gapext=0.6 -kappa=3" + \
00135                          " -once -skipins -realbranches")
00136         self.assertEqual(str(eval(repr(cmdline))), str(cmdline))
00137         stdout, stderr = cmdline()
00138         self.assertTrue("Total time" in stdout, stdout)
00139 

Simple round-trip through app with infile.
output.?.??? files written to cwd - no way to redirect

Definition at line 76 of file test_Prank_tool.py.

00076 
00077     def test_Prank_simple(self):
00078         """Simple round-trip through app with infile.
00079         output.?.??? files written to cwd - no way to redirect
00080         """
00081         cmdline = PrankCommandline(prank_exe)
00082         cmdline.set_parameter("d", self.infile1)
00083         self.assertEqual(str(cmdline), prank_exe + " -d=Fasta/fa01")
00084         self.assertEqual(str(eval(repr(cmdline))), str(cmdline))
00085         output, error = cmdline()
00086         self.assertEqual(error, "")
00087         self.assertTrue("Total time" in output)

Simple round-trip through app with infile, output in NEXUS
output.?.??? files written to cwd - no way to redirect

Definition at line 88 of file test_Prank_tool.py.

00088 
00089     def test_Prank_simple_with_NEXUS_output(self):
00090         """Simple round-trip through app with infile, output in NEXUS
00091         output.?.??? files written to cwd - no way to redirect
00092         """
00093         records = list(SeqIO.parse(self.infile1,"fasta"))
00094         #Try using keyword argument,
00095         cmdline = PrankCommandline(prank_exe, d=self.infile1, noxml=True)
00096         #Try using a property,
00097         cmdline.d = self.infile1
00098         cmdline.f = 17 # NEXUS format
00099         cmdline.set_parameter("notree", True)
00100         self.assertEqual(str(cmdline), prank_exe + \
00101                          " -d=Fasta/fa01 -f=17 -noxml -notree")
00102         self.assertEqual(str(eval(repr(cmdline))), str(cmdline))
00103         stdout, stderr = cmdline()
00104         self.assertTrue("Total time" in stdout)
00105         self.assertEqual(stderr, "")
00106         try:
00107             align = AlignIO.read("output.2.nex", "nexus")
00108             for old, new in zip(records, align):
00109                 #Old versions of Prank reduced name to 9 chars
00110                 self.assertTrue(old.id==new.id or old.id[:9]==new.id)
00111                 #infile1 has alignment gaps in it
00112                 self.assertEqual(str(new.seq).replace("-",""),
00113                                  str(old.seq).replace("-",""))
00114         except NexusError:
00115             #See bug 3119,
00116             #Bio.Nexus can't parse output from prank v100701 (1 July 2010)
00117             pass


Member Data Documentation

Definition at line 53 of file test_Prank_tool.py.


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