File tree 2 files changed +10
-3
lines changed
2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -74,11 +74,13 @@ def __bool__(self):
74
74
return self .score
75
75
76
76
77
- class Negate (AsiUnaryExpr ):
77
+ class Negate (AsiExpr ):
78
78
"""Unary negation of boolean child"""
79
79
def __call__ (self , mutations ):
80
- arg = self .children (mutations )
81
- return Score (not arg .score , arg .residues )
80
+ child = self .children [0 ](mutations )
81
+ if child is None :
82
+ return Score (True , []) # TODO: propagate negative residues
83
+ return Score (not child .score , child .residues )
82
84
83
85
84
86
class AndExpr (AsiExpr ):
Original file line number Diff line number Diff line change @@ -51,6 +51,11 @@ def test_score_from(self):
51
51
rule = ASI2 ("SCORE FROM ( 100G => 10, 101D => 20 )" )
52
52
self .assertEqual (rule (VariantCalls ("100G 102G" )), 10 )
53
53
54
+ def test_score_from (self ):
55
+ rule = ASI2 ("SCORE FROM ( NOT 100G => 10, NOT 101SD => 20 )" )
56
+ self .assertEqual (rule (VariantCalls ("100G 102G" )), 20 )
57
+ self .assertEqual (rule (VariantCalls ("100S 101S" )), 10 )
58
+
54
59
def test_score_residues (self ):
55
60
rule = ASI2 ("SCORE FROM ( 100G => 10, 101D => 20 )" )
56
61
expected_residue = repr ({Mutation ('S100G' )})
You can’t perform that action at this time.
0 commit comments