diff --git a/pyvdrm/asi2.py b/pyvdrm/asi2.py index 06f0ab0..4e0ea5c 100644 --- a/pyvdrm/asi2.py +++ b/pyvdrm/asi2.py @@ -220,7 +220,7 @@ def __repr__(self): def __call__(self, env): for mutation_set in env: - intersection = mutation_set.mutations & self.mutations.mutations + intersection = self.mutations.mutations & mutation_set.mutations if len(intersection) > 0: return Score(True, intersection) return None diff --git a/pyvdrm/tests/test_asi2.py b/pyvdrm/tests/test_asi2.py index b567c13..7577211 100644 --- a/pyvdrm/tests/test_asi2.py +++ b/pyvdrm/tests/test_asi2.py @@ -47,11 +47,18 @@ def test_asi2_compat(self): # noinspection SqlNoDataSourceInspection,SqlDialectInspection class TestRuleSemantics(unittest.TestCase): - def test_score_from(self): rule = ASI2("SCORE FROM ( 100G => 10, 101D => 20 )") self.assertEqual(rule(VariantCalls("100G 102G")), 10) + def test_score_residues(self): + rule = ASI2("SCORE FROM ( 100G => 10, 101D => 20 )") + expected_residue = repr({Mutation('S100G')}) + + result = rule.dtree(VariantCalls("S100G R102G")) + + self.assertEqual(expected_residue, repr(result.residues)) + def test_score_from_max(self): rule = ASI2("SCORE FROM (MAX (100G => 10, 101D => 20, 102D => 30))") self.assertEqual(rule(VariantCalls("100G 101D")), 20)