Back to index

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

List of all members.

Public Member Functions

def setUp
def conversion
def test_convert_to_fasta
def test_convert_to_phylip

Public Attributes

 input
 output

Detailed Description

Definition at line 140 of file test_Prank_tool.py.


Member Function Documentation

def test_Prank_tool.PrankConversion.conversion (   self,
  prank_number,
  prank_ext,
  format 
)
Get PRANK to do a conversion, and check it with SeqIO.

Definition at line 146 of file test_Prank_tool.py.

00146 
00147     def conversion(self, prank_number, prank_ext, format):
00148         """Get PRANK to do a conversion, and check it with SeqIO."""
00149         filename = "%s.%s" % (self.output, prank_ext)
00150         if os.path.isfile(filename):
00151             os.remove(filename)
00152         cmdline = PrankCommandline(prank_exe, d=self.input,
00153                                    convert=True, f=prank_number,
00154                                    o='"%s"' % self.output)
00155         self.assertEqual(str(cmdline), prank_exe \
00156                          + ' -d=%s' % self.input \
00157                          + ' -o="%s"' % self.output \
00158                          + ' -f=%i' % prank_number \
00159                          + ' -convert')
00160         self.assertEqual(str(eval(repr(cmdline))), str(cmdline))
00161         message, error = cmdline()
00162         self.assertTrue(("PRANK: converting '%s' to '%s'" % (self.input, filename)) \
00163                         in message, message)
00164         self.assertEqual(error, "")
00165         self.assertTrue(os.path.isfile(filename))
00166         old = AlignIO.read(self.input, "fasta")
00167         #Hack...
00168         if format=="phylip":
00169             for record in old:
00170                 record.id = record.id[:10]
00171         new = AlignIO.read(filename, format)
00172         assert len(old) == len(new)
00173         for old_r, new_r in zip(old, new):
00174             self.assertEqual(old_r.id, new_r.id)
00175             self.assertEqual(str(old_r.seq), str(new_r.seq))
00176         os.remove(filename)
        

Here is the caller graph for this function:

Definition at line 141 of file test_Prank_tool.py.

00141 
00142     def setUp(self):
00143         #As these reads are all 36, it can be seen as pre-aligned:
00144         self.input = "Quality/example.fasta"
00145         self.output = 'temp with space' #prefix, PRANK will pick extensions

Convert FASTA to FASTA format.

Definition at line 177 of file test_Prank_tool.py.

00177 
00178     def test_convert_to_fasta(self):
00179         """Convert FASTA to FASTA format."""
00180         self.conversion(8, "fas", "fasta")

Here is the call graph for this function:

Convert FASTA to PHYLIP format.

Definition at line 186 of file test_Prank_tool.py.

00186 
00187     def test_convert_to_phylip(self):
00188         """Convert FASTA to PHYLIP format."""
00189         self.conversion(12, "phy", "phylip")

Here is the call graph for this function:


Member Data Documentation

Definition at line 143 of file test_Prank_tool.py.

Definition at line 144 of file test_Prank_tool.py.


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