Пример #1
0
 def test_TCoffee_3(self):
     """Round-trip through app and read clustalw alignment from file
     """
     cmdline = TCoffeeCommandline(t_coffee_exe, gapopen=-2)
     cmdline.infile = self.infile1
     cmdline.outfile = self.outfile4
     cmdline.set_parameter("output", "clustalw_aln")
     cmdline.outorder = "input"
     cmdline.set_parameter("gapext", -5)
     cmdline.type = "protein"
     self.assertEqual(str(cmdline), t_coffee_exe + " -output clustalw_aln "
                      "-infile Fasta/fa01 -outfile Fasta/tc_out.phy "
                      "-type protein -outorder input -gapopen -2 -gapext -5")
     child = subprocess.Popen(str(cmdline),
                              stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE,
                              shell=(sys.platform!="win32"))
     return_code = child.wait()
     self.assertEqual(return_code, 0)
     self.assert_(child.stderr.read().strip().startswith("PROGRAM: T-COFFEE"))
     align = AlignIO.read(open(self.outfile4), "clustal")
     records = list(SeqIO.parse(open(self.infile1),"fasta"))
     self.assertEqual(len(records),len(align))
     for old, new in zip(records, align):
         self.assertEqual(old.id, new.id)
         self.assertEqual(str(new.seq).replace("-",""), str(old.seq).replace("-",""))
     del child
 def test_TCoffee_clustalw(self):
     """Round-trip through app and read clustalw alignment from file."""
     cmdline = TCoffeeCommandline(t_coffee_exe, gapopen=-2)
     cmdline.infile = self.infile1
     cmdline.outfile = self.outfile4
     cmdline.set_parameter("output", "clustalw_aln")
     cmdline.outorder = "input"
     cmdline.set_parameter("gapext", -5)
     cmdline.type = "protein"
     self.assertEqual(
         str(cmdline),
         t_coffee_exe +
         " -output clustalw_aln -infile Fasta/fa01 -outfile Fasta/tc_out.aln "
         "-type protein -outorder input -gapopen -2 -gapext -5",
     )
     stdout, stderr = cmdline()
     self.assertTrue(stderr.strip().startswith("PROGRAM: T-COFFEE"))
     align = AlignIO.read(self.outfile4, "clustal")
     records = list(SeqIO.parse(self.infile1, "fasta"))
     self.assertEqual(len(records), len(align))
     for old, new in zip(records, align):
         self.assertEqual(old.id, new.id)
         self.assertEqual(
             str(new.seq).replace("-", ""),
             str(old.seq).replace("-", ""))
Пример #3
0
 def test_TCoffee_2(self):
     """Round-trip through app and read pir alignment from file."""
     cmdline = TCoffeeCommandline(t_coffee_exe, quiet=True)
     cmdline.infile = self.infile1
     cmdline.outfile = self.outfile3
     cmdline.output = "pir_aln"
     self.assertEqual(str(cmdline), t_coffee_exe + " -output pir_aln "
                      "-infile Fasta/fa01 -outfile Fasta/tc_out.pir -quiet")
     stdout, stderr = cmdline()
     # Can get warnings in stderr output
     self.assertNotIn("error", stderr.lower(), stderr)
     align = AlignIO.read(self.outfile3, "pir")
     records = list(SeqIO.parse(self.infile1, "fasta"))
     self.assertEqual(len(records), len(align))
     for old, new in zip(records, align):
         self.assertEqual(old.id, new.id)
         self.assertEqual(str(new.seq).replace("-", ""), str(old.seq).replace("-", ""))
Пример #4
0
 def test_TCoffee_pir(self):
     """Round-trip through app and read pir alignment from file."""
     cmdline = TCoffeeCommandline(t_coffee_exe, quiet=True)
     cmdline.infile = self.infile1
     cmdline.outfile = self.outfile3
     cmdline.output = "pir_aln"
     self.assertEqual(str(cmdline), t_coffee_exe + " -output pir_aln "
                      "-infile Fasta/fa01 -outfile Fasta/tc_out.pir -quiet")
     stdout, stderr = cmdline()
     # Can get warnings in stderr output
     self.assertNotIn("error", stderr.lower(), stderr)
     align = AlignIO.read(self.outfile3, "pir")
     records = list(SeqIO.parse(self.infile1, "fasta"))
     self.assertEqual(len(records), len(align))
     for old, new in zip(records, align):
         self.assertEqual(old.id, new.id)
         self.assertEqual(str(new.seq).replace("-", ""), str(old.seq).replace("-", ""))
Пример #5
0
 def test_TCoffee_2(self):
     """Round-trip through app and read pir alignment from file
     """
     cmdline = TCoffeeCommandline(t_coffee_exe, quiet=True)
     cmdline.infile = self.infile1
     cmdline.outfile = self.outfile3
     cmdline.output = "pir_aln"
     self.assertEqual(str(cmdline), t_coffee_exe + " -output pir_aln "
                 "-infile Fasta/fa01 -outfile Fasta/tc_out.pir -quiet")
     result, stdout, stderr = Application.generic_run(cmdline)
     self.assertEquals(result.return_code, 0)
     self.assertEquals(stderr.read(), "")
     align = AlignIO.read(open(self.outfile3), "pir")
     records = list(SeqIO.parse(open(self.infile1),"fasta"))
     self.assertEqual(len(records),len(align))
     for old, new in zip(records, align):
         self.assertEqual(old.id, new.id)
         self.assertEqual(str(new.seq).replace("-",""), str(old.seq).replace("-",""))
