comparison commons/core/sql/test/Test_TablePathAdaptator.py @ 6:769e306b7933

Change the repository level.
author yufei-luo
date Fri, 18 Jan 2013 04:54:14 -0500
parents
children
comparison
equal deleted inserted replaced
5:ea3082881bf8 6:769e306b7933
1 # Copyright INRA (Institut National de la Recherche Agronomique)
2 # http://www.inra.fr
3 # http://urgi.versailles.inra.fr
4 #
5 # This software is governed by the CeCILL license under French law and
6 # abiding by the rules of distribution of free software. You can use,
7 # modify and/ or redistribute the software under the terms of the CeCILL
8 # license as circulated by CEA, CNRS and INRIA at the following URL
9 # "http://www.cecill.info".
10 #
11 # As a counterpart to the access to the source code and rights to copy,
12 # modify and redistribute granted by the license, users are provided only
13 # with a limited warranty and the software's author, the holder of the
14 # economic rights, and the successive licensors have only limited
15 # liability.
16 #
17 # In this respect, the user's attention is drawn to the risks associated
18 # with loading, using, modifying and/or developing or reproducing the
19 # software by the user in light of its specific status of free software,
20 # that may mean that it is complicated to manipulate, and that also
21 # therefore means that it is reserved for developers and experienced
22 # professionals having in-depth computer knowledge. Users are therefore
23 # encouraged to load and test the software's suitability as regards their
24 # requirements in conditions enabling the security of their systems and/or
25 # data to be ensured and, more generally, to use and operate it in the
26 # same conditions as regards security.
27 #
28 # The fact that you are presently reading this means that you have had
29 # knowledge of the CeCILL license and that you accept its terms.
30
31
32 import unittest
33 import os
34 import time
35 from commons.core.sql.TablePathAdaptator import TablePathAdaptator
36 from commons.core.coord.Path import Path
37 from commons.core.coord.Set import Set
38 from commons.core.sql.DbMySql import DbMySql
39 from commons.core.coord.Range import Range
40 from commons.core.coord.PathUtils import PathUtils
41 from copy import deepcopy
42
43 class Test_TablePathAdaptator( unittest.TestCase ):
44
45 def setUp( self ):
46 self._uniqId = "%s_%s" % ( time.strftime("%Y%m%d%H%M%S") , os.getpid() )
47 self._configFileName = "dummyConfigFile_%s" % ( self._uniqId )
48 configF = open(self._configFileName, "w" )
49 configF.write( "[repet_env]\n" )
50 configF.write( "repet_host: %s\n" % ( os.environ["REPET_HOST"] ) )
51 configF.write( "repet_user: %s\n" % ( os.environ["REPET_USER"] ) )
52 configF.write( "repet_pw: %s\n" % ( os.environ["REPET_PW"] ) )
53 configF.write( "repet_db: %s\n" % ( os.environ["REPET_DB"] ) )
54 configF.write( "repet_port: %s\n" % ( os.environ["REPET_PORT"] ) )
55 configF.close()
56 self._db = DbMySql( cfgFileName = self._configFileName )
57 self._table = "dummyPathTable_%s" % ( self._uniqId )
58 self._tpA = TablePathAdaptator( self._db, self._table )
59
60
61 def tearDown( self ):
62 self._uniqId = None
63 self._db.dropTable( self._table )
64 self._db.close()
65 self._table = None
66 self._tMatchA = None
67 os.remove( self._configFileName )
68 self._configFileName = ""
69
70
71 ##################################################################################
72 ################## Tests for methods in ITableMapAdaptator #######################
73 ##################################################################################
74
75 def test_getPathListFromId( self ):
76 pathFileName = "dummyPathFile_%s" % ( self._uniqId )
77 pathF = open( pathFileName, "w" )
78 pathF.write( "1\tchr1\t1\t6\tTE2\t11\t16\t1e-20\t30\t90.2\n" )
79 pathF.write( "2\tchr1\t1001\t1006\tTE2\t11\t16\t1e-20\t30\t90.2\n" )
80 pathF.write( "2\tchr1\t1201\t1226\tTE2\t10\t26\t1e-40\t70\t87.2\n" )
81 pathF.close()
82 p1 = Path()
83 p1.setFromString( "2\tchr1\t1001\t1006\tTE2\t11\t16\t1e-20\t30\t90.2\n" )
84 p2 = Path()
85 p2.setFromString( "2\tchr1\t1201\t1226\tTE2\t10\t26\t1e-40\t70\t87.2\n" )
86 lExp = [ p1, p2 ]
87 self._db.createTable( self._table, "path", pathFileName )
88 lObs = self._tpA.getPathListFromId( 2 )
89 self.assertEqual( lObs, lExp )
90 os.remove( pathFileName )
91
92
93 def test_getPathListFromIdList_empty_id_list( self ):
94 pathFileName = "dummyPathFile_%s" % ( self._uniqId )
95 pathF = open( pathFileName, "w" )
96 pathF.write("1\tchr1\t1\t10\tTE2\t11\t17\t1e-20\t30\t90.2\n")
97 pathF.write("2\tchr1\t2\t9\tTE2\t10\t13\t1e-20\t30\t90.2\n")
98 pathF.write("3\tchr1\t8\t13\tTE2\t11\t17\t1e-20\t30\t90.2\n")
99 pathF.close()
100 self._db.createTable( self._table, "path", pathFileName )
101
102 expList = []
103 obsList = self._tpA.getPathListFromIdList([])
104 self.assertEquals(expList, obsList)
105
106 os.remove( pathFileName )
107
108
109 def test_getPathListFromIdList( self ):
110 pathFileName = "dummyPathFile_%s" % ( self._uniqId )
111 pathF = open( pathFileName, "w" )
112 pathF.write("1\tchr1\t1\t10\tTE2\t11\t17\t1e-20\t30\t90.2\n")
113 pathF.write("2\tchr1\t2\t9\tTE2\t10\t13\t1e-20\t30\t90.2\n")
114 pathF.write("3\tchr1\t8\t13\tTE2\t11\t17\t1e-20\t30\t90.2\n")
115 pathF.close()
116
117 tuple = ("1", "chr1","1", "10","TE2","11","17","1e-20","30","90.2")
118 p1 = Path()
119 p1.setFromTuple(tuple)
120
121 tuple = ("2", "chr1","2", "9","TE2","10","13","1e-20","30","90.2")
122 p2 = Path()
123 p2.setFromTuple(tuple)
124
125 tuple = ("3", "chr1","8", "13","TE2","11","17","1e-20","30","90.2")
126 p3 = Path()
127 p3.setFromTuple(tuple)
128
129 self._db.createTable( self._table, "path", pathFileName )
130 lObs = self._tpA.getPathListFromIdList((1, 2, 3))
131 self.assertEquals(3, len(lObs))
132
133 lExp = [p1, p2, p3]
134 self.assertEquals(lExp, lObs)
135
136 os.remove( pathFileName )
137
138
139 def test_getPathListFromQuery( self ):
140 pathFileName = "dummyPathFile_%s" % ( self._uniqId )
141 pathF = open( pathFileName, "w" )
142 pathF.write("1\tchr1\t1\t10\tTE2\t11\t17\t1e-20\t30\t90.2\n")
143 pathF.write("2\tchr1\t2\t9\tTE2\t10\t13\t1e-20\t30\t90.2\n")
144 pathF.write("3\tchr2\t8\t13\tTE2\t11\t17\t1e-20\t30\t90.2\n")
145 pathF.close()
146 self._db.createTable( self._table, "path", pathFileName )
147 path1 = Path()
148 path1.setFromString("1\tchr1\t1\t10\tTE2\t11\t17\t1e-20\t30\t90.2\n")
149 path2 = Path()
150 path2.setFromString("2\tchr1\t2\t9\tTE2\t10\t13\t1e-20\t30\t90.2\n")
151 expList = [ path1, path2 ]
152 obsList = self._tpA.getPathListFromQuery("chr1")
153 self.assertEquals( expList, obsList )
154
155 os.remove( pathFileName )
156
157
158 def test_getPathListFromQuery_unexisted_query( self ):
159 pathFileName = "dummyPathFile_%s" % ( self._uniqId )
160 pathF = open( pathFileName, "w" )
161 pathF.write("1\tchr1\t1\t10\tTE2\t11\t17\t1e-20\t30\t90.2\n")
162 pathF.write("2\tchr1\t2\t9\tTE2\t10\t13\t1e-20\t30\t90.2\n")
163 pathF.write("3\tchr2\t8\t13\tTE2\t11\t17\t1e-20\t30\t90.2\n")
164 pathF.close()
165 self._db.createTable( self._table, "path", pathFileName )
166 expList = []
167 obsList = self._tpA.getPathListFromQuery("dummy")
168 self.assertEquals( expList, obsList )
169
170 os.remove( pathFileName )
171
172
173 def test_getPathListFromSubject( self ):
174 pathFileName = "dummyPathFile_%s" % ( self._uniqId )
175 pathF = open( pathFileName, "w" )
176 pathF.write("1\tchr1\t1\t10\tTE2\t11\t17\t1e-20\t30\t90.2\n")
177 pathF.write("2\tchr1\t2\t9\tTE3\t10\t13\t1e-20\t30\t90.2\n")
178 pathF.write("3\tchr2\t8\t13\tTE2\t11\t17\t1e-20\t30\t90.2\n")
179 pathF.close()
180 self._db.createTable( self._table, "path", pathFileName )
181 path1 = Path()
182 path1.setFromString("1\tchr1\t1\t10\tTE2\t11\t17\t1e-20\t30\t90.2\n")
183 path3 = Path()
184 path3.setFromString("3\tchr2\t8\t13\tTE2\t11\t17\t1e-20\t30\t90.2\n")
185 expList = [ path1, path3 ]
186 obsList = self._tpA.getPathListFromSubject("TE2")
187 self.assertEquals( expList, obsList )
188
189 os.remove( pathFileName )
190
191
192 def test_getPathListFromSubject_unexisted_subject( self ):
193 pathFileName = "dummyPathFile_%s" % ( self._uniqId )
194 pathF = open( pathFileName, "w" )
195 pathF.write("1\tchr1\t1\t10\tTE2\t11\t17\t1e-20\t30\t90.2\n")
196 pathF.write("2\tchr1\t2\t9\tTE3\t10\t13\t1e-20\t30\t90.2\n")
197 pathF.write("3\tchr2\t8\t13\tTE2\t11\t17\t1e-20\t30\t90.2\n")
198 pathF.close()
199 self._db.createTable( self._table, "path", pathFileName )
200 expList = []
201 obsList = self._tpA.getPathListFromSubject("dummy")
202 self.assertEquals( expList, obsList )
203
204 os.remove( pathFileName )
205
206
207 def test_insert_QryDirSbjDir( self ):
208 path2Insert = Path()
209
210 rangeQuery2Insert = Range()
211 rangeQuery2Insert.seqname = "chr1"
212 rangeQuery2Insert.start = 1
213 rangeQuery2Insert.end = 10
214
215 rangeSubject2Insert = Range()
216 rangeSubject2Insert.seqname = "TE2"
217 rangeSubject2Insert.start = 11
218 rangeSubject2Insert.end = 17
219
220 path2Insert.range_query = rangeQuery2Insert
221 path2Insert.range_subject = rangeSubject2Insert
222
223 path2Insert.identity = 90.2
224 path2Insert.score = 30
225 path2Insert.e_value = 1e-20
226 path2Insert.id = 1
227
228 self._db.createTable( self._table, "path" )
229 self._tpA.insert( path2Insert )
230
231 expPathTuple = ((1L, "chr1", 1L, 10L, "TE2", 11L, 17L, 1e-20, 30L, 90.2),)
232 sqlCmd = "SELECT * FROM %s" % ( self._table )
233 self._db.execute( sqlCmd )
234 obsPathTuple = self._db.cursor.fetchall()
235
236 self.assertEquals(expPathTuple, obsPathTuple)
237
238
239 def test_insert_BigEvalue( self ):
240 path2Insert = Path()
241
242 rangeQuery2Insert = Range()
243 rangeQuery2Insert.seqname = "chr1"
244 rangeQuery2Insert.start = 1
245 rangeQuery2Insert.end = 10
246
247 rangeSubject2Insert = Range()
248 rangeSubject2Insert.seqname = "TE2"
249 rangeSubject2Insert.start = 11
250 rangeSubject2Insert.end = 17
251
252 path2Insert.range_query = rangeQuery2Insert
253 path2Insert.range_subject = rangeSubject2Insert
254
255 path2Insert.identity = 90.2
256 path2Insert.score = 30.0
257 path2Insert.e_value = 1e-300
258 path2Insert.id = 1
259
260 self._db.createTable( self._table, "path" )
261 self._tpA.insert( path2Insert )
262
263 expPathTuple = ((1L, "chr1", 1L, 10L, "TE2", 11L, 17L, 1e-300, 30L, 90.2),)
264 sqlCmd = "SELECT * FROM %s" % ( self._table )
265 self._db.execute( sqlCmd )
266 obsPathTuple = self._db.cursor.fetchall()
267
268 self.assertEquals(expPathTuple, obsPathTuple)
269
270
271 def test_insert_QryRevSbjDir( self ):
272 path2Insert = Path()
273
274 rangeQuery2Insert = Range()
275 rangeQuery2Insert.seqname = "chr1"
276 rangeQuery2Insert.start = 10
277 rangeQuery2Insert.end = 1
278
279 rangeSubject2Insert = Range()
280 rangeSubject2Insert.seqname = "TE2"
281 rangeSubject2Insert.start = 11
282 rangeSubject2Insert.end = 17
283
284 path2Insert.range_query = rangeQuery2Insert
285 path2Insert.range_subject = rangeSubject2Insert
286
287 path2Insert.identity = 90.2
288 path2Insert.score = 30
289 path2Insert.e_value = 1e-216
290 path2Insert.id = 1
291
292 self._db.createTable( self._table, "path" )
293 self._tpA.insert( path2Insert )
294
295 expPathTuple = ((1L, "chr1", 1L, 10L, "TE2", 17L, 11L, 1e-216, 30L, 90.2),)
296 sqlCmd = "SELECT * FROM %s" % ( self._table )
297 self._db.execute( sqlCmd )
298 obsPathTuple = self._db.cursor.fetchall()
299
300 self.assertEquals(expPathTuple, obsPathTuple)
301
302
303 def test_insertList(self):
304 p1 = Path()
305 p1.setFromString( "1\tchr1\t1\t10\tTE1\t11\t17\t1e-20\t30\t90.2\n" )
306 p2 = Path()
307 p2.setFromString( "2\tchr1\t2\t9\tTE2\t10\t13\t1e-20\t30\t90.2\n" )
308 p3 = Path()
309 p3.setFromString( "2\tchr1\t12\t19\tTE2\t15\t22\t1e-10\t40\t94.2\n" )
310 p4 = Path()
311 p4.setFromString( "3\tchr2\t8\t13\tTE1\t11\t17\t1e-20\t30\t90.2\n" )
312 lPath = [ p1, p2, p3, p4]
313 self._db.createTable( self._table, "path" )
314 self._tpA.insertList(lPath)
315
316 tuple1 = (1L, "chr1", 1L, 10L, "TE1", 11L, 17L, 1e-20, 30L, 90.2)
317 tuple2 = (2L, "chr1", 2L, 9L, "TE2", 10L, 13L, 1e-20, 30L, 90.2)
318 tuple3 = (2L, "chr1", 12L, 19L, "TE2", 15L, 22L, 1e-10, 40L, 94.2)
319 tuple4 = (3L, "chr2", 8L, 13L, "TE1", 11L, 17L, 1e-20, 30L, 90.2)
320 expPathTuple = ( tuple1, tuple2, tuple3, tuple4)
321 sqlCmd = "SELECT * FROM %s" % ( self._table )
322 self._db.execute( sqlCmd )
323 obsPathTuple = self._db.cursor.fetchall()
324
325 self.assertEquals(expPathTuple, obsPathTuple)
326
327
328 def test_getIdListFromQuery( self ):
329 self._db.createTable( self._table, "path" )
330 p1 = Path()
331 p1.setFromString( "1\tchr1\t1\t10\tTE1\t11\t17\t1e-20\t30\t90.2\n" )
332 p2a = Path()
333 p2a.setFromString( "2\tchr1\t2\t9\tTE2\t10\t13\t1e-20\t30\t90.2\n" )
334 p2b = Path()
335 p2b.setFromString( "2\tchr1\t12\t19\tTE2\t15\t22\t1e-10\t40\t94.2\n" )
336 p3 = Path()
337 p3.setFromString( "3\tchr2\t8\t13\tTE1\t11\t17\t1e-20\t30\t90.2\n" )
338 for p in [ p1, p2a, p2b, p3 ]: self._tpA.insert( p )
339 lExp = [ 1, 2 ]
340 lObs = self._tpA.getIdListFromQuery( "chr1" )
341 self.assertEqual( lObs, lExp )
342
343
344 def test_getIdListFromSubject( self ):
345 self._db.createTable( self._table, "path" )
346 p1 = Path()
347 p1.setFromString( "1\tchr1\t1\t10\tTE1\t11\t17\t1e-20\t30\t90.2\n" )
348 p2a = Path()
349 p2a.setFromString( "2\tchr1\t2\t9\tTE2\t10\t13\t1e-20\t30\t90.2\n" )
350 p2b = Path()
351 p2b.setFromString( "2\tchr1\t12\t19\tTE2\t15\t22\t1e-10\t40\t94.2\n" )
352 p3 = Path()
353 p3.setFromString( "3\tchr2\t8\t13\tTE1\t11\t17\t1e-20\t30\t90.2\n" )
354 for p in [ p1, p2a, p2b, p3 ]: self._tpA.insert( p )
355 lExp = [ 2 ]
356 lObs = self._tpA.getIdListFromSubject( "TE2" )
357 self.assertEqual( lObs, lExp )
358
359
360 def test_getIdList( self ):
361 self._db.createTable( self._table, "path" )
362 p1 = Path()
363 p1.setFromString( "1\tchr1\t1\t10\tTE1\t11\t17\t1e-20\t30\t90.2\n" )
364 p2 = Path()
365 p2.setFromString( "2\tchr1\t2\t9\tTE2\t10\t13\t1e-20\t30\t90.2\n" )
366 p3 = Path()
367 p3.setFromString( "2\tchr1\t12\t19\tTE2\t15\t22\t1e-10\t40\t94.2\n" )
368 p4 = Path()
369 p4.setFromString( "3\tchr2\t8\t13\tTE1\t11\t17\t1e-20\t30\t90.2\n" )
370 lPath = [ p1, p2, p3, p4]
371 self._tpA.insertList(lPath)
372 expList = [ 1, 2, 3 ]
373 obsList = self._tpA.getIdList()
374 self.assertEqual( expList, obsList )
375
376
377 def test_getSubjectList( self ):
378 pathFileName = "dummyPathFile_%s" % ( self._uniqId )
379 pathF = open( pathFileName, "w" )
380 pathF.write("1\tchr1\t1\t10\tTE3\t11\t17\t1e-20\t30\t90.2\n")
381 pathF.write("2\tchr1\t2\t9\tTE2\t10\t13\t1e-20\t30\t90.2\n")
382 pathF.write("2\tchr1\t12\t19\tTE2\t15\t22\t1e-10\t40\t94.2\n")
383 pathF.write("3\tchr2\t8\t13\tTE1\t11\t17\t1e-20\t30\t90.2\n")
384 pathF.close()
385 self._db.createTable( self._table, "path", pathFileName )
386 expList = [ "TE1", "TE2", "TE3" ]
387 obsList = self._tpA.getSubjectList()
388 self.assertEqual( expList, obsList )
389 os.remove( pathFileName )
390
391
392 def test_getSubjectList_empty_table( self ):
393 self._db.createTable( self._table, "path" )
394 expList = []
395 obsList = self._tpA.getSubjectList()
396 self.assertEqual( obsList, expList )
397
398
399 def test_getQueryList( self ):
400 pathFileName = "dummyPathFile_%s" % ( self._uniqId )
401 pathF = open( pathFileName, "w" )
402 pathF.write("1\tchr1\t1\t10\tTE3\t11\t17\t1e-20\t30\t90.2\n")
403 pathF.write("2\tchr1\t2\t9\tTE2\t10\t13\t1e-20\t30\t90.2\n")
404 pathF.write("2\tchr1\t12\t19\tTE2\t15\t22\t1e-10\t40\t94.2\n")
405 pathF.write("3\tchr2\t8\t13\tTE1\t11\t17\t1e-20\t30\t90.2\n")
406 pathF.close()
407 self._db.createTable( self._table, "path", pathFileName )
408 expList = [ "chr1", "chr2" ]
409 obsList = self._tpA.getQueryList()
410 self.assertEqual( expList, obsList )
411 os.remove( pathFileName )
412
413
414 def test_getSubjectListFromQuery( self ):
415 pathFileName = "dummyPathFile_%s" % ( self._uniqId )
416 pathF = open( pathFileName, "w" )
417 pathF.write("1\tchr1\t1\t10\tTE3\t11\t17\t1e-20\t30\t90.2\n")
418 pathF.write("2\tchr1\t2\t9\tTE2\t10\t13\t1e-20\t30\t90.2\n")
419 pathF.write("2\tchr1\t12\t19\tTE2\t15\t22\t1e-10\t40\t94.2\n")
420 pathF.write("3\tchr2\t8\t13\tTE1\t11\t17\t1e-20\t30\t90.2\n")
421 pathF.close()
422 self._db.createTable( self._table, "path", pathFileName )
423 expList = [ "TE3", "TE2" ]
424 obsList = self._tpA.getSubjectListFromQuery( "chr1" )
425 self.assertEqual( expList, obsList )
426 os.remove( pathFileName )
427
428
429 def test_getSubjectListFromQuery_with_unexisted_query( self ):
430 pathFileName = "dummyPathFile_%s" % ( self._uniqId )
431 pathF = open( pathFileName, "w" )
432 pathF.write("1\tchr1\t1\t10\tTE3\t11\t17\t1e-20\t30\t90.2\n")
433 pathF.write("2\tchr1\t2\t9\tTE2\t10\t13\t1e-20\t30\t90.2\n")
434 pathF.write("2\tchr1\t12\t19\tTE2\t15\t22\t1e-10\t40\t94.2\n")
435 pathF.write("3\tchr2\t8\t13\tTE1\t11\t17\t1e-20\t30\t90.2\n")
436 pathF.close()
437 self._db.createTable( self._table, "path", pathFileName )
438 expList = []
439 obsList = self._tpA.getSubjectListFromQuery( "chr3" )
440 self.assertEqual( expList, obsList )
441 os.remove( pathFileName )
442
443
444 def test_getListOfAllPaths( self ):
445 self._db.createTable( self._table, "path" )
446 p1 = Path()
447 p1.setFromString( "1\tchr1\t1\t10\tTE3\t11\t17\t1e-20\t30\t85.2\n" )
448 p2a = Path()
449 p2a.setFromString( "2\tchr1\t2\t9\tTE2\t10\t13\t1e-20\t30\t90.5\n" )
450 p2b = Path()
451 p2b.setFromString( "2\tchr1\t12\t19\tTE2\t15\t22\t1e-10\t40\t89.5\n" )
452 lPaths = [ p1, p2a, p2b ]
453 self._tpA.insertList( lPaths )
454 expList = [ p1, p2a, p2b ]
455 obsList = self._tpA.getListOfAllPaths()
456 self.assertEqual( expList, obsList )
457
458
459 def test_getListOfAllPaths_empty_table( self ):
460 self._db.createTable( self._table, "path" )
461 expList = []
462 obsList = self._tpA.getListOfAllPaths()
463 self.assertEqual( expList, obsList )
464
465
466 def test_getPathListWithDirectQueryDirectSubjectFromQuerySubject( self ):
467 self._db.createTable( self._table, "path" )
468 p1 = Path()
469 p1.setFromString( "1\tchr1\t1\t100\tTE1\t11\t110\t1e-20\t130\t85.2\n" )
470 p2 = Path()
471 p2.setFromString( "2\tchr2\t1\t100\tTE1\t11\t110\t1e-20\t130\t85.2\n" ) # different query
472 p3 = Path()
473 p3.setFromString( "3\tchr1\t1\t100\tTE2\t11\t110\t1e-20\t130\t85.2\n" ) # different subject
474 p4 = Path()
475 p4.setFromString( "4\tchr1\t100\t1\tTE1\t11\t110\t1e-20\t130\t85.2\n" ) # query on reverse strand
476 p5 = Path()
477 p5.setFromString( "5\tchr1\t1\t100\tTE1\t110\t11\t1e-20\t130\t85.2\n" ) # subject on reverse strand
478 p6 = Path()
479 p6.setFromString( "6\tchr1\t301\t400\tTE1\t11\t110\t1e-20\t130\t85.2\n" ) # further along the query
480 for p in [ p1, p2, p3, p4, p5, p6 ]: self._tpA.insert( p )
481 expList = [ p1, p6 ]
482 obsList = self._tpA.getPathListWithDirectQueryDirectSubjectFromQuerySubject( "chr1", "TE1" )
483 self.assertEqual( expList, obsList )
484
485
486 def test_getPathListWithDirectQueryReverseSubjectFromQuerySubject( self ):
487 self._db.createTable( self._table, "path" )
488 p1 = Path()
489 p1.setFromString( "1\tchr1\t1\t100\tTE1\t110\t11\t1e-20\t130\t85.2\n" )
490 p2 = Path()
491 p2.setFromString( "2\tchr2\t1\t100\tTE1\t110\t11\t1e-20\t130\t85.2\n" ) # different query
492 p3 = Path()
493 p3.setFromString( "3\tchr1\t1\t100\tTE2\t110\t11\t1e-20\t130\t85.2\n" ) # different subject
494 p4 = Path()
495 p4.setFromString( "4\tchr1\t100\t1\tTE1\t110\t11\t1e-20\t130\t85.2\n" ) # query on reverse strand
496 p5 = Path()
497 p5.setFromString( "5\tchr1\t1\t100\tTE1\t11\t110\t1e-20\t130\t85.2\n" ) # subject on direct strand
498 p6 = Path()
499 p6.setFromString( "6\tchr1\t301\t400\tTE1\t110\t11\t1e-20\t130\t85.2\n" ) # further along the query
500 for p in [ p1, p2, p3, p4, p5, p6 ]: self._tpA.insert( p )
501 lExp = [ p1, p6 ]
502 lObs = self._tpA.getPathListWithDirectQueryReverseSubjectFromQuerySubject( "chr1", "TE1" )
503 self.assertEqual( lObs, lExp )
504
505
506 def test_isEmpty( self ):
507 self._db.createTable( self._table, "path" )
508 obs = self._tpA.isEmpty()
509 self.assertTrue( obs )
510 p = Path()
511 p.setFromTuple( ( "1", "qry1", "1", "100", "sbj1", "1", "100", "1e-32", "164", "97.5" ) )
512 self._tpA.insert( p )
513 obs = self._tpA.isEmpty()
514 self.assertFalse( obs )
515
516
517 def test_getNbPathsFromQuery( self ):
518 self._db.createTable( self._table, "path" )
519 p1a = Path()
520 p1a.setFromTuple( ( "1", "qry1", "1", "100", "sbj1", "1", "100", "1e-32", "164", "97.5" ) )
521 p1b = Path()
522 p1b.setFromTuple( ( "1", "qry1", "111", "200", "sbj1", "101", "190", "1e-32", "164", "97.5" ) )
523 p2 = Path()
524 p2.setFromTuple( ( "2", "qry1", "2001", "2200", "sbj3", "1", "200", "1e-76", "247", "96.2" ) )
525 p3 = Path()
526 p3.setFromTuple( ( "3", "qry2", "1", "350", "sbj1", "1", "350", "1e-43", "624", "98.1" ) )
527 lPaths = [ p1a, p1b, p2, p3 ]
528 self._tpA.insertList( lPaths )
529 expNb = 3
530 obsNb = self._tpA.getNbPathsFromQuery( "qry1" )
531 self.assertEqual( expNb, obsNb )
532
533
534 def test_getNbPathsFromQuery_unexisted_query( self ):
535 self._db.createTable( self._table, "path" )
536 p1a = Path()
537 p1a.setFromTuple( ( "1", "qry1", "1", "100", "sbj1", "1", "100", "1e-32", "164", "97.5" ) )
538 p1b = Path()
539 p1b.setFromTuple( ( "1", "qry1", "111", "200", "sbj1", "101", "190", "1e-32", "164", "97.5" ) )
540 p2 = Path()
541 p2.setFromTuple( ( "2", "qry1", "2001", "2200", "sbj3", "1", "200", "1e-76", "247", "96.2" ) )
542 p3 = Path()
543 p3.setFromTuple( ( "3", "qry2", "1", "350", "sbj1", "1", "350", "1e-43", "624", "98.1" ) )
544 lPaths = [ p1a, p1b, p2, p3 ]
545 self._tpA.insertList( lPaths )
546 expNb = 0
547 obsNb = self._tpA.getNbPathsFromQuery( "qry3" )
548 self.assertEqual( expNb, obsNb )
549
550
551 def test_getNbPathsFromSubject( self ):
552 self._db.createTable( self._table, "path" )
553 p1a = Path()
554 p1a.setFromTuple( ( "1", "qry1", "1", "100", "sbj1", "1", "100", "1e-32", "164", "97.5" ) )
555 p1b = Path()
556 p1b.setFromTuple( ( "1", "qry1", "111", "200", "sbj1", "101", "190", "1e-32", "164", "97.5" ) )
557 p2 = Path()
558 p2.setFromTuple( ( "2", "qry1", "2001", "2200", "sbj3", "1", "200", "1e-76", "247", "96.2" ) )
559 p3 = Path()
560 p3.setFromTuple( ( "3", "qry2", "1", "350", "sbj1", "1", "350", "1e-43", "624", "98.1" ) )
561 lPaths = [ p1a, p1b, p2, p3 ]
562 self._tpA.insertList( lPaths )
563 expNb = 3
564 obsNb = self._tpA.getNbPathsFromSubject( "sbj1" )
565 self.assertEqual( expNb, obsNb )
566
567
568 def test_getNbPathsFromSubject_unexisted_subject( self ):
569 self._db.createTable( self._table, "path" )
570 p1a = Path()
571 p1a.setFromTuple( ( "1", "qry1", "1", "100", "sbj1", "1", "100", "1e-32", "164", "97.5" ) )
572 p1b = Path()
573 p1b.setFromTuple( ( "1", "qry1", "111", "200", "sbj1", "101", "190", "1e-32", "164", "97.5" ) )
574 p2 = Path()
575 p2.setFromTuple( ( "2", "qry1", "2001", "2200", "sbj3", "1", "200", "1e-76", "247", "96.2" ) )
576 p3 = Path()
577 p3.setFromTuple( ( "3", "qry2", "1", "350", "sbj1", "1", "350", "1e-43", "624", "98.1" ) )
578 lPaths = [ p1a, p1b, p2, p3 ]
579 self._tpA.insertList( lPaths )
580 expNb = 0
581 obsNb = self._tpA.getNbPathsFromSubject( "qry1" )
582 self.assertEqual( expNb, obsNb )
583
584
585 def test_getNbIds( self ):
586 self._db.createTable( self._table, "path" )
587 p1a = Path()
588 p1a.setFromTuple( ( "1", "qry1", "1", "100", "sbj1", "1", "100", "1e-32", "164", "97.5" ) )
589 p1b = Path()
590 p1b.setFromTuple( ( "1", "qry1", "111", "200", "sbj1", "101", "190", "1e-32", "164", "97.5" ) )
591 p2 = Path()
592 p2.setFromTuple( ( "2", "qry1", "2001", "2200", "sbj3", "1", "200", "1e-76", "247", "96.2" ) )
593 p3 = Path()
594 p3.setFromTuple( ( "3", "qry2", "1", "350", "sbj1", "1", "350", "1e-43", "624", "98.1" ) )
595 for p in [ p1a, p1b, p2, p3 ]: self._tpA.insert( p )
596 exp = 3
597 obs = self._tpA.getNbIds()
598 self.assertEqual( obs, exp )
599
600
601 def test_getNbIdsFromSubject( self ):
602 self._db.createTable( self._table, "path" )
603 p1 = Path()
604 p1.setFromTuple( ( "1", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
605 self._tpA.insert( p1 )
606 p2 = Path()
607 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj1", "1", "150", "0.0", "187", "97.2" ) )
608 self._tpA.insert( p2 )
609
610 expNb = 2
611 obsNb = self._tpA.getNbIdsFromSubject( "sbj1" )
612 self.assertEqual( expNb, obsNb )
613
614
615 def test_getNbIdsFromSubject_unexisted_subject( self ):
616 self._db.createTable( self._table, "path" )
617 p1 = Path()
618 p1.setFromTuple( ( "1", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
619 self._tpA.insert( p1 )
620 p2 = Path()
621 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj1", "1", "150", "0.0", "187", "97.2" ) )
622 self._tpA.insert( p2 )
623
624 expNb = 0
625 obsNb = self._tpA.getNbIdsFromSubject( "sbj2" )
626 self.assertEqual( expNb, obsNb )
627
628
629 def test_getNbIdsFromQuery( self ):
630 self._db.createTable( self._table, "path" )
631 p1 = Path()
632 p1.setFromTuple( ( "1", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
633 self._tpA.insert( p1 )
634 p2 = Path()
635 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj2", "1", "150", "0.0", "187", "97.2" ) )
636 self._tpA.insert( p2 )
637
638 expNb = 2
639 obsNb = self._tpA.getNbIdsFromQuery( "qry1" )
640 self.assertEqual( expNb, obsNb )
641
642
643 def test_getNbIdsFromQuery_unexisted_query( self ):
644 self._db.createTable( self._table, "path" )
645 p1 = Path()
646 p1.setFromTuple( ( "1", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
647 self._tpA.insert( p1 )
648 p2 = Path()
649 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj2", "1", "150", "0.0", "187", "97.2" ) )
650 self._tpA.insert( p2 )
651
652 expNb = 0
653 obsNb = self._tpA.getNbIdsFromQuery( "qry2" )
654 self.assertEqual( expNb, obsNb )
655
656
657 def test_getPathListIncludedInQueryCoord_included( self ):
658 self._db.createTable( self._table, "path" )
659 p = Path()
660 p.setFromTuple( ( "1", "qry1", "123", "184", "sbj1", "1", "63", "0.0", "75", "97.5" ) )
661 self._tpA.insert( p )
662 p2 = Path()
663 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj2", "1", "150", "0.0", "187", "97.2" ) )
664 self._tpA.insert( p2 )
665 expList = [ p ]
666 obsList = self._tpA.getPathListIncludedInQueryCoord( "qry1", 100, 200 )
667 self.assertEqual( expList, obsList )
668
669
670 def test_getPathListIncludedInQueryCoord_included_start_higher_than_end( self ):
671 self._db.createTable( self._table, "path" )
672 p = Path()
673 p.setFromTuple( ( "1", "qry1", "123", "184", "sbj1", "1", "63", "0.0", "75", "97.5" ) )
674 self._tpA.insert( p )
675 p2 = Path()
676 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj2", "1", "150", "0.0", "187", "97.2" ) )
677 self._tpA.insert( p2 )
678 expList = [ p ]
679 obsList = self._tpA.getPathListIncludedInQueryCoord( "qry1", 200, 100 )
680 self.assertEqual( expList, obsList )
681
682
683 def test_getPathListIncludedInQueryCoord_overlapping( self ):
684 self._db.createTable( self._table, "path" )
685 p = Path()
686 p.setFromTuple( ( "1", "qry1", "83", "184", "sbj1", "1", "103", "0.0", "137", "96.5" ) )
687 self._tpA.insert( p )
688 p2 = Path()
689 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj2", "1", "150", "0.0", "187", "97.2" ) )
690 self._tpA.insert( p2 )
691 expList = []
692 obsList = self._tpA.getPathListIncludedInQueryCoord( "qry1", 100, 200 )
693 self.assertEqual( expList, obsList )
694
695
696 def test_getPathListOverlappingQueryCoord(self):
697 self._db.createTable( self._table, "path" )
698 p1 = Path()
699 p1.setFromTuple( ( "1", "qry1", "83", "184", "sbj1", "1", "103", "0.0", "137", "96.5" ) )
700 p2 = Path()
701 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj2", "1", "150", "0.0", "187", "97.2" ) )
702 p3 = Path()
703 p3.setFromTuple( ( "3", "qry1", "1", "350", "sbj1", "1", "350", "1e-43", "624", "98.1" ) )
704 lPath = [ p1, p2, p3 ]
705 self._tpA.insertList(lPath)
706 expList = [ p1, p3 ]
707 obsList = self._tpA.getPathListOverlappingQueryCoord( "qry1", 100, 200 )
708 self.assertEqual( expList, obsList )
709
710
711 def test_getPathListOverlappingQueryCoord_no_overlapping_and_start_higher_than_end(self):
712 self._db.createTable( self._table, "path" )
713 p1 = Path()
714 p1.setFromTuple( ( "1", "qry1", "83", "184", "sbj1", "1", "103", "0.0", "137", "96.5" ) )
715 p2 = Path()
716 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj2", "1", "150", "0.0", "187", "97.2" ) )
717 p3 = Path()
718 p3.setFromTuple( ( "3", "qry2", "1", "350", "sbj1", "1", "350", "1e-43", "624", "98.1" ) )
719 lPath = [ p1, p2, p3 ]
720 self._tpA.insertList(lPath)
721 expList = []
722 obsList = self._tpA.getPathListOverlappingQueryCoord( "qry1", 80, 1 )
723 self.assertEqual( expList, obsList )
724
725
726 def test_getPathListOverlappingQueryCoord_withChains(self):
727 self._db.createTable( self._table, "path" )
728 p1 = Path()
729 p1.setFromTuple( ( "1", "qry1", "83", "184", "sbj1", "1", "103", "0.0", "137", "96.5" ) )
730 p2a = Path()
731 p2a.setFromTuple( ( "2", "qry1", "1", "150", "sbj2", "1", "150", "0.0", "187", "97.2" ) )
732 p2b = Path()
733 p2b.setFromTuple( ( "2", "qry1", "251", "350", "sbj1", "151", "250", "1e-43", "624", "98.1" ) )
734 lPath = [ p1, p2a, p2b ]
735 self._tpA.insertList(lPath)
736 expList = [ p1, p2a ]
737 obsList = self._tpA.getPathListOverlappingQueryCoord( "qry1", 100, 200 )
738 self.assertEqual( expList, obsList )
739
740
741 def test_getChainListOverlappingQueryCoord(self):
742 self._db.createTable( self._table, "path" )
743 p1 = Path()
744 p1.setFromTuple( ( "1", "qry1", "83", "184", "sbj1", "1", "103", "0.0", "137", "96.5" ) )
745 p2a = Path()
746 p2a.setFromTuple( ( "2", "qry1", "1", "150", "sbj2", "1", "150", "0.0", "187", "97.2" ) )
747 p2b = Path()
748 p2b.setFromTuple( ( "2", "qry1", "251", "350", "sbj1", "151", "250", "1e-43", "624", "98.1" ) )
749 lPath = [ p1, p2a, p2b ]
750 self._tpA.insertList(lPath)
751 expList = [ p1, p2a, p2b ]
752 obsList = self._tpA.getChainListOverlappingQueryCoord( "qry1", 100, 200 )
753 self.assertEqual( expList, obsList )
754
755
756 def test_getSetListOverlappingQueryCoord(self):
757 self._db.createTable( self._table, "path" )
758 p1 = Path()
759 p1.setFromTuple( ( "1", "qry1", "83", "184", "sbj1", "1", "103", "0.0", "137", "96.5" ) )
760 p2 = Path()
761 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj2", "1", "150", "0.0", "187", "97.2" ) )
762 p3 = Path()
763 p3.setFromTuple( ( "3", "qry1", "1", "350", "sbj2", "1", "350", "1e-43", "624", "98.1" ) )
764 lPath = [ p1, p2, p3 ]
765 self._tpA.insertList(lPath)
766
767 set1 = Set()
768 set1.setFromTuple( ( "1", "sbj1", "qry1", "83", "184" ) )
769 set3 = Set()
770 set3.setFromTuple( ( "3", "sbj2", "qry1", "1", "350" ) )
771 expList = [ set1, set3 ]
772 obsList = self._tpA.getSetListOverlappingQueryCoord( "qry1", 100, 200 )
773 self.assertEqual( expList, obsList )
774
775
776 def test_getSetListOverlappingQueryCoord_no_overlapping_and_start_higher_than_end(self):
777 self._db.createTable( self._table, "path" )
778 p1 = Path()
779 p1.setFromTuple( ( "1", "qry1", "83", "184", "sbj1", "1", "103", "0.0", "137", "96.5" ) )
780 p2 = Path()
781 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj2", "1", "150", "0.0", "187", "97.2" ) )
782 p3 = Path()
783 p3.setFromTuple( ( "3", "qry2", "1", "350", "sbj1", "1", "350", "1e-43", "624", "98.1" ) )
784 lPath = [ p1, p2, p3 ]
785 self._tpA.insertList(lPath)
786 expList = []
787 obsList = self._tpA.getSetListOverlappingQueryCoord( "qry1", 80, 1 )
788 self.assertEqual( expList, obsList )
789
790
791 def test_getSetListIncludedInQueryCoord(self):
792 self._db.createTable( self._table, "path" )
793 p1 = Path()
794 p1.setFromTuple( ( "1", "qry1", "102", "184", "sbj1", "1", "103", "0.0", "137", "96.5" ) )
795 p2 = Path()
796 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj2", "1", "150", "0.0", "187", "97.2" ) )
797 p3 = Path()
798 p3.setFromTuple( ( "3", "qry1", "1", "350", "sbj2", "1", "350", "1e-43", "624", "98.1" ) )
799 lPath = [ p1, p2, p3 ]
800 self._tpA.insertList(lPath)
801
802 set1 = Set()
803 set1.setFromTuple( ( "1", "sbj1", "qry1", "102", "184" ) )
804 expList = [ set1 ]
805 obsList = self._tpA.getSetListIncludedInQueryCoord( "qry1", 100, 200 )
806 self.assertEqual( expList, obsList )
807
808
809 def test_getSetListIncludedInQueryCoord_no_including_and_start_higher_than_end(self):
810 self._db.createTable( self._table, "path" )
811 p1 = Path()
812 p1.setFromTuple( ( "1", "qry1", "83", "184", "sbj1", "1", "103", "0.0", "137", "96.5" ) )
813 p2 = Path()
814 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj2", "1", "150", "0.0", "187", "97.2" ) )
815 p3 = Path()
816 p3.setFromTuple( ( "3", "qry2", "1", "350", "sbj1", "1", "350", "1e-43", "624", "98.1" ) )
817 lPath = [ p1, p2, p3 ]
818 self._tpA.insertList(lPath)
819 expList = []
820 obsList = self._tpA.getSetListIncludedInQueryCoord( "qry1", 80, 1 )
821 self.assertEqual( expList, obsList )
822
823
824 def test_getPathListSortedByQueryCoord( self ):
825 self._db.createTable( self._table, "path" )
826 p1 = Path()
827 p1.setFromTuple( ( "3", "qry2", "101", "200", "sbj3", "1", "100", "0.0", "137", "96.5" ) )
828 self._tpA.insert( p1 )
829 p2 = Path()
830 p2.setFromTuple( ( "2", "qry1", "151", "500", "sbj1", "1", "350", "0.0", "137", "96.5" ) )
831 self._tpA.insert( p2 )
832 p3 = Path()
833 p3.setFromTuple( ( "1", "qry1", "1", "200", "sbj3", "1", "200", "0.0", "137", "96.5" ) )
834 self._tpA.insert( p3 )
835
836 expList = [ p3, p2, p1 ]
837 obsList = self._tpA.getPathListSortedByQueryCoord()
838 self.assertEqual( expList, obsList )
839
840
841 def test_getPathListSortedByQueryCoordFromQuery( self ):
842 self._db.createTable( self._table, "path" )
843 p1 = Path()
844 p1.setFromTuple( ( "3", "qry2", "101", "200", "sbj3", "1", "100", "0.0", "137", "96.5" ) )
845 self._tpA.insert( p1 )
846 p2 = Path()
847 p2.setFromTuple( ( "2", "qry1", "151", "500", "sbj1", "1", "350", "0.0", "137", "96.5" ) )
848 self._tpA.insert( p2 )
849 p3 = Path()
850 p3.setFromTuple( ( "1", "qry1", "1", "200", "sbj3", "1", "200", "0.0", "137", "96.5" ) )
851 self._tpA.insert( p3 )
852
853 expList = [ p3, p2 ]
854 obsList = self._tpA.getPathListSortedByQueryCoordFromQuery( "qry1" )
855 self.assertEqual( expList, obsList )
856
857 def test_getPathListSortedByQueryCoordAndScoreFromQuery( self ):
858 self._db.createTable( self._table, "path" )
859 p1 = Path()
860 p1.setFromTuple( ( "3", "qry2", "101", "200", "sbj3", "1", "100", "0.0", "137", "96.5" ) )
861 self._tpA.insert( p1 )
862 p2 = Path()
863 p2.setFromTuple( ( "2", "qry1", "151", "500", "sbj1", "1", "350", "0.0", "137", "96.5" ) )
864 self._tpA.insert( p2 )
865 p3 = Path()
866 p3.setFromTuple( ( "1", "qry1", "1", "200", "sbj3", "1", "200", "0.0", "137", "96.5" ) )
867 self._tpA.insert( p3 )
868 p4 = Path()
869 p4.setFromTuple( ( "4", "qry1", "1", "200", "sbj3", "1", "200", "0.0", "200", "96.5" ) )
870 self._tpA.insert( p4 )
871
872 expList = [ p3, p4, p2 ]
873 obsList = self._tpA.getPathListSortedByQueryCoordAndScoreFromQuery( "qry1" )
874 self.assertEqual( expList, obsList )
875
876
877 def test_getCumulLengthFromSubject( self ):
878 self._db.createTable( self._table, "path" )
879 p1 = Path()
880 p1.setFromTuple( ( "1", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
881 self._tpA.insert( p1 )
882 p2 = Path()
883 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj1", "1", "150", "0.0", "187", "97.2" ) )
884 self._tpA.insert( p2 )
885
886 exp = 250
887 obs = self._tpA.getCumulLengthFromSubject( "sbj1" )
888 self.assertEqual( obs, exp )
889
890
891 def test_getCumulLengthFromSubject_with_no_subject( self ):
892 self._db.createTable( self._table, "path" )
893 p1 = Path()
894 p1.setFromTuple( ( "1", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
895 self._tpA.insert( p1 )
896 p2 = Path()
897 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj1", "1", "150", "0.0", "187", "97.2" ) )
898 self._tpA.insert( p2 )
899
900 exp = 0
901 obs = self._tpA.getCumulLengthFromSubject( "sbj2" )
902 self.assertEqual( obs, exp )
903
904
905 def test_getChainLengthListFromSubject( self ):
906 self._db.createTable( self._table, "path" )
907 p1 = Path()
908 p1.setFromTuple( ( "1", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
909 self._tpA.insert( p1 )
910 p2 = Path()
911 p2.setFromTuple( ( "1", "qry1", "351", "500", "sbj1", "101", "250", "0.0", "187", "97.2" ) )
912 self._tpA.insert( p2 )
913 p3 = Path()
914 p3.setFromTuple( ( "2", "qry1", "801", "900", "sbj1", "1", "100", "0.0", "187", "97.2" ) )
915 self._tpA.insert( p3 )
916 p4 = Path()
917 p4.setFromTuple( ( "3", "qry1", "1900", "1801", "sbj1", "1", "100", "0.0", "187", "97.2" ) )
918 self._tpA.insert( p4 )
919 p5 = Path()
920 p5.setFromTuple( ( "4", "qry1", "1801", "1900", "sbj1", "100", "1", "0.0", "187", "97.2" ) )
921 self._tpA.insert( p5 )
922
923 expList = [ 250, 100, 100, 100 ]
924 obsList = self._tpA.getChainLengthListFromSubject( "sbj1" )
925 self.assertEqual( expList, obsList )
926
927
928 def test_getChainIdentityListFromSubject( self ):
929 self._db.createTable( self._table, "path" )
930 p1 = Path()
931 p1.setFromTuple( ( "1", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
932 self._tpA.insert( p1 )
933 p2 = Path()
934 p2.setFromTuple( ( "1", "qry1", "351", "500", "sbj1", "101", "250", "0.0", "187", "97.2" ) )
935 self._tpA.insert( p2 )
936 p3 = Path()
937 p3.setFromTuple( ( "2", "qry1", "801", "900", "sbj1", "1", "100", "0.0", "187", "94.3" ) )
938 self._tpA.insert( p3 )
939
940 idChain1 = ( 98.5*(200-101+1) + 97.2*(500-351+1) ) / float(200-101+1+500-351+1)
941 idChain2 = 94.3*(900-801+1) / float(900-801+1)
942 expList = [ idChain1, idChain2 ]
943 obsList = self._tpA.getChainIdentityListFromSubject( "sbj1" )
944 self.assertEqual( expList, obsList )
945
946
947 def test_getPathLengthListFromSubject( self ):
948 self._db.createTable( self._table, "path" )
949 p1 = Path()
950 p1.setFromTuple( ( "1", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
951 self._tpA.insert( p1 )
952 p2 = Path()
953 p2.setFromTuple( ( "1", "qry1", "351", "500", "sbj1", "101", "250", "0.0", "187", "97.2" ) )
954 self._tpA.insert( p2 )
955 p3 = Path()
956 p3.setFromTuple( ( "2", "qry1", "801", "900", "sbj1", "1", "100", "0.0", "187", "97.2" ) )
957 self._tpA.insert( p3 )
958
959 expList = [ 100, 150, 100 ]
960 obsList = self._tpA.getPathLengthListFromSubject( "sbj1" )
961 self.assertEqual( expList, obsList )
962
963
964 def test_getIdListSortedByDecreasingChainLengthFromSubject( self ):
965 self._db.createTable( self._table, "path" )
966 p1 = Path()
967 p1.setFromTuple( ( "1", "qry1", "101", "200", "sbj1", "1", "100", "0.0847", "100", "97.2" ) )
968 self._tpA.insert( p1 )
969 p2a = Path()
970 p2a.setFromTuple( ( "2", "qry1", "351", "500", "sbj1", "1", "150", "0.0035", "100", "97.2" ) )
971 self._tpA.insert( p2a )
972 p2b = Path()
973 p2b.setFromTuple( ( "2", "qry1", "551", "700", "sbj1", "151", "300", "0.0098", "100", "97.2" ) )
974 self._tpA.insert( p2b )
975 p3 = Path()
976 p3.setFromTuple( ( "3", "qry2", "541", "800", "sbj1", "1", "260", "0.147", "100", "97.2" ) )
977 self._tpA.insert( p3 )
978
979 expList = [ 2, 3, 1 ]
980 obsList = self._tpA.getIdListSortedByDecreasingChainLengthFromSubject( "sbj1" )
981
982 self.assertEqual( expList, obsList )
983
984
985 def test_getIdListFromSubjectWhereChainsLongerThanThreshold( self ):
986 self._db.createTable( self._table, "path" )
987 p1 = Path()
988 p1.setFromTuple( ( "1", "qry1", "1", "100", "sbj1", "1", "100", "0.0847", "100", "97.2" ) ) # 1-fragment copy, long enough
989 self._tpA.insert( p1 )
990 p2a = Path()
991 p2a.setFromTuple( ( "2", "qry2", "1", "50", "sbj1", "1", "50", "0.0035", "100", "97.2" ) )
992 self._tpA.insert( p2a )
993 p2b = Path()
994 p2b.setFromTuple( ( "2", "qry2", "101", "150", "sbj1", "51", "100", "0.0098", "100", "97.2" ) ) # 2-fragment copy, long enough
995 self._tpA.insert( p2b )
996 p3 = Path()
997 p3.setFromTuple( ( "3", "qry3", "1", "80", "sbj1", "1", "80", "0.147", "100", "97.2" ) ) # 1-fragment copy, too short
998 self._tpA.insert( p3 )
999 p4a = Path()
1000 p4a.setFromTuple( ( "4", "qry4", "1", "30", "sbj1", "1", "30", "0.0035", "100", "97.2" ) )
1001 self._tpA.insert( p4a )
1002 p4b = Path()
1003 p4b.setFromTuple( ( "4", "qry4", "101", "150", "sbj1", "31", "80", "0.0098", "100", "97.2" ) ) # 2-fragment copy, too short
1004 self._tpA.insert( p4b )
1005
1006 exp = [ 1, 2 ]
1007 obs = self._tpA.getIdListFromSubjectWhereChainsLongerThanThreshold( "sbj1", 90 )
1008
1009 self.assertEqual( exp, obs )
1010
1011
1012 def test_getSetListFromQuery(self):
1013 self._db.createTable( self._table, "path" )
1014 p1 = Path()
1015 p1.setFromTuple( ( "1", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
1016 self._tpA.insert( p1 )
1017 p2 = Path()
1018 p2.setFromTuple( ( "1", "qry1", "351", "500", "sbj1", "101", "250", "0.0", "187", "97.2" ) )
1019 self._tpA.insert( p2 )
1020 p3 = Path()
1021 p3.setFromTuple( ( "2", "qry1", "801", "900", "sbj1", "1", "100", "0.0", "187", "97.2" ) )
1022 self._tpA.insert( p3 )
1023
1024 set1 = Set()
1025 set1.setFromTuple( ( "1", "sbj1", "qry1", "101", "200" ) )
1026 set2 = Set()
1027 set2.setFromTuple( ( "1", "sbj1", "qry1", "351", "500" ) )
1028 set3 = Set()
1029 set3.setFromTuple( ( "2", "sbj1", "qry1", "801", "900" ) )
1030 expList = [set1, set2, set3]
1031 obsList = self._tpA.getSetListFromQuery("qry1")
1032 self.assertEqual( expList, obsList )
1033
1034
1035 def test_deleteFromId(self):
1036 self._db.createTable( self._table, "path" )
1037 p1 = Path()
1038 p1.setFromTuple( ( "1", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
1039 self._tpA.insert( p1 )
1040 p2 = Path()
1041 p2.setFromTuple( ( "1", "qry1", "351", "500", "sbj1", "101", "250", "0.0", "187", "97.2" ) )
1042 self._tpA.insert( p2 )
1043 p3 = Path()
1044 p3.setFromTuple( ( "2", "qry1", "801", "900", "sbj1", "1", "100", "0.0", "187", "97.2" ) )
1045 self._tpA.insert( p3 )
1046
1047 self._tpA.deleteFromId(2)
1048 expList = [p1, p2]
1049 obsList = self._tpA.getListOfAllPaths()
1050 self.assertEqual( expList, obsList )
1051
1052
1053 def test_deleteFromPath(self):
1054 self._db.createTable( self._table, "path" )
1055 p1 = Path()
1056 p1.setFromTuple( ( "1", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
1057 self._tpA.insert( p1 )
1058 p2 = Path()
1059 p2.setFromTuple( ( "1", "qry1", "351", "500", "sbj1", "101", "250", "0.0", "187", "97.2" ) )
1060 self._tpA.insert( p2 )
1061 p3 = Path()
1062 p3.setFromTuple( ( "2", "qry1", "801", "900", "sbj1", "1", "100", "0.0", "187", "97.2" ) )
1063 self._tpA.insert( p3 )
1064
1065 self._tpA.deleteFromPath(p3)
1066 expList = [p1, p2]
1067 obsList = self._tpA.getListOfAllPaths()
1068 self.assertEqual( expList, obsList )
1069
1070 def test_deleteFromPath_two_lines_to_delete(self):
1071 self._db.createTable( self._table, "path" )
1072 p1 = Path()
1073 p1.setFromTuple( ( "1", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
1074 self._tpA.insert( p1 )
1075 p2 = Path()
1076 p2.setFromTuple( ( "1", "qry1", "351", "500", "sbj1", "101", "250", "0.0", "187", "97.2" ) )
1077 self._tpA.insert( p2 )
1078 p3 = Path()
1079 p3.setFromTuple( ( "2", "qry1", "801", "900", "sbj1", "1", "100", "0.0", "187", "97.2" ) )
1080 self._tpA.insert( p3 )
1081 p4 = Path()
1082 p4.setFromTuple( ( "2", "qry1", "801", "900", "sbj1", "1", "100", "0.0", "187", "97.2" ) )
1083 self._tpA.insert( p4 )
1084
1085 self._tpA.deleteFromPath(p3)
1086 expList = [p1, p2]
1087 obsList = self._tpA.getListOfAllPaths()
1088 self.assertEqual( expList, obsList )
1089
1090
1091 def test_deleteFromIdList(self):
1092 self._db.createTable( self._table, "path" )
1093 p1 = Path()
1094 p1.setFromTuple( ( "1", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
1095 self._tpA.insert( p1 )
1096 p2 = Path()
1097 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj1", "101", "250", "0.0", "187", "97.2" ) )
1098 self._tpA.insert( p2 )
1099 p3 = Path()
1100 p3.setFromTuple( ( "3", "qry1", "801", "900", "sbj1", "1", "100", "0.0", "187", "97.2" ) )
1101 self._tpA.insert( p3 )
1102 lId = [ 1, 2 ]
1103 self._tpA.deleteFromIdList(lId)
1104 expList = [ p3 ]
1105 obsList = self._tpA.getListOfAllPaths()
1106 self.assertEqual( expList, obsList )
1107
1108
1109 def test_joinTwoPaths(self):
1110 self._db.createTable( self._table, "path" )
1111
1112 idPath1 = 5
1113 p1 = Path()
1114 p1.setFromTuple( ( "5", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
1115
1116 idPath2 = 2
1117 p2 = Path()
1118 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj1", "101", "250", "0.0", "187", "97.2" ) )
1119
1120 lPath = [ p1, p2 ]
1121 self._tpA.insertList( lPath )
1122
1123 self._tpA.joinTwoPaths(idPath1, idPath2)
1124
1125 expP1 = Path()
1126 expP1.setFromTuple( ( "2", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
1127 expP2 = Path()
1128 expP2.setFromTuple( ( "2", "qry1", "351", "500", "sbj1", "101", "250", "0.0", "187", "97.2" ) )
1129
1130 expList = [ expP1, expP2 ]
1131 obsList = self._tpA.getListOfAllPaths()
1132
1133 self.assertEqual( expList, obsList)
1134 self._db.dropTable(self._table)
1135
1136
1137 def test_joinTwoPaths_with_id1_inferior_at_id2(self):
1138 self._db.createTable( self._table, "path" )
1139
1140 idPath1 = 5
1141 p1 = Path()
1142 p1.setFromTuple( ( "5", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
1143
1144 idPath2 = 2
1145 p2 = Path()
1146 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj1", "101", "250", "0.0", "187", "97.2" ) )
1147
1148 lPath = [ p1, p2 ]
1149 self._tpA.insertList( lPath )
1150
1151 self._tpA.joinTwoPaths(idPath2, idPath1)
1152
1153 expP1 = Path()
1154 expP1.setFromTuple( ( "2", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
1155 expP2 = Path()
1156 expP2.setFromTuple( ( "2", "qry1", "351", "500", "sbj1", "101", "250", "0.0", "187", "97.2" ) )
1157
1158 expList = [ expP1, expP2 ]
1159 obsList = self._tpA.getListOfAllPaths()
1160
1161 self.assertEqual( expList, obsList)
1162 self._db.dropTable(self._table)
1163
1164
1165 def test_getNewId(self):
1166 self._db.createTable( self._table, "path" )
1167 p1 = Path()
1168 p1.setFromTuple( ( "1", "qry1", "101", "200", "sbj1", "1", "100", "0.0", "137", "98.5" ) )
1169 self._tpA.insert( p1 )
1170 p2 = Path()
1171 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj1", "101", "250", "0.0", "187", "97.2" ) )
1172 self._tpA.insert( p2 )
1173 p3 = Path()
1174 p3.setFromTuple( ( "3", "qry1", "801", "900", "sbj1", "1", "100", "0.0", "187", "97.2" ) )
1175 self._tpA.insert( p3 )
1176
1177 expId = 4
1178 obsId = self._tpA.getNewId()
1179 self.assertEqual( expId, obsId)
1180
1181
1182 def test_getNewId_path_null(self):
1183 self._db.createTable( self._table, "path" )
1184 expId = 1
1185 obsId = self._tpA.getNewId()
1186 self.assertEqual( expId, obsId)
1187
1188
1189 def test_getListOfChainsSortedByAscIdentityFromQuery( self ):
1190 self._db.createTable( self._table, "path" )
1191 p1a = Path()
1192 p1a.setFromTuple( ( "1", "qry1", "11", "100", "sbj1", "1", "90", "0.0", "132", "96.2" ) )
1193 p2a = Path()
1194 p2a.setFromTuple( ( "2", "qry1", "101", "120", "sbj2", "1", "20", "0.0", "36", "98.0" ) )
1195 p1b = Path()
1196 p1b.setFromTuple( ( "1", "qry1", "121", "200", "sbj1", "91", "170", "0.0", "117", "96.5" ) )
1197 p2b = Path()
1198 p2b.setFromTuple( ( "2", "qry1", "201", "800", "sbj2", "21", "620", "0.0", "856", "93.2" ) )
1199 p3 = Path()
1200 p3.setFromTuple( ( "3", "qry2", "1", "1000", "sbj1", "1", "1000", "1e-120", "900", "100.0" ) )
1201 for p in [ p1a, p2a, p1b, p2b, p3 ]: self._tpA.insert( p )
1202 lPaths1 = [ p1a, p1b ]
1203 lPaths2 = [ p2a, p2b ]
1204 expList = [ lPaths2, lPaths1 ]
1205 obsList = self._tpA.getListOfChainsSortedByAscIdentityFromQuery( "qry1" )
1206 for lPaths in expList: PathUtils.getPathListSortedByIncreasingMinQueryThenMaxQuery( lPaths )
1207 for lPaths in obsList: PathUtils.getPathListSortedByIncreasingMinQueryThenMaxQuery( lPaths )
1208 self.assertEqual( expList, obsList )
1209
1210
1211 def test_getPathListSortedByIncreasingEvalueFromQuery( self ):
1212 self._db.createTable( self._table, "path" )
1213 p1 = Path()
1214 p1.setFromTuple( ( "1", "qry1", "101", "200", "sbj1", "1", "100", "0.0847", "100", "97.2" ) )
1215 self._tpA.insert( p1 )
1216 p2 = Path()
1217 p2.setFromTuple( ( "2", "qry1", "351", "500", "sbj2", "1", "150", "0.0035", "100", "97.2" ) )
1218 self._tpA.insert( p2 )
1219 p3 = Path()
1220 p3.setFromTuple( ( "3", "qry2", "541", "800", "sbj3", "1", "260", "0.147", "100", "97.2" ) )
1221 self._tpA.insert( p3 )
1222
1223 expList = [ p2, p1 ]
1224 obsList = self._tpA.getPathListSortedByIncreasingEvalueFromQuery( "qry1" )
1225 self.assertEqual( expList, obsList )
1226
1227
1228 def test_path2PathRange_QryDirSbjDir( self ):
1229 self._db.createTable( self._table, "path" )
1230 p1 = Path()
1231 p1.setFromTuple( ( "1", "chr1", "1", "10", "TE3", "11", "17", "1e-20", "30", "85.0" ) )
1232 p2a = Path()
1233 p2a.setFromTuple( ( "2", "chr2", "1", "100", "TE2", "10", "109", "1e-20", "163", "92.1" ) )
1234 p2b = Path()
1235 p2b.setFromTuple( ( "2", "chr2", "201", "250", "TE2", "151", "200", "1e-10", "75", "88.7" ) )
1236 for p in [ p1, p2a, p2b ]: self._tpA.insert( p )
1237 p2 = Path()
1238
1239 p2.setFromTuple( ( "2", "chr2", "1", "250", "TE2", "10", "200", "1e-20", "238", "90.96" ) ) # 'merge' p2a and p2b
1240 expList = [ p1, p2 ]
1241 obsTable = self._tpA.path2PathRange()
1242 self._tpA._table = obsTable
1243 obsList = self._tpA.getListOfAllPaths()
1244 self.assertEqual( expList, obsList )
1245 self._db.dropTable( obsTable )
1246
1247
1248 def test_path2PathRange_QryDirSbjRev( self ):
1249 self._db.createTable( self._table, "path" )
1250 p1 = Path()
1251 p1.setFromTuple( ( "1", "chr1", "1", "10", "TE3", "11", "17", "1e-20", "30", "85.0" ) )
1252 p2a = Path()
1253 p2a.setFromTuple( ( "2", "chr2", "1", "100", "TE2", "109", "10", "1e-20", "163", "92.1" ) )
1254 p2b = Path()
1255 p2b.setFromTuple( ( "2", "chr2", "201", "250", "TE2", "200", "151", "1e-10", "75", "88.7" ) )
1256 for p in [ p1, p2a, p2b ]: self._tpA.insert( p )
1257 p2 = Path()
1258 p2.setFromTuple( ( "2", "chr2", "1", "250", "TE2", "200", "10", "1e-20", "238", "90.96" ) ) # 'merge' p2a and p2b
1259 expList = [ p1, p2 ]
1260 obsTable = self._tpA.path2PathRange()
1261 self._tpA._table = obsTable
1262 obsList = self._tpA.getListOfAllPaths()
1263 self.assertEqual( obsList, expList )
1264 self._db.dropTable( obsTable )
1265
1266
1267 ###################################################################################
1268 ############################ Tests for other methods ##############################
1269 ###################################################################################
1270
1271 def test_path2PathRangeFromQuery_QryDirSbjDir( self ):
1272 self._db.createTable( self._table, "path" )
1273 p1 = Path()
1274 p1.setFromTuple( ( "1", "chr1", "1", "10", "TE3", "11", "17", "1e-20", "30", "85.0" ) )
1275 p2a = Path()
1276 p2a.setFromTuple( ( "2", "chr2", "1", "100", "TE2", "10", "109", "1e-20", "163", "92.1" ) )
1277 p2b = Path()
1278 p2b.setFromTuple( ( "2", "chr2", "201", "250", "TE2", "151", "200", "1e-10", "75", "88.7" ) )
1279 for p in [ p1, p2a, p2b ]: self._tpA.insert( p )
1280 p2 = Path()
1281 p2.setFromTuple( ( "2", "chr2", "1", "250", "TE2", "10", "200", "1e-20", "238", "90.96" ) ) # 'merge' p2a and p2b
1282 expList = [ p2 ]
1283 obsTable = self._tpA._path2PathRangeFromQuery( "chr2" )
1284 self._tpA._table = obsTable
1285 obsList = self._tpA.getListOfAllPaths()
1286 self.assertEqual( expList, obsList )
1287 self._db.dropTable( obsTable )
1288
1289
1290 def test_path2PathRangeFromQuery_QryDirSbjRev( self ):
1291 self._db.createTable( self._table, "path" )
1292 p1 = Path()
1293 p1.setFromTuple( ( "1", "chr1", "1", "10", "TE3", "11", "17", "1e-20", "30", "85.0" ) )
1294 p2a = Path()
1295 p2a.setFromTuple( ( "2", "chr2", "1", "100", "TE2", "109", "10", "1e-20", "163", "92.1" ) )
1296 p2b = Path()
1297 p2b.setFromTuple( ( "2", "chr2", "201", "250", "TE2", "200", "151", "1e-10", "75", "88.7" ) )
1298 for p in [ p1, p2a, p2b ]: self._tpA.insert( p )
1299 p2 = Path()
1300 p2.setFromTuple( ( "2", "chr2", "1", "250", "TE2", "200", "10", "1e-20", "238", "90.96" ) ) # 'merge' p2a and p2b
1301 expList = [ p2 ]
1302 obsTable = self._tpA._path2PathRangeFromQuery( "chr2" )
1303 self._tpA._table = obsTable
1304 obsList = self._tpA.getListOfAllPaths()
1305 self.assertEqual( obsList, expList )
1306 self._db.dropTable( obsTable )
1307
1308
1309 def test_getNbOccurrences( self ):
1310 self._db.createTable( self._table, "path" )
1311 p1 = Path()
1312 p1.setFromTuple( ( "1", "chr1", "1", "10", "TE3", "11", "17", "1e-20", "30", "85.0" ) )
1313
1314 exp = 0
1315 obs = self._tpA.getNbOccurrences( p1 )
1316 self.assertEquals( exp, obs )
1317
1318 self._tpA.insert( p1 )
1319 exp = 1
1320 obs = self._tpA.getNbOccurrences( p1 )
1321 self.assertEquals( exp, obs )
1322
1323 self._tpA.insert( p1 )
1324 exp = 2
1325 obs = self._tpA.getNbOccurrences( p1 )
1326 self.assertEquals( exp, obs )
1327
1328 def test_getListOfUniqueOccPath(self):
1329
1330 p1 = Path()
1331 p1.setFromTuple( ( "1", "chr1", "1", "10", "TE3", "11", "17", "1e-20", "30", "85.0" ) )
1332 p2 = Path()
1333 p2.setFromTuple( ( "1", "chr1", "1", "10", "TE3", "11", "17", "1e-20", "30", "85.0" ) )
1334 p3 = Path()
1335 p3.setFromTuple( ( "1", "chr1", "2", "10", "TE3", "11", "17", "1e-20", "30", "85.0" ) )
1336 p4 = Path()
1337 p4.setFromTuple( ( "2", "chr2", "2", "11", "TE4", "10", "18", "1e-30", "40", "95.0" ) )
1338 lPath = [p1,p2,p3,p4]
1339
1340 expListPath = deepcopy([p1,p3,p4])
1341 obsListUniquePath = self._tpA.getListOfUniqueOccPath(lPath)
1342 self.assertEquals( expListPath, obsListUniquePath )
1343
1344 def test_getListOfUniqueOccPath_empty_list(self):
1345 expListPath = []
1346 obsListUniquePath = self._tpA.getListOfUniqueOccPath([])
1347 self.assertEquals( expListPath, obsListUniquePath )
1348
1349 def test_getListOfUniqueOccPath_one_item(self):
1350 p1 = Path()
1351 p1.setFromTuple( ( "1", "chr1", "1", "10", "TE3", "11", "17", "1e-20", "30", "85.0" ) )
1352 expListPath = deepcopy([p1])
1353 obsListUniquePath = self._tpA.getListOfUniqueOccPath([p1])
1354 self.assertEquals( expListPath, obsListUniquePath )
1355
1356 def test_getListOfUniqueOccPath_unsorted_list(self):
1357
1358 p1 = Path()
1359 p1.setFromTuple( ( "1", "chr1", "1", "10", "TE3", "11", "17", "1e-20", "30", "85.0" ) )
1360 p3 = Path()
1361 p3.setFromTuple( ( "1", "chr1", "3", "10", "TE3", "11", "17", "1e-20", "30", "85.0" ) )
1362 p4 = Path()
1363 p4.setFromTuple( ( "2", "chr2", "2", "11", "TE4", "10", "18", "1e-30", "40", "95.0" ) )
1364 p2 = Path()
1365 p2.setFromTuple( ( "1", "chr1", "1", "10", "TE3", "11", "17", "1e-20", "30", "85.0" ) )
1366
1367 lPath = [p1,p3,p4,p2]
1368
1369 expListPath = deepcopy([p1,p3,p4])
1370 obsListUniquePath = self._tpA.getListOfUniqueOccPath(lPath)
1371 self.assertEquals( expListPath, obsListUniquePath )
1372
1373 test_suite = unittest.TestSuite()
1374 test_suite.addTest( unittest.makeSuite( Test_TablePathAdaptator ) )
1375 if __name__ == "__main__":
1376 unittest.TextTestRunner(verbosity=2).run( test_suite )