Skip to content
Snippets Groups Projects
Commit ad1f0029 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

make testBlastExec unit test less stringent

Depending on the used BLAST version, there might be one low quality hit more
or less. The unit test is now less stringent in a sense that we check whether
the perfect hits are found.
parent 00f77e8a
No related branches found
No related tags found
No related merge requests found
...@@ -32,21 +32,23 @@ class TestBlastBindings(unittest.TestCase): ...@@ -32,21 +32,23 @@ class TestBlastBindings(unittest.TestCase):
def testBlastExec(self): def testBlastExec(self):
hits=blast.Blast(self.query, 'testfiles/seqdb') hits = blast.Blast(self.query, 'testfiles/seqdb')
expected_hits=['1griA','1fhsA','3n84E','1mw9X']
self.assertEqual(len(hits), 4)
found=0
hit_ids=[]
expected_perfect_hit_ids = ["1fhsA", "3n84E", "1griA"]
perfect_hit_ids = []
for h in hits: for h in hits:
hit_ids.append(h.identifier) perfect_match = False
for aln_patch in h.aligned_patches:
for identifier in expected_hits: if aln_patch.seqid == 1.0:
if identifier in hit_ids: perfect_match = True
found+=1 if perfect_match:
self.assertEqual(found, 4) perfect_hit_ids.append(h.identifier)
expected_perfect_hit_ids.sort()
perfect_hit_ids.sort()
self.assertEqual(perfect_hit_ids, expected_perfect_hit_ids)
def testBlastParseOutput(self): def testBlastParseOutput(self):
...@@ -54,6 +56,7 @@ class TestBlastBindings(unittest.TestCase): ...@@ -54,6 +56,7 @@ class TestBlastBindings(unittest.TestCase):
parsed_out=blast.ParseBlastOutput(raw_out) parsed_out=blast.ParseBlastOutput(raw_out)
# numbers and ids can be specific to a certain blast version
expected_ids=['1griA','1fhsA','3n84E','1mw9X'] expected_ids=['1griA','1fhsA','3n84E','1mw9X']
expected_evalues=[4.80893e-59,4.80893e-59,9.06925e-58,2.96523] expected_evalues=[4.80893e-59,4.80893e-59,9.06925e-58,2.96523]
expected_scores=[534,534,523,27] expected_scores=[534,534,523,27]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment