comparison SMART/Java/Python/test/Test_F_qualToFastq.py @ 18:94ab73e8a190

Uploaded
author m-zytnicki
date Mon, 29 Apr 2013 03:20:15 -0400
parents
children
comparison
equal deleted inserted replaced
17:b0e8584489e6 18:94ab73e8a190
1 import unittest
2 import os, glob
3
4
5 class Test_F_qualToFastq(unittest.TestCase):
6
7 def setUp(self):
8 self.fastaFileName = "file.fasta"
9 self.qualFileName = "file.qual"
10 self.outputFileName = "outputFile.fastq"
11
12 def tearDown(self):
13 for fileRoot in (self.fastaFileName, self.qualFileName, self.outputFileName):
14 for file in glob.glob("%s*" % (fileRoot)):
15 os.remove(file)
16
17 def test_run_simple(self):
18 handle = open(self.fastaFileName, "w")
19 handle.write(">test1\n")
20 handle.write("AAAAAA")
21 handle.close()
22 handle = open(self.qualFileName, "w")
23 handle.write(">test1\n")
24 handle.write("32\t32\t32\t32\t32\t32")
25 handle.close()
26 os.system("python ../qualToFastq.py -f %s -q %s -o %s -v 0" % (self.fastaFileName, self.qualFileName, self.outputFileName))
27 handle = open(self.outputFileName)
28 lines = handle.readlines()
29 self.assertEquals(len(lines), 4)
30 self.assertEquals(lines[0], "@test1\n")
31 self.assertEquals(lines[1], "AAAAAA\n")
32 self.assertEquals(lines[2], "+\n")
33 self.assertEquals(lines[3], "AAAAAA\n")
34
35
36 if __name__ == "__main__":
37 unittest.main()
38