Пример #6
0
 def test_TCoffee_2(self):
     """Round-trip through app and read pir alignment from file
     """
     cmdline = TCoffeeCommandline(t_coffee_exe, quiet=True)
     cmdline.infile = self.infile1
     cmdline.outfile = self.outfile3
     cmdline.output = "pir_aln"
     self.assertEqual(str(cmdline), t_coffee_exe + " -output pir_aln "
                 "-infile Fasta/fa01 -outfile Fasta/tc_out.pir -quiet")
     result, stdout, stderr = Application.generic_run(cmdline)
     self.assertEquals(result.return_code, 0)
     self.assertEquals(stderr.read(), "")
     align = AlignIO.read(open(self.outfile3), "pir")
     records = list(SeqIO.parse(open(self.infile1),"fasta"))
     self.assertEqual(len(records),len(align))
     for old, new in zip(records, align) :
         self.assertEqual(old.id, new.id)
         self.assertEqual(str(new.seq).replace("-",""), str(old.seq).replace("-",""))
Пример #7
0
 def test_TCoffee_3(self):
     """Round-trip through app and read clustalw alignment from file."""
     cmdline = TCoffeeCommandline(t_coffee_exe, gapopen=-2)
     cmdline.infile = self.infile1
     cmdline.outfile = self.outfile4
     cmdline.set_parameter("output", "clustalw_aln")
     cmdline.outorder = "input"
     cmdline.set_parameter("gapext", -5)
     cmdline.type = "protein"
     self.assertEqual(str(cmdline), t_coffee_exe + " -output clustalw_aln "
                      "-infile Fasta/fa01 -outfile Fasta/tc_out.phy "
                      "-type protein -outorder input -gapopen -2 -gapext -5")
     stdout, stderr = cmdline()
     self.assertTrue(stderr.strip().startswith("PROGRAM: T-COFFEE"))
     align = AlignIO.read(self.outfile4, "clustal")
     records = list(SeqIO.parse(self.infile1, "fasta"))
     self.assertEqual(len(records), len(align))
     for old, new in zip(records, align):
         self.assertEqual(old.id, new.id)
         self.assertEqual(str(new.seq).replace("-", ""), str(old.seq).replace("-", ""))
Пример #8
0
 def test_TCoffee_3(self):
     """Round-trip through app and read clustalw alignment from file
     """
     cmdline = TCoffeeCommandline(t_coffee_exe, gapopen=-2)
     cmdline.infile = self.infile1
     cmdline.outfile = self.outfile4
     cmdline.set_parameter("output", "clustalw_aln")
     cmdline.outorder = "input"
     cmdline.set_parameter("gapext", -5)
     cmdline.type = "protein"
     self.assertEqual(str(cmdline), t_coffee_exe + " -output clustalw_aln "
                      "-infile Fasta/fa01 -outfile Fasta/tc_out.phy "
                      "-outorder input -gapopen -2 -gapext -5")
     result, stdout, stderr = Application.generic_run(cmdline)
     self.assertEquals(result.return_code, 0)
     self.assert_(stderr.read().strip().startswith("PROGRAM: T-COFFEE"))
     align = AlignIO.read(open(self.outfile4), "clustal")
     records = list(SeqIO.parse(open(self.infile1),"fasta"))
     self.assertEqual(len(records),len(align))
     for old, new in zip(records, align) :
         self.assertEqual(old.id, new.id)
         self.assertEqual(str(new.seq).replace("-",""), str(old.seq).replace("-",""))
Пример #9
0
 def test_TCoffee_2(self):
     """Round-trip through app and read pir alignment from file
     """
     cmdline = TCoffeeCommandline(t_coffee_exe, quiet=True)
     cmdline.infile = self.infile1
     cmdline.outfile = self.outfile3
     cmdline.output = "pir_aln"
     self.assertEqual(str(cmdline), t_coffee_exe + " -output pir_aln "
                 "-infile Fasta/fa01 -outfile Fasta/tc_out.pir -quiet")
     child = subprocess.Popen(str(cmdline),
                              stdout=subprocess.PIPE,
                              stderr=subprocess.PIPE,
                              shell=(sys.platform!="win32"))
     return_code = child.wait()
     self.assertEqual(return_code, 0)
     self.assertEquals(child.stderr.read(), "")
     align = AlignIO.read(open(self.outfile3), "pir")
     records = list(SeqIO.parse(open(self.infile1),"fasta"))
     self.assertEqual(len(records),len(align))
     for old, new in zip(records, align):
         self.assertEqual(old.id, new.id)
         self.assertEqual(str(new.seq).replace("-",""), str(old.seq).replace("-",""))
     del child