Skip to content

Commit

Permalink
Include wild type in score residues.
Browse files Browse the repository at this point in the history
  • Loading branch information
donkirkby committed Dec 27, 2017
1 parent 20b15d3 commit 46fffc9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyvdrm/asi2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 8 additions & 1 deletion pyvdrm/tests/test_asi2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 46fffc9

Please sign in to comment.