Mercurial > repos > yufei-luo > s_mart
comparison SMART/Java/Python/test/Test_F_getReadDistribution.py @ 31:0ab839023fe4
Uploaded
author | m-zytnicki |
---|---|
date | Tue, 30 Apr 2013 14:33:21 -0400 |
parents | 94ab73e8a190 |
children |
comparison
equal
deleted
inserted
replaced
30:5677346472b5 | 31:0ab839023fe4 |
---|---|
1 import unittest | |
2 import os, glob | |
3 | |
4 | |
5 class Test_F_getReadDistribution(unittest.TestCase): | |
6 | |
7 def setUp(self): | |
8 self.inputFileName = "inputFile.fasta" | |
9 self.outputFileName = "outputFile" | |
10 | |
11 def tearDown(self): | |
12 for fileRoot in (self.inputFileName, self.outputFileName): | |
13 for file in glob.glob("%s*" % (fileRoot)): | |
14 os.remove(file) | |
15 os.system("rm .RData") | |
16 | |
17 def test_run_simple(self): | |
18 handle = open(self.inputFileName, "w") | |
19 handle.write(">test1\n") | |
20 handle.write("AAAAAA\n") | |
21 handle.write(">test2\n") | |
22 handle.write("AAAAAA\n") | |
23 handle.write(">test3\n") | |
24 handle.write("CCCCCC\n") | |
25 handle.close() | |
26 handle.close() | |
27 os.system("python ../getReadDistribution.py -i %s -f fasta -n 1 -o %s -v 0" % (self.inputFileName, self.outputFileName)) | |
28 self.assertTrue(os.path.exists("%s.png" % (self.outputFileName))) | |
29 handle = open("%s.txt" % (self.outputFileName)) | |
30 lines = handle.readlines() | |
31 self.assertEquals(len(lines), 1) | |
32 self.assertEquals(lines[0], "AAAAAA\t2\n") | |
33 | |
34 | |
35 if __name__ == "__main__": | |
36 unittest.main() | |
37 |