def binds(name_a, name_b): """Rule for 'A binds B'.""" A = new_variable(nickname=name_a) B = new_variable(nickname=name_b) return predicate.Exists(predicate.Implies(predicate.Named(A, name_a), predicate.Implies(predicate.Named(B, name_b), predicate.Not(predicate.And(predicate.PreLink(A, B)), predicate.PostLink(A, B)))))
def directly_activates(name_a, name_b): """ Macro for 'activated "A" activates "B"'. """ # Forall Model, Exists Rule in Model, [...] A = new_variable(nickname=name_a) B = new_variable(nickname=name_b) intp = datatypes.new_interpretation() return predicate.Exists(predicate.Implies(predicate.Named(A, name_a), predicate.Implies(predicate.Named(B, name_b), predicate.And(predicate.PreLabeled(A, ACTIVE), predicate.PreUnlabeled(B, ACTIVE), predicate.PostLabeled(A, ACTIVE), predicate.PostLabeled(B, ACTIVE)))))
def directly_phosphorylates(name_a, name_b): """ Macro for 'activated "A" phosphorylates "B"'. """ A = new_variable(nickname=name_a) B = new_variable(nickname=name_b) # Okay, so what I actually want this to say is as follows: # Forall Model, Exists Rule in Model, reaction stuff holds over rule # reaction stuff = Forall A B, Named A name_a /\ Named B name_b => prelabeled etc intp = datatypes.new_interpretation() return predicate.Exists(predicate.Implies(predicate.Named(A, name_a), predicate.Implies(predicate.Named(B, name_b), predicate.And(predicate.PreLabeled(A, ACTIVE), predicate.PreUnlabeled(B, PHOSPHORYLATED), predicate.PostLabeled(A, ACTIVE), predicate.PostLabeled(B, PHOSPHORYLATED)))))
def phosphorylated_is_active(name_b): """ Macro for 'phosphorylated "B" is active'. """ # Forall Model, *Forall* Rule in Model, Forall B, Named B named_b => and(...) B = new_variable(nickname=name_b) intp = datatypes.new_interpretation() return predicate.ForAll(predicate.Implies(predicate.Named(B, name_b), predicate.And(predicate.Implies(predicate.PreLabeled(B, PHOSPHORYLATED), predicate.PreLabeled(B, ACTIVE)), predicate.Implies(predicate.PostLabeled(B, PHOSPHORYLATED), predicate.PostLabeled(B, ACTIVE)))))
def test_named_sat(self): v = datatypes.new_variable() s = "Name" pred = predicate.Named(v, s) self.assertSat(pred)