18
|
1 import unittest
|
|
2 import os
|
|
3 from commons.core.utils.FileUtils import FileUtils
|
|
4 from SMART.Java.Python.getWigDistance import *
|
|
5
|
|
6 class Test_F_getWigDistance(unittest.TestCase):
|
|
7
|
|
8
|
|
9 def setUp(self):
|
|
10 self._inputGffFileName = 'inputGff.gff3'
|
|
11 self._writeInputGff(self._inputGffFileName)
|
|
12 self._inputWigFileName = '../TestFiles/sorted_query_wig.wig'
|
|
13 self._outFileName = 'outGffWig.png'
|
|
14
|
|
15 def tearDown(self):
|
|
16 os.remove(self._inputGffFileName)
|
|
17 os.remove(self._outFileName)
|
|
18
|
|
19 def test_getWigDistance_defaultOption(self):
|
|
20 cmd = 'python ../getWigDistance.py -i %s -f gff3 -w %s -d 10 -o %s' % (self._inputGffFileName, self._inputWigFileName, self._outFileName)
|
|
21 os.system(cmd)
|
|
22
|
|
23 def test_getWigDistance_strandsOption(self):
|
|
24 cmd = 'python ../getWigDistance.py -i %s -f gff3 -w %s -d 10 -o %s -s' % (self._inputGffFileName, self._inputWigFileName, self._outFileName)
|
|
25 os.system(cmd)
|
|
26
|
|
27 def test_getWigDistance_logOption(self):
|
|
28 cmd = 'python ../getWigDistance.py -i %s -f gff3 -w %s -d 10 -o %s -l' % (self._inputGffFileName, self._inputWigFileName, self._outFileName)
|
|
29 os.system(cmd)
|
|
30
|
|
31 def _writeInputGff(self, fileName):
|
|
32 f = open(fileName, 'w')
|
|
33 f.write("chr1\tquery\ttest1.1\t25\t150\t126\t+\t.\tID=query_1;Name=test1.1\n")
|
|
34 f.write("chr1\tquery\ttest1.2\t70\t850\t781\t-\t.\tID=query_2;Name=test1.2\n")
|
|
35 f.write("chr1\tquery\ttest1.3\t550\t850\t201\t-\t.\tID=query_3;Name=test1.3\n")
|
|
36 f.write("chr1\tquery\ttest1.4\t925\t1025\t101\t+\t.\tID=query_4;Name=test1.4\n")
|
|
37 f.write("chr1\tquery\ttest1.5\t1201\t1210\t10\t+\t.\tID=query_5;Name=test1.5\n")
|
|
38 f.write("chr1\tquery\ttest1.6\t1500\t1600\t101\t+\t.\tID=query_6;Name=test1.6\n")
|
|
39 f.close()
|
|
40
|
|
41
|
|
42
|
|
43 if __name__ == "__main__":
|
|
44 #import sys;sys.argv = ['', 'Test.testName']
|
|
45 unittest.main() |