def test_water_file2(self): """Run water with the asis trick and nucleotide FASTA file, output to a file.""" # Setup, query = "ACACACTCACACACACTTGGTCAGAGATGCTGTGCTTCTTGGAAGCAAGGNCTCAAAGGCAAGGTGCACGCAGAGGGACGTTTGAGTCTGGGATGAAGCATGTNCGTATTATTTATATGATGGAATTTCACGTTTTTATG" out_file = "Emboss/temp_test2.water" in_file = "Fasta/f002" self.assertTrue(os.path.isfile(in_file)) if os.path.isfile(out_file): os.remove(out_file) cline = WaterCommandline(cmd=exes["water"]) cline.set_parameter("-asequence", "asis:%s" % query) cline.set_parameter("-bsequence", in_file) cline.set_parameter("-gapopen", "10") cline.set_parameter("-gapextend", "0.5") cline.set_parameter("-outfile", out_file) self.assertEqual(str(eval(repr(cline))), str(cline)) # Run the tool, self.run_water(cline) # Check we can parse the output and it is sensible... self.pairwise_alignment_check( query, SeqIO.parse(in_file, "fasta"), AlignIO.parse(out_file, "emboss"), local=True, ) # Clean up, os.remove(out_file)
def test_water_file3(self): """Run water with the asis trick and GenBank file, output to a file.""" # Setup, query = "TGTTGTAATGTTTTAATGTTTCTTCTCCCTTTAGATGTACTACGTTTGGA" out_file = "Emboss/temp_test3.water" in_file = "GenBank/cor6_6.gb" self.assertTrue(os.path.isfile(in_file)) if os.path.isfile(out_file): os.remove(out_file) cline = WaterCommandline(cmd=exes["water"]) cline.set_parameter("asequence", "asis:%s" % query) cline.set_parameter("bsequence", in_file) # TODO - Tell water this is a GenBank file! cline.set_parameter("gapopen", "1") cline.set_parameter("gapextend", "0.5") cline.set_parameter("outfile", out_file) self.assertEqual(str(eval(repr(cline))), str(cline)) # Run the tool, self.run_water(cline) # Check we can parse the output and it is sensible... self.pairwise_alignment_check( query, SeqIO.parse(in_file, "genbank"), AlignIO.parse(out_file, "emboss"), local=True, ) # Clean up, os.remove(out_file)
def test_water_file3(self): """water with the asis trick and GenBank file, output to a file.""" # Setup, query = "TGTTGTAATGTTTTAATGTTTCTTCTCCCTTTAGATGTACTACGTTTGGA" out_file = "Emboss/temp_test3.water" in_file = "GenBank/cor6_6.gb" self.assertTrue(os.path.isfile(in_file)) if os.path.isfile(out_file): os.remove(out_file) cline = WaterCommandline(cmd=exes["water"]) cline.set_parameter("asequence", "asis:%s" % query) cline.set_parameter("bsequence", in_file) # TODO - Tell water this is a GenBank file! cline.set_parameter("gapopen", "1") cline.set_parameter("gapextend", "0.5") cline.set_parameter("outfile", out_file) self.assertEqual(str(eval(repr(cline))), str(cline)) # Run the tool, self.run_water(cline) # Check we can parse the output and it is sensible... self.pairwise_alignment_check(query, SeqIO.parse(in_file, "genbank"), AlignIO.parse(out_file, "emboss"), local=True) # Clean up, os.remove(out_file)
def test_water_file2(self): """water with the asis trick and nucleotide FASTA file, output to a file.""" #Setup, query = "ACACACTCACACACACTTGGTCAGAGATGCTGTGCTTCTTGGAAGCAAGGNCTCAAAGGCAAGGTGCACGCAGAGGGACGTTTGAGTCTGGGATGAAGCATGTNCGTATTATTTATATGATGGAATTTCACGTTTTTATG" out_file = "Emboss/temp_test2.water" in_file = "Fasta/f002" self.assert_(os.path.isfile(in_file)) if os.path.isfile(out_file): os.remove(out_file) cline = WaterCommandline(cmd=exes["water"]) cline.set_parameter("-asequence", "asis:%s" % query) cline.set_parameter("-bsequence", in_file) cline.set_parameter("-gapopen", "10") cline.set_parameter("-gapextend", "0.5") cline.set_parameter("-outfile", out_file) self.assertEqual(str(eval(repr(cline))), str(cline)) #Run the tool, result, out, err = generic_run(cline) #Check it worked, errors = err.read().strip() self.assert_(errors.startswith("Smith-Waterman local alignment"), errors) self.assertEqual(out.read().strip(), "") if result.return_code != 0: print >> sys.stderr, "\n%s" % cline self.assertEqual(result.return_code, 0) self.assertEqual(result.get_result("outfile"), out_file) assert os.path.isfile(out_file) #Check we can parse the output and it is sensible... self.pairwise_alignment_check(query, SeqIO.parse(open(in_file), "fasta"), AlignIO.parse(open(out_file), "emboss"), local=True) #Clean up, os.remove(out_file)
def test_water_file2(self): """water with the asis trick and nucleotide FASTA file, output to a file.""" # Setup, query = "ACACACTCACACACACTTGGTCAGAGATGCTGTGCTTCTTGGAAGCAAGGNCTCAAAGGCAAGGTGCACGCAGAGGGACGTTTGAGTCTGGGATGAAGCATGTNCGTATTATTTATATGATGGAATTTCACGTTTTTATG" out_file = "Emboss/temp_test2.water" in_file = "Fasta/f002" self.assertTrue(os.path.isfile(in_file)) if os.path.isfile(out_file): os.remove(out_file) cline = WaterCommandline(cmd=exes["water"]) cline.set_parameter("-asequence", "asis:%s" % query) cline.set_parameter("-bsequence", in_file) cline.set_parameter("-gapopen", "10") cline.set_parameter("-gapextend", "0.5") cline.set_parameter("-outfile", out_file) self.assertEqual(str(eval(repr(cline))), str(cline)) # Run the tool, self.run_water(cline) # Check we can parse the output and it is sensible... self.pairwise_alignment_check(query, SeqIO.parse(in_file, "fasta"), AlignIO.parse(out_file, "emboss"), local=True) # Clean up, os.remove(out_file)
def test_water_file3(self): """water with the asis trick and GenBank file, output to a file.""" #Setup, query = "TGTTGTAATGTTTTAATGTTTCTTCTCCCTTTAGATGTACTACGTTTGGA" out_file = "Emboss/temp_test3.water" in_file = "GenBank/cor6_6.gb" self.assert_(os.path.isfile(in_file)) if os.path.isfile(out_file): os.remove(out_file) cline = WaterCommandline(cmd=exes["water"]) cline.set_parameter("asequence", "asis:%s" % query) cline.set_parameter("bsequence", in_file) #TODO - Tell water this is a GenBank file! cline.set_parameter("gapopen", "1") cline.set_parameter("gapextend", "0.5") cline.set_parameter("outfile", out_file) self.assertEqual(str(eval(repr(cline))), str(cline)) #Run the tool, result, out, err = generic_run(cline) #Check it worked, errors = err.read().strip() self.assert_(errors.startswith("Smith-Waterman local alignment"), errors) self.assertEqual(out.read().strip(), "") if result.return_code != 0: print >> sys.stderr, "\n%s" % cline self.assertEqual(result.return_code, 0) self.assertEqual(result.get_result("outfile"), out_file) assert os.path.isfile(out_file) #Check we can parse the output and it is sensible... self.pairwise_alignment_check(query, SeqIO.parse(open(in_file), "genbank"), AlignIO.parse(open(out_file), "emboss"), local=True) #Clean up, os.remove(out_file)
def test_water_file3(self): """water with the asis trick and GenBank file, output to a file.""" #Setup, query = "TGTTGTAATGTTTTAATGTTTCTTCTCCCTTTAGATGTACTACGTTTGGA" out_file = "Emboss/temp_test3.water" in_file = "GenBank/cor6_6.gb" self.assert_(os.path.isfile(in_file)) if os.path.isfile(out_file) : os.remove(out_file) cline = WaterCommandline(cmd=exes["water"]) cline.set_parameter("asequence", "asis:%s" % query) cline.set_parameter("bsequence", in_file) #TODO - Tell water this is a GenBank file! cline.set_parameter("gapopen", "1") cline.set_parameter("gapextend", "0.5") cline.set_parameter("outfile", out_file) self.assertEqual(str(eval(repr(cline))), str(cline)) #Run the tool, result, out, err = generic_run(cline) #Check it worked, errors = err.read().strip() self.assert_(errors.startswith("Smith-Waterman local alignment"), errors) self.assertEqual(out.read().strip(), "") if result.return_code != 0 : print >> sys.stderr, "\n%s"%cline self.assertEqual(result.return_code, 0) self.assertEqual(result.get_result("outfile"), out_file) assert os.path.isfile(out_file) #Check we can parse the output and it is sensible... self.pairwise_alignment_check(query, SeqIO.parse(open(in_file),"genbank"), AlignIO.parse(open(out_file),"emboss"), local=True) #Clean up, os.remove(out_file)
def test_water_file(self): """water with the asis trick, output to a file.""" #Setup, try a mixture of keyword arguments and later additions: cline = WaterCommandline(cmd=exes["water"], gapopen="10", gapextend="0.5") #Try using both human readable names, and the literal ones: cline.set_parameter("asequence", "asis:ACCCGGGCGCGGT") cline.set_parameter("-bsequence", "asis:ACCCGAGCGCGGT") #Try using a property set here: cline.outfile = "Emboss/temp with space.water" self.assertEqual(str(eval(repr(cline))), str(cline)) #Run the tool, result, out, err = generic_run(cline) #Check it worked, errors = err.read().strip() self.assert_(errors.startswith("Smith-Waterman local alignment"), errors) self.assertEqual(out.read().strip(), "") if result.return_code != 0: print >> sys.stderr, "\n%s" % cline self.assertEqual(result.return_code, 0) filename = result.get_result("outfile") self.assertEqual(filename, "Emboss/temp with space.water") assert os.path.isfile(filename) #Check we can parse the output... align = AlignIO.read(open(filename), "emboss") self.assertEqual(len(align), 2) self.assertEqual(str(align[0].seq), "ACCCGGGCGCGGT") self.assertEqual(str(align[1].seq), "ACCCGAGCGCGGT") #Clean up, os.remove(filename)
def test_water_file2(self): """water with the asis trick and nucleotide FASTA file, output to a file.""" #Setup, query = "ACACACTCACACACACTTGGTCAGAGATGCTGTGCTTCTTGGAAGCAAGGNCTCAAAGGCAAGGTGCACGCAGAGGGACGTTTGAGTCTGGGATGAAGCATGTNCGTATTATTTATATGATGGAATTTCACGTTTTTATG" out_file = "Emboss/temp_test2.water" in_file = "Fasta/f002" self.assert_(os.path.isfile(in_file)) if os.path.isfile(out_file) : os.remove(out_file) cline = WaterCommandline(cmd=exes["water"]) cline.set_parameter("-asequence", "asis:%s" % query) cline.set_parameter("-bsequence", in_file) cline.set_parameter("-gapopen", "10") cline.set_parameter("-gapextend", "0.5") cline.set_parameter("-outfile", out_file) self.assertEqual(str(eval(repr(cline))), str(cline)) #Run the tool, result, out, err = generic_run(cline) #Check it worked, errors = err.read().strip() self.assert_(errors.startswith("Smith-Waterman local alignment"), errors) self.assertEqual(out.read().strip(), "") if result.return_code != 0 : print >> sys.stderr, "\n%s"%cline self.assertEqual(result.return_code, 0) self.assertEqual(result.get_result("outfile"), out_file) assert os.path.isfile(out_file) #Check we can parse the output and it is sensible... self.pairwise_alignment_check(query, SeqIO.parse(open(in_file),"fasta"), AlignIO.parse(open(out_file),"emboss"), local=True) #Clean up, os.remove(out_file)
def test_water_file(self): """water with the asis trick, output to a file.""" #Setup, try a mixture of keyword arguments and later additions: cline = WaterCommandline(cmd=exes["water"], gapopen="10", gapextend="0.5") #Try using both human readable names, and the literal ones: cline.set_parameter("asequence", "asis:ACCCGGGCGCGGT") cline.set_parameter("-bsequence", "asis:ACCCGAGCGCGGT") #Try using a property set here: cline.outfile = "Emboss/temp with space.water" self.assertEqual(str(eval(repr(cline))), str(cline)) #Run the tool, result, out, err = generic_run(cline) #Check it worked, errors = err.read().strip() self.assert_(errors.startswith("Smith-Waterman local alignment"), errors) self.assertEqual(out.read().strip(), "") if result.return_code != 0 : print >> sys.stderr, "\n%s"%cline self.assertEqual(result.return_code, 0) filename = result.get_result("outfile") self.assertEqual(filename, "Emboss/temp with space.water") assert os.path.isfile(filename) #Check we can parse the output... align = AlignIO.read(open(filename),"emboss") self.assertEqual(len(align), 2) self.assertEqual(str(align[0].seq), "ACCCGGGCGCGGT") self.assertEqual(str(align[1].seq), "ACCCGAGCGCGGT") #Clean up, os.remove(filename)
def test_water_file(self): """Run water with the asis trick, output to a file.""" # Setup, try a mixture of keyword arguments and later additions: cline = WaterCommandline(cmd=exes["water"], gapopen="10", gapextend="0.5") # Try using both human readable names, and the literal ones: cline.set_parameter("asequence", "asis:ACCCGGGCGCGGT") cline.set_parameter("-bsequence", "asis:ACCCGAGCGCGGT") # Try using a property set here: cline.outfile = "Emboss/temp with space.water" self.assertEqual(str(eval(repr(cline))), str(cline)) # Run the tool, self.run_water(cline) # Check we can parse the output... align = AlignIO.read(cline.outfile, "emboss") self.assertEqual(len(align), 2) self.assertEqual(align[0].seq, "ACCCGGGCGCGGT") self.assertEqual(align[1].seq, "ACCCGAGCGCGGT") # Clean up, os.remove(cline.outfile)
def test_water_file(self): """water with the asis trick, output to a file.""" # Setup, try a mixture of keyword arguments and later additions: cline = WaterCommandline(cmd=exes["water"], gapopen="10", gapextend="0.5") # Try using both human readable names, and the literal ones: cline.set_parameter("asequence", "asis:ACCCGGGCGCGGT") cline.set_parameter("-bsequence", "asis:ACCCGAGCGCGGT") # Try using a property set here: cline.outfile = "Emboss/temp with space.water" self.assertEqual(str(eval(repr(cline))), str(cline)) # Run the tool, self.run_water(cline) # Check we can parse the output... align = AlignIO.read(open(cline.outfile), "emboss") self.assertEqual(len(align), 2) self.assertEqual(str(align[0].seq), "ACCCGGGCGCGGT") self.assertEqual(str(align[1].seq), "ACCCGAGCGCGGT") # Clean up, os.remove(cline.outfile)
def test_water_file4(self): """Run water with the asis trick and SwissProt file, output to a file.""" # Setup, query = "DVCTGKALCDPVTQNIKTYPVKIENLRVMI" out_file = "Emboss/temp_test4.water" in_file = "SwissProt/P0A186.txt" self.assertTrue(os.path.isfile(in_file)) if os.path.isfile(out_file): os.remove(out_file) cline = WaterCommandline(cmd=exes["water"]) cline.set_parameter("-asequence", "asis:%s" % query) cline.set_parameter("-bsequence", in_file) # EMBOSS should work this out, but let's be explicit: cline.set_parameter("-sprotein", True) # TODO - Tell water this is a SwissProt file! cline.set_parameter("-gapopen", "20") cline.set_parameter("-gapextend", "5") cline.set_parameter("-outfile", out_file) self.assertEqual(str(eval(repr(cline))), str(cline)) # Run the tool, self.run_water(cline) # Check we can parse the output and it is sensible... self.pairwise_alignment_check( query, SeqIO.parse(in_file, "swiss"), AlignIO.parse(out_file, "emboss"), local=True, ) # Clean up, os.remove(out_file)
def test_water_file4(self): """water with the asis trick and SwissProt file, output to a file.""" # Setup, query = "DVCTGKALCDPVTQNIKTYPVKIENLRVMI" out_file = "Emboss/temp_test4.water" in_file = "SwissProt/sp004" self.assertTrue(os.path.isfile(in_file)) if os.path.isfile(out_file): os.remove(out_file) cline = WaterCommandline(cmd=exes["water"]) cline.set_parameter("-asequence", "asis:%s" % query) cline.set_parameter("-bsequence", in_file) # EMBOSS should work this out, but let's be explicit: cline.set_parameter("-sprotein", True) # TODO - Tell water this is a SwissProt file! cline.set_parameter("-gapopen", "20") cline.set_parameter("-gapextend", "5") cline.set_parameter("-outfile", out_file) self.assertEqual(str(eval(repr(cline))), str(cline)) # Run the tool, self.run_water(cline) # Check we can parse the output and it is sensible... self.pairwise_alignment_check(query, SeqIO.parse(in_file, "swiss"), AlignIO.parse(out_file, "emboss"), local=True) # Clean up, os.remove(out_file)
def test_water_file4(self): """water with the asis trick and SwissProt file, output to a file.""" #Setup, query = "DVCTGKALCDPVTQNIKTYPVKIENLRVMI" out_file = "Emboss/temp_test4.water" in_file = "SwissProt/sp004" self.assert_(os.path.isfile(in_file)) if os.path.isfile(out_file): os.remove(out_file) cline = WaterCommandline(cmd=exes["water"]) cline.set_parameter("-asequence", "asis:%s" % query) cline.set_parameter("-bsequence", in_file) #EMBOSS should work this out, but let's be explicit: cline.set_parameter("-sprotein", True) #TODO - Tell water this is a SwissProt file! cline.set_parameter("-gapopen", "20") cline.set_parameter("-gapextend", "5") cline.set_parameter("-outfile", out_file) self.assertEqual(str(eval(repr(cline))), str(cline)) #Run the tool, result, out, err = generic_run(cline) #Check it worked, errors = err.read().strip() self.assert_(errors.startswith("Smith-Waterman local alignment"), errors) self.assertEqual(out.read().strip(), "") if result.return_code != 0: print >> sys.stderr, "\n%s" % cline self.assertEqual(result.return_code, 0) #Should be able to access this via any alias: self.assertEqual(result.get_result("-outfile"), out_file) assert os.path.isfile(out_file) #Check we can parse the output and it is sensible... self.pairwise_alignment_check(query, SeqIO.parse(open(in_file), "swiss"), AlignIO.parse(open(out_file), "emboss"), local=True) #Clean up, os.remove(out_file)
def test_water_file4(self): """water with the asis trick and SwissProt file, output to a file.""" #Setup, query = "DVCTGKALCDPVTQNIKTYPVKIENLRVMI" out_file = "Emboss/temp_test4.water" in_file = "SwissProt/sp004" self.assert_(os.path.isfile(in_file)) if os.path.isfile(out_file) : os.remove(out_file) cline = WaterCommandline(cmd=exes["water"]) cline.set_parameter("-asequence", "asis:%s" % query) cline.set_parameter("-bsequence", in_file) #EMBOSS should work this out, but let's be explicit: cline.set_parameter("-sprotein", True) #TODO - Tell water this is a SwissProt file! cline.set_parameter("-gapopen", "20") cline.set_parameter("-gapextend", "5") cline.set_parameter("-outfile", out_file) self.assertEqual(str(eval(repr(cline))), str(cline)) #Run the tool, result, out, err = generic_run(cline) #Check it worked, errors = err.read().strip() self.assert_(errors.startswith("Smith-Waterman local alignment"), errors) self.assertEqual(out.read().strip(), "") if result.return_code != 0 : print >> sys.stderr, "\n%s"%cline self.assertEqual(result.return_code, 0) #Should be able to access this via any alias: self.assertEqual(result.get_result("-outfile"), out_file) assert os.path.isfile(out_file) #Check we can parse the output and it is sensible... self.pairwise_alignment_check(query, SeqIO.parse(open(in_file),"swiss"), AlignIO.parse(open(out_file),"emboss"), local=True) #Clean up, os.remove(out_file)