annotate SMART/Java/Python/test/Test_F_getWigDistance.py @ 18:94ab73e8a190

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