Mercurial > repos > yufei-luo > s_mart
comparison SMART/Java/Python/test/Test_F_plotCoverage.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 from SMART.Java.Python.plotCoverage import PlotParser | |
4 | |
5 | |
6 class Test_F_PlotCoverage(unittest.TestCase): | |
7 | |
8 def setUp(self): | |
9 self.queryFileName = "queryFile.gff3" | |
10 self.refFileName = "refFile.gff3" | |
11 self.outputFileName = "outputFile" | |
12 | |
13 def tearDown(self): | |
14 for fileRoot in (self.queryFileName, self.refFileName, self.outputFileName): | |
15 for file in glob.glob("%s*" % (fileRoot)): | |
16 os.remove(file) | |
17 os.remove(".RData") | |
18 | |
19 def test_run_simple(self): | |
20 handle = open(self.refFileName, "w") | |
21 handle.write("chr1\tSMART\tmRNA\t1000\t2000\t.\t+\t.\tID=test1;Name=test1") | |
22 handle.close() | |
23 handle = open(self.queryFileName, "w") | |
24 handle.write("chr1\tSMART\tmRNA\t1100\t1200\t.\t+\t.\tID=test2.1;Name=test2.1\n") | |
25 handle.write("chr1\tSMART\tmRNA\t1300\t1400\t.\t+\t.\tID=test2.2;Name=test2.2\n") | |
26 handle.close() | |
27 pp = PlotParser(0) | |
28 pp.addInput(0, self.queryFileName, "gff3") | |
29 pp.addInput(1, self.refFileName, "gff3") | |
30 pp.setLabels("x", "y") | |
31 pp.setPlotSize(1000, 500) | |
32 pp.setOutput(self.outputFileName) | |
33 pp.start() | |
34 self.assertTrue(os.path.exists("%s_test1_overlap.png" % (self.outputFileName))) | |
35 self.assertTrue(os.path.exists("%s_test1_coverage.png" % (self.outputFileName))) | |
36 | |
37 if __name__ == "__main__": | |
38 unittest.main() | |
39 |