revision.plt 5 KB
Newer Older
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
1
:- use_module(library(plunit)).
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
2
3
% not necessary, except for separate compilation
:- use_module(reaction_rules).
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
4

5
:- begin_tests(revision, [condition(flag(slow_test, true, true)),
6
                          blocked(francois), setup((clear_model, reset_options))]).
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

test(
  'categorize_query',
  [
    true((ECTL, UCTL, ACTL) == (['EF'(a)], ['EU'(a, 'AG'(b))], ['AG'(b)]))
  ]
) :-
  revision:categorize_query(
    'EF'(a) /\ 'AG'(b) /\ 'EU'(a, 'AG'(b)),
    ECTL,
    UCTL,
    ACTL
  ).

test(
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
22
23
  'revise_model rule addition for ECTL',
  [
24
    setup(clear_model),
25
    all(Reactions = [[('MA'(1) for '_'=>b)],[('MA'(1) for a=>b)],[('MA'(1) for a=>b+a)]])
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
26
27
28
29
  ]
) :-
  command(present(a)),
  command(absent(b)),
30
  revision:revise_model('EU'(a, b), Reactions, []).
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
31
32
33

test(
  'revise_model rule addition for UCTL',
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
34
  [
35
    setup(clear_model),
36
    all(Reactions = [[('MA'(1)for a=>b)]])
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
37
  ]
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
38
39
40
) :-
  command(present(a)),
  command(absent(b)),
41
  revision:revise_model('EF'(b /\ 'AG'(not(a))), Reactions, []).
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
42

43
test(
44
  'revise_model rule deletion for ACTL, Miguel example',
45
  [
46
    setup(clear_model),
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
47
    all((Added, Removed) = [([], ['MA'(1) for a+b => b])])
48
49
  ]
) :-
50
51
  command(add_reaction(a => a + b)),
  command(add_reaction(a + b => b)),
52
  revision:revise_model(not(a) \/ 'AX'(a /\ b), Added, Removed).
53

SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
54
test(
55
  'revise_model rule deletion (from counter-example) for ACTL',
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
56
57
  [
    setup(clear_model),
58
    all((Added, Removed) = [([],[('MA'(1)for a=>b)])])
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
59
60
  ]
) :-
61
  command(present(a)),
62
63
64
  command(absent(b)),
  command(add_reaction(a => b)),
  command(add_reaction(b => c)),
65
  revision:revise_model('AG'(a), Added, Removed).
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
66

67
68
69
70
test(
  'revise_model rule deletion for ACTL, Miguel bigger example',
  [
    setup(clear_model),
71
    all((Added, Removed) =
SOLIMAN Sylvain's avatar
syntax!    
SOLIMAN Sylvain committed
72
73
74
75
76
77
78
79
80
81
82
83
84
85
    [
      ([], [
        ('MA'(1)for'_'=>'_'),
        ('MA'(1)for'_'=>a),
        ('MA'(1)for a=>'_'),
        ('MA'(1)for a=>a),
        ('MA'(1)for a=>b),
        ('MA'(1)for b=>'_'),
        ('MA'(1)for b=>a),
        ('MA'(1)for a+b=>'_'),
        ('MA'(1)for b+a=>a),
        ('MA'(1)for a+b=>b)]
      )
    ])
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
  ]
) :-
  command(add_reaction('_' => '_')),
  command(add_reaction('_' => a)),
  command(add_reaction('_' => b)),
  command(add_reaction('_' => a+b)),
  command(add_reaction(a => '_')),
  command(add_reaction(a => a)),
  command(add_reaction(a => b)),
  command(add_reaction(a => a+b)),
  command(add_reaction(b => '_')),
  command(add_reaction(b => a)),
  command(add_reaction(b => b)),
  command(add_reaction(b => a+b)),
  command(add_reaction(a+b => '_')),
  command(add_reaction(a+b => a)),
  command(add_reaction(a+b => b)),
  command(add_reaction(a+b => a+b)),
104
  revision:revise_model(not(a) \/ 'AX'(a /\ b), Added, Removed).
105

SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
106
107
108
test(
  '3_inhibitions',
  [
109
    setup(clear_model)
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
110
111
112
113
114
115
116
117
118
  ]
) :-
  command('_' => a),
  command('_' => b),
  command('_' => c),
  command(a => '_'),
  command(b => '_'),
  command(c => '_'),
  once(
119
    revision:revise_model(
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
120
121
122
      oscil(a) /\ oscil(b) /\ oscil(c) /\
      (c -> checkpoint(a, not(c))) /\
      (a -> checkpoint(b, not(a))) /\
123
124
125
126
127
      (b -> checkpoint(c, not(b))),
      Added,
      Removed
    )
  ),
128
129
  assertion(Added = ['MA'(1) for c+a=>a,'MA'(1) for a+b=>b,'MA'(1) for b+c=>c]),
  assertion(Removed = ['MA'(1) for a=>_,'MA'(1) for b=>_,'MA'(1) for c=>_]).
130
131

test(
132
  'Qu1',
133
134
135
136
137
138
139
140
141
142
  [
    setup(clear_model)
  ]
) :-
  command(load('library:examples/cell_cycle/Qu_et_al_2003.bc')),
  once(
    revision:revise_model(
      'AG'(not('CycB-CDK~{p1}') -> checkpoint('C25~{p1,p2}','CycB-CDK~{p1}')),
      Added,
      Removed
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
143
144
    )
  ),
145
146
  assertion(Added == []),
  assertion(Removed = [k1 for '_' => 'CycB']).
SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
147
148


149
150
151
152
153
154
155
156
test(
  'Qu2',
  [
    setup(clear_model)
  ]
) :-
  command(load('library:examples/cell_cycle/Qu_et_al_2003.bc')),
  command(add_ctl(reachable('CycB'))),
157
  command(add_ctl(reachable('CycB-CDK~{p1}'))),
158
  command(add_ctl(reachable('CycB-CDK~{p1,p2}'))),
159
  command(add_ctl(reachable('APC'))),
160
161
  command(add_ctl(reachable('C25'))),
  command(add_ctl(reachable('C25~{p1}'))),
162
163
164
165
166
167
168
169
170
171
172
173
  command(add_ctl(oscil('C25~{p1,p2}'))),
  command(add_ctl(reachable('Wee1'))),
  command(add_ctl(reachable('Wee1~{p1}'))),
  command(add_ctl(reachable('CKI'))),
  command(add_ctl(reachable('CKI-CycB-CDK~{p1}'))),
  command(add_ctl(reachable('(CKI-CycB-CDK~{p1})~{p2}'))),
  command(add_ctl('AG'(not('APC')->checkpoint('CycB-CDK~{p1}','APC')))),
  command(add_ctl('AG'(not('C25~{p1,p2}')->checkpoint('C25~{p1}','C25~{p1,p2}')))),
  command(add_ctl('AG'(not('Wee1~{p1}')->checkpoint('Wee1','Wee1~{p1}')))),
  command(add_ctl('AG'(not('(CKI-CycB-CDK~{p1})~{p2}')->checkpoint('CKI-CycB-CDK~{p1}','(CKI-CycB-CDK~{p1})~{p2}')))),

  command(add_ctl('AG'(not('CycB-CDK~{p1}')->checkpoint('C25~{p1,p2}','CycB-CDK~{p1}')))),
174
  findall(Formula, item([kind: ctl_spec, item: Formula]), Specs),
175
  join_with_op(Specs, '/\\', Spec),
176
177
178
179
180
181
182
183
184
185
186
187
188
189
  once(
    revision:revise_model(
      Spec,
      Added,
      Removed
    )
  ),
  assertion(Added == []),
  assertion(Removed = [
    k5*['CycB-CDK~{p1,p2}']for'CycB-CDK~{p1,p2}'=>'CycB-CDK~{p1}',
    k15*['CKI-CycB-CDK~{p1}'] for 'CKI-CycB-CDK~{p1}'=>'CKI'+'CycB-CDK~{p1}'
  ]).


SOLIMAN Sylvain's avatar
SOLIMAN Sylvain committed
190
:- end_tests(revision).