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("-", ""))
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("-", ""))
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("-",""))