annotate SMART/Java/Python/test/Test_F_qualToFastq.py @ 25:7809e72960fe

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