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
Branches
Tags
No related merge requests found
......@@ -32,21 +32,23 @@ class TestBlastBindings(unittest.TestCase):
def testBlastExec(self):
hits=blast.Blast(self.query, 'testfiles/seqdb')
expected_hits=['1griA','1fhsA','3n84E','1mw9X']
self.assertEqual(len(hits), 4)
found=0
hit_ids=[]
hits = blast.Blast(self.query, 'testfiles/seqdb')
expected_perfect_hit_ids = ["1fhsA", "3n84E", "1griA"]
perfect_hit_ids = []
for h in hits:
hit_ids.append(h.identifier)
for identifier in expected_hits:
if identifier in hit_ids:
found+=1
self.assertEqual(found, 4)
perfect_match = False
for aln_patch in h.aligned_patches:
if aln_patch.seqid == 1.0:
perfect_match = True
if perfect_match:
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):
......@@ -54,6 +56,7 @@ class TestBlastBindings(unittest.TestCase):
parsed_out=blast.ParseBlastOutput(raw_out)
# numbers and ids can be specific to a certain blast version
expected_ids=['1griA','1fhsA','3n84E','1mw9X']
expected_evalues=[4.80893e-59,4.80893e-59,9.06925e-58,2.96523]
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