18
|
1 import unittest
|
|
2 import os
|
|
3 from SMART.Java.Python.misc import Utils
|
|
4 from commons.core.utils.FileUtils import FileUtils
|
|
5 from SMART.Java.Python.FindOverlapsOptim import FindOverlapsOptim
|
|
6 from SMART.Java.Python.ncList.test.MockFindOverlapsWithSeveralIntervals import *
|
|
7
|
|
8 class Test_F_FindOverlapsOptim(unittest.TestCase):
|
|
9
|
|
10 def setUp(self):
|
|
11 self._inputRefGff3FileName = 'sorted_Ref.gff3'
|
|
12 self._writeGFF3File(self._inputRefGff3FileName)
|
|
13 self._inputQueryGff3FileName = 'sorted_Query.gff3'
|
|
14 self._writeQueryGff3File(self._inputQueryGff3FileName)
|
|
15 self._outputGff3FileName = 'output.gff3'
|
|
16 self._expOutputFileName = 'expOutGff3.gff3'
|
|
17
|
|
18 def tearDown(self):
|
|
19 for fileName in (self._inputRefGff3FileName, self._inputQueryGff3FileName, self._outputGff3FileName, self._expOutputFileName):
|
|
20 if os.path.exists(fileName):
|
|
21 os.remove(fileName)
|
|
22
|
|
23 def test_run_general_asScript(self):
|
|
24 cmd = 'python ../FindOverlapsOptim.py -i %s -f gff -j %s -g gff -o %s -v 0' % (self._inputQueryGff3FileName, self._inputRefGff3FileName, self._outputGff3FileName)
|
|
25 os.system(cmd)
|
|
26 self._writeExpOutFile_general(self._expOutputFileName)
|
|
27 self.assertTrue(Utils.diff(self._expOutputFileName, self._outputGff3FileName))
|
|
28
|
|
29 def test_run_overlap_special_case(self):
|
|
30 inputQueryGff3FileName = 'query2.gff3'
|
|
31 self._writeQueryGff3File2(inputQueryGff3FileName)
|
|
32 iFOO = FindOverlapsOptim(0)
|
|
33 iFOO.setRefFileName(self._inputRefGff3FileName, "gff")
|
|
34 iFOO.setQueryFileName(inputQueryGff3FileName, "gff")
|
|
35 iFOO.setOutputFileName(self._outputGff3FileName)
|
|
36 iFOO.run()
|
|
37 iFOO.close()
|
|
38 self._writeExpOutFile_special_case(self._expOutputFileName)
|
|
39 self.assertTrue(Utils.diff(self._expOutputFileName, self._outputGff3FileName))
|
|
40 os.remove(inputQueryGff3FileName)
|
|
41
|
|
42 def test_run_overlap_special_case_asScript(self):
|
|
43 inputQueryGff3FileName = 'query2.gff3'
|
|
44 self._writeQueryGff3File2(inputQueryGff3FileName)
|
|
45 cmd = 'python ../FindOverlapsOptim.py -i %s -f gff -j %s -g gff -o %s -v 0' % (inputQueryGff3FileName, self._inputRefGff3FileName, self._outputGff3FileName)
|
|
46 os.system(cmd)
|
|
47 self._writeExpOutFile_special_case(self._expOutputFileName)
|
|
48 self.assertTrue(Utils.diff(self._expOutputFileName, self._outputGff3FileName))
|
|
49 os.remove(inputQueryGff3FileName)
|
|
50
|
|
51 def test_case_2(self):
|
|
52 inputRefGff3FileName = 'ref_case2.gff3'
|
|
53 iMock = MockFindOverlapsWithServeralIntervals_case2()
|
|
54 iMock.write(inputRefGff3FileName)
|
|
55 inputQueryGff3FileName = 'query_case2.gff3'
|
|
56 self._writeQueryGff3File_case2(inputQueryGff3FileName)
|
|
57 iFOO = FindOverlapsOptim(0)
|
|
58 iFOO.setRefFileName(inputRefGff3FileName, "gff")
|
|
59 iFOO.setQueryFileName(inputQueryGff3FileName, "gff")
|
|
60 iFOO.setOutputFileName(self._outputGff3FileName)
|
|
61 iFOO.run()
|
|
62 iFOO.close()
|
|
63 self._writeExpOutFile_case2(self._expOutputFileName)
|
|
64 self.assertTrue(Utils.diff(self._expOutputFileName, self._outputGff3FileName))
|
|
65 os.remove(inputQueryGff3FileName)
|
|
66 os.remove(inputRefGff3FileName)
|
|
67
|
|
68 def test_case_3(self):
|
|
69 inputRefGff3FileName = 'ref_case3.gff3'
|
|
70 iMock = MockFindOverlapsWithServeralIntervals_case3()
|
|
71 iMock.write(inputRefGff3FileName)
|
|
72 inputQueryGff3FileName = 'query_case3.gff3'
|
|
73 self._writeQueryGff3File_case3(inputQueryGff3FileName)
|
|
74 iFOO = FindOverlapsOptim(0)
|
|
75 iFOO.setRefFileName(inputRefGff3FileName, "gff")
|
|
76 iFOO.setQueryFileName(inputQueryGff3FileName, "gff")
|
|
77 iFOO.setOutputFileName(self._outputGff3FileName)
|
|
78 iFOO.run()
|
|
79 iFOO.close()
|
|
80 self._writeExpOutFile_case3(self._expOutputFileName)
|
|
81 self.assertTrue(Utils.diff(self._expOutputFileName, self._outputGff3FileName))
|
|
82 os.remove(inputQueryGff3FileName)
|
|
83 os.remove(inputRefGff3FileName)
|
|
84
|
|
85 def test_case_4(self):
|
|
86 inputRefGff3FileName = 'ref_case4.gff3'
|
|
87 iMock = MockFindOverlapsWithServeralIntervals_case4_5()
|
|
88 iMock.write(inputRefGff3FileName)
|
|
89 inputQueryGff3FileName = 'query_case4.gff3'
|
|
90 self._writeQueryGff3File_case4(inputQueryGff3FileName)
|
|
91 iFOO = FindOverlapsOptim(0)
|
|
92 iFOO.setRefFileName(inputRefGff3FileName, "gff")
|
|
93 iFOO.setQueryFileName(inputQueryGff3FileName, "gff")
|
|
94 iFOO.setOutputFileName(self._outputGff3FileName)
|
|
95 iFOO.run()
|
|
96 iFOO.close()
|
|
97 self._writeExpOutFile_case4(self._expOutputFileName)
|
|
98 self.assertTrue(Utils.diff(self._expOutputFileName, self._outputGff3FileName))
|
|
99 os.remove(inputQueryGff3FileName)
|
|
100 os.remove(inputRefGff3FileName)
|
|
101
|
|
102 def test_case_5(self):
|
|
103 inputRefGff3FileName = 'ref_case5.gff3'
|
|
104 iMock = MockFindOverlapsWithServeralIntervals_case4_5()
|
|
105 iMock.write(inputRefGff3FileName)
|
|
106 inputQueryGff3FileName = 'query_case5.gff3'
|
|
107 self._writeQueryGff3File_case5(inputQueryGff3FileName)
|
|
108 iFOO = FindOverlapsOptim(0)
|
|
109 iFOO.setRefFileName(inputRefGff3FileName, "gff")
|
|
110 iFOO.setQueryFileName(inputQueryGff3FileName, "gff")
|
|
111 iFOO.setOutputFileName(self._outputGff3FileName)
|
|
112 iFOO.run()
|
|
113 iFOO.close()
|
|
114 self._writeExpOutFile_case5(self._expOutputFileName)
|
|
115 self.assertTrue(Utils.diff(self._expOutputFileName, self._outputGff3FileName))
|
|
116 os.remove(inputQueryGff3FileName)
|
|
117 os.remove(inputRefGff3FileName)
|
|
118
|
|
119 def test_case_6(self):
|
|
120 inputRefGff3FileName = 'ref_case6.gff3'
|
|
121 iMock = MockFindOverlapsWithServeralIntervals_case6_7()
|
|
122 iMock.write(inputRefGff3FileName)
|
|
123 inputQueryGff3FileName = 'query_case6.gff3'
|
|
124 self._writeQueryGff3File_case6(inputQueryGff3FileName)
|
|
125 iFOO = FindOverlapsOptim(0)
|
|
126 iFOO.setRefFileName(inputRefGff3FileName, "gff")
|
|
127 iFOO.setQueryFileName(inputQueryGff3FileName, "gff")
|
|
128 iFOO.setOutputFileName(self._outputGff3FileName)
|
|
129 iFOO.run()
|
|
130 iFOO.close()
|
|
131 self._writeExpOutFile_case6(self._expOutputFileName)
|
|
132 self.assertTrue(Utils.diff(self._expOutputFileName, self._outputGff3FileName))
|
|
133 os.remove(inputQueryGff3FileName)
|
|
134 os.remove(inputRefGff3FileName)
|
|
135
|
|
136 def test_case_7(self):
|
|
137 inputRefGff3FileName = 'ref_case7.gff3'
|
|
138 iMock = MockFindOverlapsWithServeralIntervals_case6_7()
|
|
139 iMock.write(inputRefGff3FileName)
|
|
140 inputQueryGff3FileName = 'query_case7.gff3'
|
|
141 self._writeQueryGff3File_case7(inputQueryGff3FileName)
|
|
142 iFOO = FindOverlapsOptim(0)
|
|
143 iFOO.setRefFileName(inputRefGff3FileName, "gff")
|
|
144 iFOO.setQueryFileName(inputQueryGff3FileName, "gff")
|
|
145 iFOO.setOutputFileName(self._outputGff3FileName)
|
|
146 iFOO.run()
|
|
147 iFOO.close()
|
|
148 self._writeExpOutFile_case7(self._expOutputFileName)
|
|
149 self.assertTrue(Utils.diff(self._expOutputFileName, self._outputGff3FileName))
|
|
150 os.remove(inputQueryGff3FileName)
|
|
151 os.remove(inputRefGff3FileName)
|
|
152
|
|
153 def test_case_8(self):
|
|
154 inputRefGff3FileName = 'ref_case8.gff3'
|
|
155 iMock = MockFindOverlapsWithServeralIntervals_case8()
|
|
156 iMock.write(inputRefGff3FileName)
|
|
157 inputQueryGff3FileName = 'query_case8.gff3'
|
|
158 self._writeQueryGff3File_case8(inputQueryGff3FileName)
|
|
159 iFOO = FindOverlapsOptim(0)
|
|
160 iFOO.setRefFileName(inputRefGff3FileName, "gff")
|
|
161 iFOO.setQueryFileName(inputQueryGff3FileName, "gff")
|
|
162 iFOO.setOutputFileName(self._outputGff3FileName)
|
|
163 iFOO.run()
|
|
164 iFOO.close()
|
|
165 self._writeExpOutFile_case8(self._expOutputFileName)
|
|
166 self.assertTrue(Utils.diff(self._expOutputFileName, self._outputGff3FileName))
|
|
167 os.remove(inputQueryGff3FileName)
|
|
168 os.remove(inputRefGff3FileName)
|
|
169
|
|
170 def test_case_9(self):
|
|
171 inputRefGff3FileName = 'ref_case9.gff3'
|
|
172 iMock = MockFindOverlapsWithServeralIntervals_case9()
|
|
173 iMock.write(inputRefGff3FileName)
|
|
174 inputQueryGff3FileName = 'query_case9.gff3'
|
|
175 self._writeQueryGff3File_case9(inputQueryGff3FileName)
|
|
176 iFOO = FindOverlapsOptim(0)
|
|
177 iFOO.setRefFileName(inputRefGff3FileName, "gff")
|
|
178 iFOO.setQueryFileName(inputQueryGff3FileName, "gff")
|
|
179 iFOO.setOutputFileName(self._outputGff3FileName)
|
|
180 iFOO.run()
|
|
181 iFOO.close()
|
|
182 self._writeExpOutFile_case9(self._expOutputFileName)
|
|
183 self.assertTrue(Utils.diff(self._expOutputFileName, self._outputGff3FileName))
|
|
184 os.remove(inputQueryGff3FileName)
|
|
185 os.remove(inputRefGff3FileName)
|
|
186
|
|
187 def test_case_10(self):
|
|
188 inputRefGff3FileName = 'ref_case10.gff3'
|
|
189 iMock = MockFindOverlapsWithServeralIntervals_case10()
|
|
190 iMock.write(inputRefGff3FileName)
|
|
191 inputQueryGff3FileName = 'query_case10.gff3'
|
|
192 self._writeQueryGff3File_case10(inputQueryGff3FileName)
|
|
193 iFOO = FindOverlapsOptim(0)
|
|
194 iFOO.setRefFileName(inputRefGff3FileName, "gff")
|
|
195 iFOO.setQueryFileName(inputQueryGff3FileName, "gff")
|
|
196 iFOO.setOutputFileName(self._outputGff3FileName)
|
|
197 iFOO.run()
|
|
198 iFOO.close()
|
|
199 self._writeExpOutFile_case10(self._expOutputFileName)
|
|
200 self.assertTrue(Utils.diff(self._expOutputFileName, self._outputGff3FileName))
|
|
201 os.remove(inputQueryGff3FileName)
|
|
202 os.remove(inputRefGff3FileName)
|
|
203
|
|
204 def test_case_11(self):
|
|
205 inputRefGff3FileName = 'ref_case11.gff3'
|
|
206 iMock = MockFindOverlapsWithServeralIntervals_case11()
|
|
207 iMock.write(inputRefGff3FileName)
|
|
208 inputQueryGff3FileName = 'query_case11.gff3'
|
|
209 self._writeQueryGff3File_case11(inputQueryGff3FileName)
|
|
210 iFOO = FindOverlapsOptim(0)
|
|
211 iFOO.setRefFileName(inputRefGff3FileName, "gff")
|
|
212 iFOO.setQueryFileName(inputQueryGff3FileName, "gff")
|
|
213 iFOO.setOutputFileName(self._outputGff3FileName)
|
|
214 iFOO.run()
|
|
215 iFOO.close()
|
|
216 self._writeExpOutFile_case11(self._expOutputFileName)
|
|
217 self.assertTrue(Utils.diff(self._expOutputFileName, self._outputGff3FileName))
|
|
218 os.remove(inputQueryGff3FileName)
|
|
219 os.remove(inputRefGff3FileName)
|
|
220
|
|
221 def test_case_12(self):
|
|
222 inputRefGff3FileName = 'ref_case12.gff3'
|
|
223 iMock = MockFindOverlapsWithServeralIntervals_case12()
|
|
224 iMock.write(inputRefGff3FileName)
|
|
225 inputQueryGff3FileName = 'query_case12.gff3'
|
|
226 self._writeQueryGff3File_case12(inputQueryGff3FileName)
|
|
227 iFOO = FindOverlapsOptim(0)
|
|
228 iFOO.setRefFileName(inputRefGff3FileName, "gff")
|
|
229 iFOO.setQueryFileName(inputQueryGff3FileName, "gff")
|
|
230 iFOO.setOutputFileName(self._outputGff3FileName)
|
|
231 iFOO.run()
|
|
232 iFOO.close()
|
|
233 self._writeExpOutFile_case12(self._expOutputFileName)
|
|
234 self.assertTrue(Utils.diff(self._expOutputFileName, self._outputGff3FileName))
|
|
235 os.remove(inputQueryGff3FileName)
|
|
236 os.remove(inputRefGff3FileName)
|
|
237
|
|
238 def _writeExpOutFile_special_case(self, fileName):
|
|
239 f = open(fileName, 'w')
|
|
240 f.write("chr1\tS-MART\ttest2\t1250\t1300\t781\t+\t.\tnbOverlaps=1;overlapsWith=test2.7;ID=query_2;Name=test1.2\n")
|
|
241 f.close()
|
|
242
|
|
243 def _writeExpOutFile_general(self, fileName):
|
|
244 f = open(fileName, 'w')
|
|
245 f.write("""chr1 S-MART test1.1 25 150 126 + . nbOverlaps=3;overlapsWith=test2.1--test2.2--test2.3;ID=query_1;Name=test1.1
|
|
246 chr1 S-MART test1.2 70 850 781 + . nbOverlaps=6;overlapsWith=test2.1--test2.2--test2.3--test2.4--test2.5--test2.6;ID=query_2;Name=test1.2
|
|
247 chr1 S-MART test1.3 550 850 201 + . nbOverlaps=4;overlapsWith=test2.1--test2.3--test2.5--test2.6;ID=query_3;Name=test1.3
|
|
248 chr1 S-MART test1.4 925 1025 101 + . nbOverlaps=2;overlapsWith=test2.1--test2.5;ID=query_4;Name=test1.4
|
|
249 chr1 S-MART test1.5 1201 1210 10 + . nbOverlaps=1;overlapsWith=test2.7;ID=query_5;Name=test1.5
|
|
250 """)
|
|
251 f.close()
|
|
252
|
|
253 def _writeExpOutFile_cas_1(self, fileName):
|
|
254 f = open(fileName, 'w')
|
|
255 f.write("chr1\tS-MART\ttest2.1\t9\t1000\t1001\t+\t.\tName=test2.1;overlapsWith=query_3;ID=test2.1\n")
|
|
256 f.write("chr1\tS-MART\ttest2.3\t100\t600\t501\t+\t.\tName=test2.3;overlapsWith=query_3;ID=test2.3\n")
|
|
257 f.write("chr1\tS-MART\ttest2.5\t700\t950\t251\t+\t.\tName=test2.5;overlapsWith=query_3;ID=test2.5\n")
|
|
258 f.write("chr1\tS-MART\ttest2.6\t800\t900\t101\t+\t.\tName=test2.6;overlapsWith=query_3;ID=test2.6\n")
|
|
259 f.close()
|
|
260
|
|
261 def _writeExpOutFile_cas_2(self, fileName):
|
|
262 f = open(fileName, 'w')
|
|
263 f.write("chr1\tS-MART\ttest2.1\t9\t1000\t1001\t+\t.\tName=test2.1;overlapsWith=query_2;score=1001;feature=test2.1;ID=test2.1\n")
|
|
264 f.write("chr1\tS-MART\ttest2.2\t50\t350\t301\t+\t.\tName=test2.2;overlapsWith=query_2;score=301;feature=test2.2;ID=test2.2\n")
|
|
265 f.write("chr1\tS-MART\ttest2.3\t100\t600\t501\t+\t.\tName=test2.3;overlapsWith=query_2;score=501;feature=test2.3;ID=test2.3\n")
|
|
266 f.write("chr1\tS-MART\ttest2.4\t200\t450\t251\t+\t.\tName=test2.4;overlapsWith=query_2;score=251;feature=test2.4;ID=test2.4\n")
|
|
267 f.write("chr1\tS-MART\ttest2.5\t700\t950\t251\t+\t.\tName=test2.5;overlapsWith=query_2;score=251;feature=test2.5;ID=test2.5\n")
|
|
268 f.write("chr1\tS-MART\ttest2.6\t800\t900\t101\t+\t.\tName=test2.6;overlapsWith=query_2;score=101;feature=test2.6;ID=test2.6\n")
|
|
269 f.write("chr1\tS-MART\ttest2.1\t9\t1000\t1001\t+\t.\tName=test2.1;overlapsWith=query_3;score=1001;feature=test2.1;ID=test2.1\n")
|
|
270 f.write("chr1\tS-MART\ttest2.3\t100\t600\t501\t+\t.\tName=test2.3;overlapsWith=query_3;score=501;feature=test2.3;ID=test2.3\n")
|
|
271 f.write("chr1\tS-MART\ttest2.5\t700\t950\t251\t+\t.\tName=test2.5;overlapsWith=query_3;score=251;feature=test2.5;ID=test2.5\n")
|
|
272 f.write("chr1\tS-MART\ttest2.6\t800\t900\t101\t+\t.\tName=test2.6;overlapsWith=query_3;score=101;feature=test2.6;ID=test2.6\n")
|
|
273 f.close()
|
|
274
|
|
275 def _writeExpOutFile_all_overlap(self, fileName):
|
|
276 f = open(fileName, 'w')
|
|
277 f.write("chr1\tS-MART\ttest2.1\t9\t1000\t1001\t+\t.\tName=test2.1;overlapsWith=query_2;score=1001;feature=test2.1;ID=test2.1\n")
|
|
278 f.write("chr1\tS-MART\ttest2.2\t50\t350\t301\t+\t.\tName=test2.2;overlapsWith=query_2;score=301;feature=test2.2;ID=test2.2\n")
|
|
279 f.write("chr1\tS-MART\ttest2.3\t100\t600\t501\t+\t.\tName=test2.3;overlapsWith=query_2;score=501;feature=test2.3;ID=test2.3\n")
|
|
280 f.write("chr1\tS-MART\ttest2.4\t200\t450\t251\t+\t.\tName=test2.4;overlapsWith=query_2;score=251;feature=test2.4;ID=test2.4\n")
|
|
281 f.write("chr1\tS-MART\ttest2.5\t700\t950\t251\t+\t.\tName=test2.5;overlapsWith=query_2;score=251;feature=test2.5;ID=test2.5\n")
|
|
282 f.write("chr1\tS-MART\ttest2.6\t800\t900\t101\t+\t.\tName=test2.6;overlapsWith=query_2;score=101;feature=test2.6;ID=test2.6\n")
|
|
283 f.close()
|
|
284
|
|
285 def _writeExpOutFile_overlap_to_children(self, fileName):
|
|
286 f = open(fileName, 'w')
|
|
287 f.write("chr1\tS-MART\ttest2.1\t9\t1000\t1001\t+\t.\tName=test2.1;overlapsWith=query_3;score=1001;feature=test2.1;ID=test2.1\n")
|
|
288 f.write("chr1\tS-MART\ttest2.3\t100\t600\t501\t+\t.\tName=test2.3;overlapsWith=query_3;score=501;feature=test2.3;ID=test2.3\n")
|
|
289 f.write("chr1\tS-MART\ttest2.5\t700\t950\t251\t+\t.\tName=test2.5;overlapsWith=query_3;score=251;feature=test2.5;ID=test2.5\n")
|
|
290 f.write("chr1\tS-MART\ttest2.6\t800\t900\t101\t+\t.\tName=test2.6;overlapsWith=query_3;score=101;feature=test2.6;ID=test2.6\n")
|
|
291 f.close()
|
|
292
|
|
293 def _writeExpOutFile_not_overlap_to_children(self, fileName):
|
|
294 f = open(fileName, 'w')
|
|
295 f.write("chr1\tS-MART\ttest2.1\t9\t1000\t1001\t+\t.\tName=test2.1;overlapsWith=query_1;score=1001;feature=test2.1;ID=test2.1\n")
|
|
296 f.write("chr1\tS-MART\ttest2.2\t50\t350\t301\t+\t.\tName=test2.2;overlapsWith=query_1;score=301;feature=test2.2;ID=test2.2\n")
|
|
297 f.write("chr1\tS-MART\ttest2.3\t100\t600\t501\t+\t.\tName=test2.3;overlapsWith=query_1;score=501;feature=test2.3;ID=test2.3\n")
|
|
298 f.write("chr1\tS-MART\ttest2.1\t9\t1000\t1001\t+\t.\tName=test2.1;overlapsWith=query_4;score=1001;feature=test2.1;ID=test2.1\n")
|
|
299 f.write("chr1\tS-MART\ttest2.5\t700\t950\t251\t+\t.\tName=test2.5;overlapsWith=query_4;score=251;feature=test2.5;ID=test2.5\n")
|
|
300 f.close()
|
|
301
|
|
302 def _writeExpOutFile_no_overlap_right(self, fileName):
|
|
303 f = open(fileName, 'w')
|
|
304 f.close()
|
|
305
|
|
306 def _writeExpOutFile_one_overlap(self, fileName):
|
|
307 f = open(fileName, 'w')
|
|
308 f.write("chr1\tS-MART\ttest2.7\t1200\t1300\t101\t+\t.\tName=test2.7;overlapsWith=query_5;score=101;feature=test2.7;ID=test2.7\n")
|
|
309 f.close()
|
|
310
|
|
311 def _writeExpOutFile_case2(self, fileName):
|
|
312 f = open(fileName, 'w')
|
|
313 f.write("""chr1 S-MART test2.1 150 300 151 + . nbOverlaps=4;overlapsWith=test2.1--test2.2--test2.3--test2.4;ID=query_1;Name=test2.1
|
|
314 chr1 S-MART test2.2 300 450 781 + . nbOverlaps=3;overlapsWith=test2.1--test2.2--test2.3;ID=query_2;Name=test2.2
|
|
315 chr1 S-MART test2.3 480 800 321 + . nbOverlaps=1;overlapsWith=test2.1;ID=query_3;Name=test2.3
|
|
316 chr1 S-MART test2.5 850 1000 151 + . nbOverlaps=1;overlapsWith=test2.5;ID=query_5;Name=test2.5
|
|
317 """)
|
|
318 f.close()
|
|
319
|
|
320 def _writeExpOutFile_case3(self, fileName):
|
|
321 f = open(fileName, 'w')
|
|
322 f.write("""chr1 S-MART test3.1 150 250 101 + . nbOverlaps=4;overlapsWith=test3.1--test3.2--test3.3--test3.4;ID=query_1;Name=test3.1
|
|
323 chr1 S-MART test3.2 380 400 21 + . nbOverlaps=4;overlapsWith=test3.1--test3.2--test3.3--test3.5;ID=query_2;Name=test3.2
|
|
324 chr1 S-MART test3.3 480 520 41 + . nbOverlaps=1;overlapsWith=test3.1;ID=query_3;Name=test3.3
|
|
325 chr1 S-MART test3.5 900 950 51 + . nbOverlaps=1;overlapsWith=test3.6;ID=query_5;Name=test3.5
|
|
326 """)
|
|
327 f.close()
|
|
328
|
|
329 def _writeExpOutFile_case4(self, fileName):
|
|
330 f = open(fileName, 'w')
|
|
331 f.write("""chr1 S-MART test4.1 400 500 101 + . nbOverlaps=3;overlapsWith=test4.1--test4.2--test4.3;ID=query_1;Name=test4.1
|
|
332 chr1 S-MART test4.2 450 600 151 + . nbOverlaps=3;overlapsWith=test4.1--test4.2--test4.3;ID=query_2;Name=test4.2
|
|
333 chr1 S-MART test4.3 700 800 101 + . nbOverlaps=2;overlapsWith=test4.1--test4.2;ID=query_3;Name=test4.3
|
|
334 """)
|
|
335 f.close()
|
|
336
|
|
337 def _writeExpOutFile_case5(self, fileName):
|
|
338 f = open(fileName, 'w')
|
|
339 f.write("chr1 S-MART test5.1 850 950 101 + . nbOverlaps=1;overlapsWith=test4.1;ID=query_1;Name=test5.1\n")
|
|
340 f.close()
|
|
341
|
|
342 def _writeExpOutFile_case6(self, fileName):
|
|
343 f = open(fileName, 'w')
|
|
344 f.write("""chr1 S-MART test6.1 200 300 101 + . nbOverlaps=2;overlapsWith=test6.1--test6.2;ID=query_1;Name=test6.1
|
|
345 chr1 S-MART test6.2 800 900 101 + . nbOverlaps=2;overlapsWith=test6.1--test6.5;ID=query_2;Name=test6.2
|
|
346 """)
|
|
347 f.close()
|
|
348
|
|
349 def _writeExpOutFile_case7(self, fileName):
|
|
350 f = open(fileName, 'w')
|
|
351 f.write("""chr1 S-MART test7.1 530 550 21 + . nbOverlaps=1;overlapsWith=test6.1;ID=query_1;Name=test7.1
|
|
352 chr1 S-MART test7.2 600 700 101 + . nbOverlaps=1;overlapsWith=test6.1;ID=query_2;Name=test7.2
|
|
353 chr1 S-MART test7.3 650 900 251 + . nbOverlaps=2;overlapsWith=test6.1--test6.5;ID=query_3;Name=test7.3
|
|
354 """)
|
|
355 f.close()
|
|
356
|
|
357 def _writeExpOutFile_case8(self, fileName):
|
|
358 f = open(fileName, 'w')
|
|
359 f.write("""chr1 S-MART test8.1 500 600 101 + . nbOverlaps=1;overlapsWith=test8.1;ID=query_1;Name=test8.1
|
|
360 chr1 S-MART test8.2 700 800 101 + . nbOverlaps=1;overlapsWith=test8.1;ID=query_2;Name=test8.2
|
|
361 chr1 S-MART test8.3 900 1100 201 + . nbOverlaps=1;overlapsWith=test8.1;ID=query_3;Name=test8.3
|
|
362 """)
|
|
363 f.close()
|
|
364
|
|
365 def _writeExpOutFile_case9(self, fileName):
|
|
366 f = open(fileName, 'w')
|
|
367 f.write("""chr1 S-MART test9.1 400 500 101 + . nbOverlaps=1;overlapsWith=test9.1;ID=query_1;Name=test9.1
|
|
368 chr1 S-MART test9.2 550 650 101 + . nbOverlaps=2;overlapsWith=test9.1--test9.2;ID=query_2;Name=test9.2
|
|
369 """)
|
|
370 f.close()
|
|
371
|
|
372 def _writeExpOutFile_case10(self, fileName):
|
|
373 f = open(fileName, 'w')
|
|
374 f.write("""chr1 S-MART test10.1 700 800 101 + . nbOverlaps=1;overlapsWith=test10.1;ID=query_1;Name=test10.1
|
|
375 chr1 S-MART test10.2 900 1000 101 + . nbOverlaps=1;overlapsWith=test10.1;ID=query_2;Name=test10.2
|
|
376 chr1 S-MART test10.3 1100 1300 201 + . nbOverlaps=1;overlapsWith=test10.5;ID=query_3;Name=test10.3
|
|
377 """)
|
|
378 f.close()
|
|
379
|
|
380 def _writeExpOutFile_case11(self, fileName):
|
|
381 f = open(fileName, 'w')
|
|
382 f.write("""chr1 S-MART test11.1 420 480 61 + . nbOverlaps=1;overlapsWith=test11.1;ID=query_1;Name=test11.1
|
|
383 chr1 S-MART test11.2 450 715 266 + . nbOverlaps=3;overlapsWith=test11.1--test11.4--test11.5;ID=query_2;Name=test11.2
|
|
384 """)
|
|
385 f.close()
|
|
386
|
|
387 def _writeExpOutFile_case12(self, fileName):
|
|
388 f = open(fileName, 'w')
|
|
389 f.write("""chr1 S-MART test12.1 200 400 . + . nbOverlaps=3;overlapsWith=test12.1--test12.2--test12.3;ID=query_1;Name=test12.1
|
|
390 chr1 S-MART test12.2 600 900 . + . nbOverlaps=2;overlapsWith=test12.1--test12.4;ID=query_2;Name=test12.2
|
|
391 chr1 S-MART test12.3 700 1000 . + . nbOverlaps=2;overlapsWith=test12.1--test12.4;ID=query_3;Name=test12.3
|
|
392 """)
|
|
393 f.close()
|
|
394
|
|
395 def _writeQueryGff3File2(self, fileName):
|
|
396 f = open(fileName, 'w')
|
|
397 f.write("chr1\tquery\ttest1\t1100\t1150\t126\t+\t.\tID=query_1;Name=test1.1\n")
|
|
398 f.write("chr1\tquery\ttest2\t1250\t1300\t781\t+\t.\tID=query_2;Name=test1.2\n")
|
|
399 f.close()
|
|
400
|
|
401 def _writeQueryGff3File(self, fileName):
|
|
402 f = open(fileName, 'w')
|
|
403 f.write("chr1\tquery\ttest1.1\t25\t150\t126\t+\t.\tID=query_1;Name=test1.1\n")
|
|
404 f.write("chr1\tquery\ttest1.2\t70\t850\t781\t+\t.\tID=query_2;Name=test1.2\n")
|
|
405 f.write("chr1\tquery\ttest1.3\t550\t850\t201\t+\t.\tID=query_3;Name=test1.3\n")
|
|
406 f.write("chr1\tquery\ttest1.4\t925\t1025\t101\t+\t.\tID=query_4;Name=test1.4\n")
|
|
407 f.write("chr1\tquery\ttest1.5\t1201\t1210\t10\t+\t.\tID=query_5;Name=test1.5\n")
|
|
408 f.write("chr1\tquery\ttest1.6\t1500\t1600\t101\t+\t.\tID=query_6;Name=test1.6\n")
|
|
409 f.close()
|
|
410
|
|
411 def _writeQueryGff3File_case2(self, fileName):
|
|
412 f = open(fileName, 'w')
|
|
413 f.write("chr1\tquery\ttest2.1\t150\t300\t151\t+\t.\tID=query_1;Name=test2.1\n")
|
|
414 f.write("chr1\tquery\ttest2.2\t300\t450\t781\t+\t.\tID=query_2;Name=test2.2\n")
|
|
415 f.write("chr1\tquery\ttest2.3\t480\t800\t321\t+\t.\tID=query_3;Name=test2.3\n")
|
|
416 f.write("chr1\tquery\ttest2.4\t560\t800\t241\t+\t.\tID=query_4;Name=test2.4\n")
|
|
417 f.write("chr1\tquery\ttest2.5\t850\t1000\t151\t+\t.\tID=query_5;Name=test2.5\n")
|
|
418 f.close()
|
|
419
|
|
420 def _writeQueryGff3File_case3(self, fileName):
|
|
421 f = open(fileName, 'w')
|
|
422 f.write("chr1\tquery\ttest3.1\t150\t250\t101\t+\t.\tID=query_1;Name=test3.1\n")
|
|
423 f.write("chr1\tquery\ttest3.2\t380\t400\t21\t+\t.\tID=query_2;Name=test3.2\n")
|
|
424 f.write("chr1\tquery\ttest3.3\t480\t520\t41\t+\t.\tID=query_3;Name=test3.3\n")
|
|
425 f.write("chr1\tquery\ttest3.4\t510\t700\t191\t+\t.\tID=query_4;Name=test3.4\n")
|
|
426 f.write("chr1\tquery\ttest3.5\t900\t950\t51\t+\t.\tID=query_5;Name=test3.5\n")
|
|
427 f.close()
|
|
428
|
|
429 def _writeQueryGff3File_case4(self, fileName):
|
|
430 f = open(fileName, 'w')
|
|
431 f.write("chr1\tquery\ttest4.1\t400\t500\t101\t+\t.\tID=query_1;Name=test4.1\n")
|
|
432 f.write("chr1\tquery\ttest4.2\t450\t600\t151\t+\t.\tID=query_2;Name=test4.2\n")
|
|
433 f.write("chr1\tquery\ttest4.3\t700\t800\t101\t+\t.\tID=query_3;Name=test4.3\n")
|
|
434 f.close()
|
|
435
|
|
436 def _writeQueryGff3File_case5(self, fileName):
|
|
437 f = open(fileName, 'w')
|
|
438 f.write("chr1\tquery\ttest5.1\t850\t950\t101\t+\t.\tID=query_1;Name=test5.1\n")
|
|
439 f.close()
|
|
440
|
|
441 def _writeQueryGff3File_case6(self, fileName):
|
|
442 f = open(fileName, 'w')
|
|
443 f.write("chr1\tquery\ttest6.1\t200\t300\t101\t+\t.\tID=query_1;Name=test6.1\n")
|
|
444 f.write("chr1\tquery\ttest6.2\t800\t900\t101\t+\t.\tID=query_2;Name=test6.2\n")
|
|
445 f.close()
|
|
446
|
|
447 def _writeQueryGff3File_case7(self, fileName):
|
|
448 f = open(fileName, 'w')
|
|
449 f.write("chr1\tquery\ttest7.1\t530\t550\t21\t+\t.\tID=query_1;Name=test7.1\n")
|
|
450 f.write("chr1\tquery\ttest7.2\t600\t700\t101\t+\t.\tID=query_2;Name=test7.2\n")
|
|
451 f.write("chr1\tquery\ttest7.3\t650\t900\t251\t+\t.\tID=query_3;Name=test7.3\n")
|
|
452 f.close()
|
|
453
|
|
454 def _writeQueryGff3File_case8(self, fileName):
|
|
455 f = open(fileName, 'w')
|
|
456 f.write("chr1\tquery\ttest8.1\t500\t600\t101\t+\t.\tID=query_1;Name=test8.1\n")
|
|
457 f.write("chr1\tquery\ttest8.2\t700\t800\t101\t+\t.\tID=query_2;Name=test8.2\n")
|
|
458 f.write("chr1\tquery\ttest8.3\t900\t1100\t201\t+\t.\tID=query_3;Name=test8.3\n")
|
|
459 f.write("chr1\tquery\ttest8.4\t1200\t1300\t101\t+\t.\tID=query_4;Name=test8.4\n")
|
|
460 f.close()
|
|
461
|
|
462 def _writeQueryGff3File_case9(self, fileName):
|
|
463 f = open(fileName, 'w')
|
|
464 f.write("chr1\tquery\ttest9.1\t400\t500\t101\t+\t.\tID=query_1;Name=test9.1\n")
|
|
465 f.write("chr1\tquery\ttest9.2\t550\t650\t101\t+\t.\tID=query_2;Name=test9.2\n")
|
|
466 f.close()
|
|
467
|
|
468 def _writeQueryGff3File_case10(self, fileName):
|
|
469 f = open(fileName, 'w')
|
|
470 f.write("chr1\tquery\ttest10.1\t700\t800\t101\t+\t.\tID=query_1;Name=test10.1\n")
|
|
471 f.write("chr1\tquery\ttest10.2\t900\t1000\t101\t+\t.\tID=query_2;Name=test10.2\n")
|
|
472 f.write("chr1\tquery\ttest10.3\t1100\t1300\t201\t+\t.\tID=query_3;Name=test10.3\n")
|
|
473 f.close()
|
|
474
|
|
475 def _writeQueryGff3File_case11(self, fileName):
|
|
476 f = open(fileName, 'w')
|
|
477 f.write("chr1\tquery\ttest11.1\t420\t480\t61\t+\t.\tID=query_1;Name=test11.1\n")
|
|
478 f.write("chr1\tquery\ttest11.2\t450\t715\t266\t+\t.\tID=query_2;Name=test11.2\n")
|
|
479 f.close()
|
|
480
|
|
481 def _writeQueryGff3File_case12(self, fileName):
|
|
482 f = open(fileName, 'w')
|
|
483 f.write("chr1\tquery\ttest12.1\t200\t400\t.\t+\t.\tID=query_1;Name=test12.1\n")
|
|
484 f.write("chr1\tquery\ttest12.2\t600\t900\t.\t+\t.\tID=query_2;Name=test12.2\n")
|
|
485 f.write("chr1\tquery\ttest12.3\t700\t1000\t.\t+\t.\tID=query_3;Name=test12.3\n")
|
|
486 f.close()
|
|
487
|
|
488 def _writeGFF3File(self, fileName):
|
|
489 f = open(fileName, "w")
|
|
490 f.write("chr1\ttest\ttest2.1\t9\t1000\t1001\t+\t.\tID=test2.1;Name=test2.1\n")
|
|
491 f.write("chr1\ttest\ttest2.2\t50\t350\t301\t+\t.\tID=test2.2;Name=test2.2\n")
|
|
492 f.write("chr1\ttest\ttest2.3\t100\t600\t501\t+\t.\tID=test2.3;Name=test2.3\n")
|
|
493 f.write("chr1\ttest\ttest2.4\t200\t450\t251\t+\t.\tID=test2.4;Name=test2.4\n")
|
|
494 f.write("chr1\ttest\ttest2.5\t700\t950\t251\t+\t.\tID=test2.5;Name=test2.5\n")
|
|
495 f.write("chr1\ttest\ttest2.6\t800\t900\t101\t+\t.\tID=test2.6;Name=test2.6\n")
|
|
496 f.write("chr1\ttest\ttest2.7\t1200\t1300\t101\t+\t.\tID=test2.7;Name=test2.7\n")
|
|
497 f.close()
|
|
498
|
|
499 if __name__ == "__main__":
|
|
500 unittest.main()
|