Commit 67ebb89b authored by HEMERY Mathieu's avatar HEMERY Mathieu
Browse files

Merge branch 'develop' into feature/Hybrid

parents 34d482bc 8e1ecbeb
......@@ -97,22 +97,23 @@ $(SWIPL): $(SWIPL).c \
for dir in $(SUBDIRS) ; do $(MAKE) -C $$dir ; done
$(CXX) $(CXXFLAGS) $^ $(LDFLAGS) $(LDLIBS) -lstdc++ -o $@
doc/index.html doc/commands.js: biocham
./biocham --generate-doc
doc/index.html doc/commands.js: biocham_debug
echo "generate_doc." | ./biocham_debug
pldoc:
echo "doc_save(., [if(true), doc_root('doc/pldoc')])." | swipl -q > /dev/null
devdoc:
./biocham --generate-devdoc
echo "generate_devdoc." | ./biocham_debug
# quick ones only
unit_tests: biocham_debug
echo "run_tests_and_halt." | ./biocham_debug
# slow tests too
test: biocham_debug jupyter_tests
test: biocham_debug
echo "flag(slow_test, _, true), run_tests_and_halt." | ./biocham_debug
$(MAKE) jupyter_tests
jupyter_tests: install_kernel
PATH=$(CURDIR):$(PATH) jupyter nbconvert --execute --stdout library/examples/cmsb_2017/sigmoids.ipynb > /dev/null
......
[![pipeline status](https://gitlab.inria.fr/lifeware/biocham/badges/develop/pipeline.svg)](https://gitlab.inria.fr/lifeware/biocham/commits/develop)
[![coverage report](https://gitlab.inria.fr/lifeware/biocham/badges/develop/coverage.svg)](https://gitlab.inria.fr/lifeware/biocham/commits/develop)
[![License](https://img.shields.io/badge/license-GPLv2-orange)](https://gitlab.inria.fr/lifeware/biocham/raw/develop/LICENSE)
# Biocham
This README file is mostly aimed at people *contributing* to Biocham
......
......@@ -84,14 +84,6 @@ option('--trace', Arg, Arg) :-
leash(-all),
trace.
option('--generate-doc', Arg, Arg) :-
generate_doc,
quit.
option('--generate-devdoc', Arg, Arg) :-
generate_devdoc,
quit.
option('--version', Arg, Arg) :-
quit.
......@@ -121,7 +113,7 @@ option('--list-commands', [], []) :-
:- doc('\\texttt{biocham [file]}
launches Biocham and optionnally loads the file given as argument.').
:- doc('\\texttt{biocham --trace --generate-doc --version --list-commands} are possible options (prefixed by two dashes).').
:- doc('\\texttt{biocham --trace --version --list-commands} are possible options (prefixed by two dashes).').
:- doc('\\texttt{biocham_debug} is the command to use to launch Biocham with the Prolog toplevel.').
......
......@@ -14,6 +14,12 @@ run_junit_tests :-
run_junit_tests(all).
run_junit_tests(Spec) :-
\+ is_list(Spec),
Spec \= all,
!,
run_junit_tests([Spec]).
run_junit_tests(Spec) :-
set_prolog_flag(verbose, normal),
patch_show_coverage,
......@@ -22,11 +28,7 @@ run_junit_tests(Spec) :-
(
Spec \= all
->
atom_concat('plunit_', Spec, TestModule),
module_property(TestModule, file(TestFile)),
atom_concat(PlFile, 't', TestFile),
module_property(PlModule, file(PlFile)),
Modules=[PlModule]
maplist(get_pl_module, Spec, Modules)
;
Modules=[]
),
......@@ -36,7 +38,13 @@ run_junit_tests(Spec) :-
(
Spec == all
->
show_coverage(run_tests, Modules)
(
flag(slow_test, true, true)
->
show_coverage((run_tests, generate_doc))
;
show_coverage(run_tests)
)
;
show_coverage(run_tests(Spec), Modules)
)
......@@ -92,6 +100,12 @@ run_junit_tests(Spec) :-
plunit:check_for_test_errors.
get_pl_module(Spec, Module) :-
atom_concat('plunit_', Spec, TestModule),
module_property(TestModule, file(TestFile)),
atom_concat(PlFile, 't', TestFile),
module_property(Module, file(PlFile)).
patch_show_coverage :-
% old swi-prolog test_coverage.pl has one less argument,
......
......@@ -39,6 +39,9 @@ yesnomaybe(maybe).
:- grammar_doc('\\emphright{Value maybe.}').
:- dynamic(seen/1).
pattern_reduction(Input_file, Output_file) :-
biocham_command,
type(Input_file, input_file),
......@@ -58,8 +61,9 @@ pattern_reduction(Input_file, Output_file) :-
Graph = [Number_vertex, Number_species, Edges, Id],
once(construct_dict_arcs(Edges, Dict_normal_arcs, Dict_reversed_arcs)),
debug(motif, "Edges:~w ~nNormal arcs: ~w ~nReversed arcs: ~w", [Edges, Dict_normal_arcs, Dict_reversed_arcs]),
open(Output_file, write, Stream),
retractall(seen(_)),
assert(seen(Number_vertex)),
open(Output_file, write, Stream),
(
MM_complete = yes
->
......
:- use_module(library(plunit)).
:- begin_tests(pattern).
has_start(Start, String) :-
atom_concat(Start, _, String).
......@@ -12,86 +10,104 @@ count_start(Atom, List, Count) :-
length(L, Count).
test('pattern_fail') :-
command('pattern_reduction("library:examples/sepi/MM5.bc", "MM5_reduced.bc").'),
:- begin_tests(pattern, [setup(command('clear_model.'))]).
test('pattern_fail', [true(String = "S+E=>ES.\nES=>S+E.\nES=>P+E.\nES=>_.\n")]) :-
with_output_to(
atom(_),
command('pattern_reduction("library:examples/sepi/MM5.bc", "MM5_reduced.bc").')
),
read_file_to_string("MM5_reduced.bc", String, []),
delete_file("MM5_reduced.bc"),
String = "S+E=>ES.\nES=>S+E.\nES=>P+E.\nES=>_.\n".
delete_file("MM5_reduced.bc").
test('pattern_success') :-
command('pattern_reduction("library:examples/sepi/MM1.bc", "MM1_reduced.bc").'),
test('pattern_success', [true(String = "S+E=>P+E.\n")]) :-
with_output_to(
atom(_),
command('pattern_reduction("library:examples/sepi/MM1.bc", "MM1_reduced.bc").')
),
read_file_to_string("MM1_reduced.bc", String, []),
delete_file("MM1_reduced.bc"),
String = "S+E=>P+E.\n".
delete_file("MM1_reduced.bc").
test('pattern_intermediary_success') :-
with_option([r_1: no], pattern_reduction("library:examples/sepi/MM6.bc", "MM6_reduced.bc")),
test('pattern_intermediary_success', [true(String = "S+E=>P+E.\n")]) :-
with_option(
[r_1: no],
with_output_to(
atom(_),
pattern_reduction("library:examples/sepi/MM6.bc", "MM6_reduced.bc"
))
),
read_file_to_string("MM6_reduced.bc", String, []),
delete_file("MM6_reduced.bc"),
String = "S+E=>P+E.\n".
delete_file("MM6_reduced.bc").
test(
'pattern_mapk1_to_mapk3',
[condition(flag(slow_test, true, true))]
[condition(flag(slow_test, true, true)), true((Count1, Count2) = (1, 1))]
) :-
command('pattern_reduction("library:examples/sepi/mapk1.bc", "mapk1_reduced.bc").'),
with_output_to(
atom(_),
command('pattern_reduction("library:examples/sepi/mapk1.bc", "mapk1_reduced.bc").')
),
with_output_to(
atom(Result),
command('search_reduction("mapk1_reduced.bc", "library:examples/sepi/mapk3.bc").')
),
atomic_list_concat(Split, '\n', Result),
count_start('sepi', Split, 1),
count_start('sepi', Split, Count1),
with_output_to(
atom(Result2),
command('search_reduction("library:examples/sepi/mapk3.bc", "mapk1_reduced.bc").')
),
delete_file("mapk1_reduced.bc"),
atomic_list_concat(Split2, '\n', Result2),
count_start('sepi', Split2, 1).
count_start('sepi', Split2, Count2).
test(
'pattern_mapk2_to_mapk3',
[condition(flag(slow_test, true, true))]
[condition(flag(slow_test, true, true)), true((Count1, Count2) = (1, 1))]
) :-
with_option([r_1: no], pattern_reduction("library:examples/sepi/mapk2.bc", "mapk2_reduced.bc")),
with_option(
[r_1: no],
pattern_reduction("library:examples/sepi/mapk2.bc", "mapk2_reduced.bc")
),
with_output_to(
atom(Result),
command('search_reduction("mapk2_reduced.bc", "library:examples/sepi/mapk3.bc").')
),
atomic_list_concat(Split, '\n', Result),
count_start('sepi', Split, 1),
count_start('sepi', Split, Count1),
with_output_to(
atom(Result2),
command('search_reduction("library:examples/sepi/mapk3.bc", "mapk2_reduced.bc").')
),
delete_file("mapk2_reduced.bc"),
atomic_list_concat(Split2, '\n', Result2),
count_start('sepi', Split2, 1).
count_start('sepi', Split2, Count2).
test('pattern_R-2_EP') :-
test('pattern_R-2_EP', [true(Output = '\nNumber of Michaelis Menten patterns: 2\n')]) :-
with_output_to(
atom(Output),
command('pattern_reduction("library:examples/sepi/mapk26.bc", "mapk26_reduced.bc").')
),
delete_file("mapk26_reduced.bc"),
Output = '\nNumber of Michaelis Menten patterns: 2\n'.
delete_file("mapk26_reduced.bc").
test('maybe_option') :-
test('maybe_option', [true(Output = '\nNumber of Michaelis Menten patterns: 4\n')]) :-
with_output_to(
atom(Output),
with_option([r_1: maybe, r_2: maybe, ep: maybe], pattern_reduction("library:examples/sepi/mapk26.bc", "mapk26_reduced.bc"))
with_option(
[r_1: maybe, r_2: maybe, ep: maybe],
pattern_reduction("library:examples/sepi/mapk26.bc", "mapk26_reduced.bc")
)
),
delete_file("mapk26_reduced.bc"),
Output = '\nNumber of Michaelis Menten patterns: 4\n'.
delete_file("mapk26_reduced.bc").
test('hill_reaction') :-
test('hill_reaction', [true(Output3 = '\nNumber of Hill patterns: 0\n')]) :-
with_output_to(
atom(Output),
with_option([michaelis_menten: no, hill_reaction: yes], pattern_reduction("library:examples/sepi/MM_variants/MM_SES.bc", "MM_SES_reduced.bc"))
......@@ -108,11 +124,10 @@ test('hill_reaction') :-
atom(Output3),
with_option([michaelis_menten: no, hill_reaction: yes], pattern_reduction("library:examples/sepi/MM_variants/MM_SES_false.bc", "MM_SES_reduced.bc"))
),
delete_file("MM_SES_reduced.bc"),
Output3 = '\nNumber of Hill patterns: 0\n'.
delete_file("MM_SES_reduced.bc").
test('partial_hill_reaction') :-
test('partial_hill_reaction', [true(Output3 = '\nNumber of partial Hill patterns: 0\n')]) :-
with_output_to(
atom(Output),
with_option([michaelis_menten: no, partial_hill_reaction: yes], pattern_reduction("library:examples/sepi/MM_variants/MM_ESS.bc", "MM_ESS_reduced.bc"))
......@@ -129,11 +144,10 @@ test('partial_hill_reaction') :-
atom(Output3),
with_option([michaelis_menten: no, partial_hill_reaction: yes], pattern_reduction("library:examples/sepi/MM_variants/MM_ESS_false.bc", "MM_ESS_reduced.bc"))
),
delete_file("MM_ESS_reduced.bc"),
Output3 = '\nNumber of partial Hill patterns: 0\n'.
delete_file("MM_ESS_reduced.bc").
test('double_michaelis_menten') :-
test('double_michaelis_menten', [true(Output3 = '\nNumber of double Michaelis Menten: 0\n')]) :-
with_output_to(
atom(Output),
with_option([michaelis_menten: no, double_michaelis_menten: yes], pattern_reduction("library:examples/sepi/MM_variants/MM_SEE.bc", "MM_SEE_reduced.bc"))
......@@ -150,13 +164,21 @@ test('double_michaelis_menten') :-
atom(Output3),
with_option([michaelis_menten: no, double_michaelis_menten: yes], pattern_reduction("library:examples/sepi/MM_variants/MM_SEE_false.bc", "MM_SEE_reduced.bc"))
),
delete_file("MM_SEE_reduced.bc"),
Output3 = '\nNumber of double Michaelis Menten: 0\n'.
delete_file("MM_SEE_reduced.bc").
test('expansion') :-
command('pattern_reduction("library:examples/sepi/MM1.bc", "MM1_reduced.bc").'),
with_option([michaelis_menten: no, michaelis_menten_expansion: yes], pattern_reduction("MM1_reduced.bc", "MM1_expanded.bc")),
test('expansion', [true(Count = 1)]) :-
with_output_to(
atom(_),
command('pattern_reduction("library:examples/sepi/MM1.bc", "MM1_reduced.bc").')
),
with_output_to(
atom(_),
with_option(
[michaelis_menten: no, michaelis_menten_expansion: yes],
pattern_reduction("MM1_reduced.bc", "MM1_expanded.bc")
)
),
with_output_to(
atom(Result),
command('search_reduction("MM1_expanded.bc", "library:examples/sepi/MM1.bc").')
......@@ -170,6 +192,6 @@ test('expansion') :-
delete_file("MM1_reduced.bc"),
delete_file("MM1_expanded.bc"),
atomic_list_concat(Split2, '\n', Result2),
count_start('sepi', Split2, 1).
count_start('sepi', Split2, Count).
:- end_tests(pattern).
FROM jupyter/minimal-notebook
FROM jupyter/minimal-notebook:702d2f6a3eaa
LABEL Author="Sylvain Soliman <Sylvain.Soliman@inria.fr>"
LABEL Maintainer="Biocham team <biocham@inria.fr>"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment