pattern_reduction.plt 2.19 KB
Newer Older
1
2
:- use_module(library(plunit)).

BARGAIN Orianne's avatar
BARGAIN Orianne committed
3
:- begin_tests(pattern).
4

5

6
7
8
has_start(Start, String) :-
  atom_concat(Start, _, String).

9

10
11
12
13
count_start(Atom, List, Count) :-
  include(has_start(Atom), List, L),
  length(L, Count).

14

BARGAIN Orianne's avatar
BARGAIN Orianne committed
15
16
test('pattern_fail') :-
  command('pattern_reduction("library/examples/sepi/MM5.bc").'),
17
  read_file_to_string("library/examples/sepi/MM5_reduced.bc", String, []),
18
19
  String = "S+E=>ES.\nES=>S+E.\nES=>P+E.\nES=>_.\n".

20

BARGAIN Orianne's avatar
BARGAIN Orianne committed
21
22
test('pattern_success') :-
  command('pattern_reduction("library/examples/sepi/MM1.bc").'),
23
24
25
  read_file_to_string("library/examples/sepi/MM1_reduced.bc", String, []),
  String = "S+E=>P+E.\n".

26

BARGAIN Orianne's avatar
BARGAIN Orianne committed
27
28
test('pattern_intermediary_success') :-
  with_option([r_1: no], pattern_reduction("library/examples/sepi/MM6.bc")),
29
30
31
  read_file_to_string("library/examples/sepi/MM6_reduced.bc", String, []),
  String = "S+E=>P+E.\n".

BARGAIN Orianne's avatar
BARGAIN Orianne committed
32

BARGAIN Orianne's avatar
BARGAIN Orianne committed
33
34
test('pattern_mapk1_to_mapk3') :-
  command('pattern_reduction("library/examples/sepi/mapk1.bc").'),
35
36
37
38
39
40
41
42
43
44
45
46
47
  with_output_to(
    atom(Result),
    command('search_reduction("library:examples/sepi/mapk1_reduced.bc", "library:examples/sepi/mapk3.bc").')
  ),
  atomic_list_concat(Split, '\n', Result),
  count_start('sepi', Split, 1),
  with_output_to(
    atom(Result2),
    command('search_reduction("library:examples/sepi/mapk3.bc", "library:examples/sepi/mapk1_reduced.bc").')
  ),
  atomic_list_concat(Split2, '\n', Result2),
  count_start('sepi', Split2, 1).

BARGAIN Orianne's avatar
BARGAIN Orianne committed
48

BARGAIN Orianne's avatar
BARGAIN Orianne committed
49
test('pattern_mapk2_to_mapk3') :-
BARGAIN Orianne's avatar
BARGAIN Orianne committed
50
  with_option([r_1: no], pattern_reduction("library/examples/sepi/mapk2.bc")),
51
52
53
54
55
56
57
58
59
60
61
62
  with_output_to(
    atom(Result),
    command('search_reduction("library:examples/sepi/mapk2_reduced.bc", "library:examples/sepi/mapk3.bc").')
  ),
  atomic_list_concat(Split, '\n', Result),
  count_start('sepi', Split, 1),
  with_output_to(
    atom(Result2),
    command('search_reduction("library:examples/sepi/mapk3.bc", "library:examples/sepi/mapk2_reduced.bc").')
  ),
  atomic_list_concat(Split2, '\n', Result2),
  count_start('sepi', Split2, 1).
BARGAIN Orianne's avatar
BARGAIN Orianne committed
63

64

65
66
67
68
69
70
71
72
test('pattern_R-2_EP') :-
  with_output_to(
    atom(Output),
    command('pattern_reduction("library/examples/sepi/mapk26.bc").')
  ),
  Output = 'Number of Michaelis Menten motifs: 2\nNumber of variant of Michaelis Menten motifs: 0\n'.


BARGAIN Orianne's avatar
BARGAIN Orianne committed
73
:- end_tests(pattern).