Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Lifeware
biocham
Commits
4292f8d4
Commit
4292f8d4
authored
Oct 19, 2015
by
Thierry Martinez
Browse files
Options
Browse Files
Download
Plain Diff
Graph editors...
parents
58458c6d
20c18df4
Changes
25
Hide whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
499 additions
and
244 deletions
+499
-244
Makefile
Makefile
+2
-2
aliases.pl
aliases.pl
+4
-2
aliases.plt
aliases.plt
+1
-1
conservation_laws.pl
conservation_laws.pl
+1
-1
conservation_laws.plt
conservation_laws.plt
+15
-15
doc.pl
doc.pl
+9
-6
graph_editor.pl
graph_editor.pl
+195
-0
initial_state.pl
initial_state.pl
+6
-11
initial_state.plt
initial_state.plt
+5
-5
install-macos.sh
install-macos.sh
+1
-1
macros.pl
macros.pl
+4
-7
macros.plt
macros.plt
+1
-1
models.pl
models.pl
+210
-153
models.plt
models.plt
+1
-1
numerical_simulation.pl
numerical_simulation.pl
+7
-3
nusmv.pl
nusmv.pl
+1
-1
ode.pl
ode.pl
+11
-2
parameters.pl
parameters.pl
+6
-15
parameters.plt
parameters.plt
+1
-1
plot.pl
plot.pl
+2
-3
reaction_editor.pl
reaction_editor.pl
+6
-6
reaction_editor.plt
reaction_editor.plt
+2
-2
toc.org
toc.org
+3
-0
traces.pl
traces.pl
+4
-4
traces.plt
traces.plt
+1
-1
No files found.
Makefile
View file @
4292f8d4
...
...
@@ -10,8 +10,8 @@ biocham: $(MODULES) toc.org Makefile
@
echo
$(MODULES)
swipl
-o
biocham
--goal
=
start
--toplevel
=
toplevel
-c
$(MODULES)
biocham_debug
:
$(MODULES) toc.org Makefile
swipl
-o
biocham_debug
--goal
=
initialize
-c
$(MODULES)
biocham_debug
:
$(MODULES)
$(TEST_MODULES)
toc.org Makefile
swipl
-o
biocham_debug
--goal
=
initialize
-c
$(MODULES)
$(TEST_MODULES)
tests
:
biocham_tests
./biocham_tests
...
...
aliases.pl
View file @
4292f8d4
...
...
@@ -29,7 +29,9 @@ add_equivalence_class_list(EquivalenceClassList) :-
true
;
list_to_equals
(
EquivalenceClassList
,
EquivalenceClass
),
add_item
(
alias
,
EquivalenceClassList
,
alias
(
EquivalenceClass
)),
add_item
([
kind
:
alias
,
key
:
EquivalenceClassList
,
item
:
alias
(
EquivalenceClass
)
]),
simplify_all_reactions
).
...
...
@@ -81,7 +83,7 @@ canonical(Object, Canonical) :-
list_aliases
:-
biocham_command
,
doc
(
'shows the values of all known aliases.'
),
list_items
([
model
:
current_model
,
kind
:
alias
]).
list_items
([
kind
:
alias
]).
delete_alias
(
Object
)
:-
...
...
aliases.plt
View file @
4292f8d4
...
...
@@ -6,6 +6,6 @@ test('alias', [true(Reactions == [2 * a => c])]) :-
clear_model,
add_reaction(a + b => c),
command(alias(a = b)),
all_items([
model: current_model,
kind: reaction], Reactions).
all_items([kind: reaction], Reactions).
:- end_tests(aliases).
conservation_laws.pl
View file @
4292f8d4
...
...
@@ -31,7 +31,7 @@ add_conservation(Conservation) :-
a warning.'
),
solution_to_conservation
(
Conservation
,
C
),
add_item
(
conservation
,
[],
Conservation
,
Id
),
add_item
(
[
kind
:
conservation
,
item
:
Conservation
,
id
:
Id
]
),
set_annotation
(
Id
,
conservation_list
,
C
).
...
...
conservation_laws.plt
View file @
4292f8d4
...
...
@@ -7,14 +7,14 @@
test(
'add_conservation adds a conservation',
[
setup(
models:
clear_model),
cleanup(
models:
clear_model),
setup(clear_model),
cleanup(clear_model),
forall(member(Input, ['a-a' + 2*'a', 'b', 'a' + 'b'])),
true(Conservations == [Input])
]
) :-
command(add_conservation(Input)),
all_items([
model: current_model,
kind: conservation], Conservations).
all_items([kind: conservation], Conservations).
%%% FIXME should test that conservations are properly used for numerical
%%% integration
...
...
@@ -23,31 +23,31 @@ test(
'delete_conservation deletes the correct conservation',
[
setup(set_some_conservations),
cleanup(
models:
clear_model),
cleanup(clear_model),
true(Conservations == ['a-a'+2*a,'c-c'+2*c])
]
) :-
command(delete_conservation(b-b + 2*b)),
all_items([
model: current_model,
kind: conservation], Conservations).
all_items([kind: conservation], Conservations).
test(
'delete_conservations deletes all conservations',
[
setup(set_some_conservations),
cleanup(
models:
clear_model),
cleanup(clear_model),
true(Conservations == [])
]
) :-
command(delete_conservations),
all_items([
model: current_model,
kind: conservation], Conservations).
all_items([kind: conservation], Conservations).
test(
'list_conservations lists all conservations',
[
setup(set_some_conservations),
cleanup(
models:
clear_model),
cleanup(clear_model),
true(Conservations ==
'[0] a-a+2*a\n[1] b-b+2*b\n[2] c-c+2*c\n')
]
...
...
@@ -58,8 +58,8 @@ test(
test(
'check_conservations is ok with trivial P-invariants',
[
setup((
models:
clear_model, set_prolog_flag(verbose, silent))),
cleanup((
models:
clear_model, set_prolog_flag(verbose, normal)))
setup((clear_model, set_prolog_flag(verbose, silent))),
cleanup((clear_model, set_prolog_flag(verbose, normal)))
]
) :-
command(add_reaction(a => b)),
...
...
@@ -71,8 +71,8 @@ test(
test(
'check_conservations is ok with kinetically conserved moieties',
[
setup((
models:
clear_model, set_prolog_flag(verbose, silent))),
cleanup((
models:
clear_model, set_prolog_flag(verbose, normal)))
setup((clear_model, set_prolog_flag(verbose, silent))),
cleanup((clear_model, set_prolog_flag(verbose, normal)))
]
) :-
command(add_reaction(k*[a] for a => b)),
...
...
@@ -84,8 +84,8 @@ test(
test(
'check_conservations is unhappy with non-conserved moieties',
[
setup((
models:
clear_model, set_prolog_flag(verbose, silent))),
cleanup((
models:
clear_model, set_prolog_flag(verbose, normal))),
setup((clear_model, set_prolog_flag(verbose, silent))),
cleanup((clear_model, set_prolog_flag(verbose, normal))),
true(Warnings == 1)
]
) :-
...
...
@@ -101,7 +101,7 @@ test(
set_some_conservations :-
models:
clear_model,
clear_model,
command(add_conservation(a-a + 2*a)),
command(add_conservation(b-b + 2*b)),
command(add_conservation(c-c + 2*c)).
...
...
doc.pl
View file @
4292f8d4
...
...
@@ -36,7 +36,7 @@ biocham_silent(_).
generate_doc
:-
set_plot_driver
(
plot_png
),
set_plot_driver
(
gnu_
plot_png
),
set_counter
(
plot_png
,
0
),
generate_doc
(
doc
),
generate_doc
(
devdoc
).
...
...
@@ -839,6 +839,10 @@ write_command(begin, enumerate, Stream) :-
nb_setval
(
opened_li
,
false
),
write
(
Stream
,
'</div>\n<ol>\n'
).
write_command
(
begin
,
example
,
Stream
)
:-
!,
write
(
Stream
,
'</div><div class="example"><div><strong>Example.</strong> '
).
write_command
(
item
,
Argument
,
Stream
)
:-
!,
close_opened_li
(
Stream
),
...
...
@@ -856,18 +860,17 @@ write_command(end, enumerate, Stream) :-
close_opened_li
(
Stream
),
write
(
Stream
,
'</ol>\n<div>'
).
write_command
(
example
,
Argument
,
Stream
)
:-
write_command
(
end
,
example
,
Doc
)
:-
!,
write
(
Stream
,
'</div>\n<div><strong>Example.</strong> '
),
write_doc
(
Stream
,
Argument
).
write
(
Doc
,
'</div></div><div>'
).
write_command
(
section
,
Argument
,
Stream
)
:-
!,
nb_getval
(
current_counters
,
Counters
),
length
(
Coun
n
ters
,
CounterCount
),
length
(
Counters
,
CounterCount
),
SectionLevel
is
CounterCount
+
2
,
format
(
Stream
,
'</div>\n<h~d>'
,
[
SectionLevel
]),
write_doc
(
Stream
,
Argument
)
write_doc
(
Stream
,
Argument
)
,
format
(
Stream
,
'</h~d>\n<div>'
,
[
SectionLevel
]).
write_command
(
Command
,
_Argument
,
_Stream
)
:-
...
...
graph_editor.pl
0 → 100644
View file @
4292f8d4
:-
module
(
graph_editor
,
[
new_graph
/
0
,
delete_graph
/
1
,
set_graph_name
/
1
,
list_graphs
/
0
,
select_graph
/
1
,
draw_graph
/
0
,
export_graph
/
1
,
add_vertex
/
1
,
delete_vertex
/
1
,
add_attribute
/
2
,
delete_attribute
/
2
,
list_attributes
/
1
,
edge
/
1
,
add_edge
/
1
,
delete_edge
/
1
,
list_edges
/
0
,
get_current_graph
/
1
]
).
:-
devdoc
(
'\\section{Commands}'
).
new_graph
:-
biocham_command
,
doc
(
'Creates a new graph.'
),
add_item
([
kind
:
graph
,
key
:
new_graph
,
id
:
Id
]),
set_current_graph
(
Id
).
delete_graph
(
Name
)
:-
biocham_command
,
type
(
Name
,
name
),
doc
(
'Deletes a graph.'
),
delete_items
([
kind
:
graph
,
key
:
Name
]).
set_graph_name
(
Name
)
:-
biocham_command
,
type
(
Name
,
name
),
doc
(
'Sets the name of the current graph.'
),
get_current_graph
(
Id
),
replace_item
(
Id
,
graph
,
Name
,
Name
).
list_graphs
:-
biocham_command
,
doc
(
'Lists the graph of the current model.'
),
list_items
([
kind
:
graph
]).
select_graph
(
Name
)
:-
biocham_command
,
type
(
Name
,
name
),
doc
(
'Selects a graph'
),
find_item
([
kind
:
graph
,
key
:
Name
,
id
:
Id
]),
set_current_graph
(
Id
).
draw_graph
:-
biocham_command
,
doc
(
''
).
export_graph
(
Argument
)
:-
biocham_command
,
type
(
Argument
,
type
),
doc
(
''
).
add_vertex
(
Name
)
:-
biocham_command
,
type
(
Name
,
name
),
doc
(
'Adds a vertex to the current graph.'
),
get_current_graph
(
GraphId
),
add_item
([
parent
:
GraphId
,
kind
:
vertex
,
key
:
Name
]).
delete_vertex
(
Name
)
:-
biocham_command
,
type
(
Name
,
name
),
doc
(
'Removes a vertex from the current graph.'
),
get_current_graph
(
GraphId
),
delete_item
([
parent
:
GraphId
,
kind
:
vertex
,
key
:
Name
]).
add_attribute
(
Name
,
Attribute
)
:-
biocham_command
,
type
(
Name
,
name
),
type
(
Attribute
,
name
),
doc
(
'Adds an attribute to a vertex.'
),
find_vertex
(
Name
,
Id
),
(
find_item
([
parent
:
Id
,
kind
:
attribute
,
key
:
Attribute
])
->
true
;
add_item
([
parent
:
Id
,
kind
:
attribute
,
key
:
Attribute
])
).
delete_attribute
(
Name
,
Attribute
)
:-
biocham_command
,
type
(
Name
,
name
),
type
(
Abbribute
,
name
),
doc
(
'Removes an attribute from a vertex.'
),
find_vertex
(
Name
,
Id
),
delete_item
([
parent
:
Id
,
kind
:
attribute
,
key
:
Attribute
]).
list_attributes
(
Name
)
:-
biocham_command
,
type
(
Name
,
name
),
doc
(
'List the attributes of a vertex.'
),
find_vertex
(
Name
,
Id
),
list_items
([
parent
:
Id
,
kind
:
attribute
]).
:-
grammar
(
edge
).
edge
(
From
->
To
)
:-
name
(
From
),
name
(
To
).
add_edge
(
Edge
)
:-
biocham_command
,
type
(
Edge
,
edge
),
doc
(
'Adds an edge'
),
Edge
=
(
From
->
To
),
find_vertex
(
From
,
FromId
),
find_vertex
(
To
,
ToId
),
get_current_graph
(
GraphId
),
add_item
([
parent
:
GraphId
,
kind
:
edge
,
key
:
Edge
,
id
:
Id
]),
add_dependency
(
Id
,
FromId
),
add_dependency
(
Id
,
ToId
).
delete_edge
(
Edge
)
:-
biocham_command
,
type
(
Edge
,
edge
),
doc
(
'Deletes an edge'
),
get_current_graph
(
GraphId
),
delete_item
([
parent
:
GraphId
,
kind
:
edge
,
key
:
Edge
]).
list_edges
:-
biocham_command
,
doc
(
'Lists the edges of the current graph'
),
get_current_graph
(
GraphId
),
list_items
([
parent
:
GraphId
,
kind
:
edge
]).
:-
devdoc
(
'\\section{End of commands}'
).
find_vertex
(
Name
,
Id
)
:-
get_current_graph
(
GraphId
),
find_item
([
parent
:
GraphId
,
kind
:
vertex
,
key
:
Name
,
id
:
Id
]).
deselect_graph
:-
\
+
(
item
([
kind
:
Graph
,
id
:
Id
]),
\
+
(
(
delete_annotation
(
Id
,
selected
)
->
true
;
true
)
)
).
set_current_graph
(
Id
)
:-
deselect_graph
,
set_annotation
(
Id
,
selected
,
selected
).
get_current_graph
(
Id
)
:-
(
item
([
kind
:
Graph
,
id
:
Id
]),
get_annotation
(
Id
,
selected
,
selected
)
->
true
;
throw
(
error
(
no_graph_selected
))
).
initial_state.pl
View file @
4292f8d4
...
...
@@ -17,7 +17,7 @@
get_initial_state
(
Object
,
State
)
:-
(
item
([
model
:
current_model
,
kind
:
initial_state
,
key
:
Object
,
item
:
Item
])
item
([
kind
:
initial_state
,
key
:
Object
,
item
:
Item
])
->
(
Item
=
present
(
Object
)
...
...
@@ -59,7 +59,7 @@ list_initial_state :-
doc
(
'
lists the objects which are present (including their initial concentration)
and absent from the initial state.'
),
list_items
([
model
:
current_model
,
kind
:
initial_state
]).
list_items
([
kind
:
initial_state
]).
clear_initial_state
:-
...
...
@@ -67,12 +67,7 @@ clear_initial_state :-
doc
(
'
makes undefined all objects possibly present or absent in the initial
state.'
),
\
+
(
item
([
model
:
current_model
,
kind
:
initial_state
,
id
:
Id
]),
\
+
(
delete_item
(
Id
)
)
).
delete_items
([
kind
:
initial_state
]).
present
(
ObjectSet
)
:-
...
...
@@ -109,7 +104,7 @@ set_state(ObjectSet, Object, State) :-
member
(
Object
,
ObjectSet
),
\
+
(
undefined_object
(
Object
),
add_item
(
initial_state
,
Object
,
State
)
add_item
(
[
kind
:
initial_state
,
key
:
Object
,
item
:
State
]
)
)
).
...
...
@@ -130,7 +125,7 @@ undefined(ObjectSet) :-
undefined_object
(
Object
)
:-
(
item
([
model
:
current_model
,
kind
:
initial_state
,
key
:
Object
,
id
:
Id
])
item
([
kind
:
initial_state
,
key
:
Object
,
id
:
Id
])
->
delete_item
(
Id
)
;
...
...
@@ -169,4 +164,4 @@ make_absent_not_present :-
defined
(
Object
)
:-
once
(
item
([
model
:
current_model
,
kind
:
initial_state
,
key
:
Object
])).
once
(
item
([
kind
:
initial_state
,
key
:
Object
])).
initial_state.plt
View file @
4292f8d4
...
...
@@ -8,7 +8,7 @@ test(
) :-
clear_model,
command(present({ a, b })),
all_items([
model: current_model,
kind: initial_state], InitialState).
all_items([kind: initial_state], InitialState).
test(
'absent',
...
...
@@ -16,7 +16,7 @@ test(
) :-
clear_model,
command(absent({ a, b })),
all_items([
model: current_model,
kind: initial_state], InitialState).
all_items([kind: initial_state], InitialState).
test(
'undefined',
...
...
@@ -26,7 +26,7 @@ test(
command(present({ a, b, c })),
command(absent({ b, c, e })),
command(undefined({ c, d, e })),
all_items([
model: current_model,
kind: initial_state], InitialState).
all_items([kind: initial_state], InitialState).
test(
'make_absent_not_present',
...
...
@@ -36,7 +36,7 @@ test(
add_reaction(a => b),
command(present(a)),
make_absent_not_present,
all_items([
model: current_model,
kind: initial_state], InitialState).
all_items([kind: initial_state], InitialState).
test(
'make_present_not_absent',
...
...
@@ -46,6 +46,6 @@ test(
add_reaction(a => b),
command(absent(a)),
make_present_not_absent,
all_items([
model: current_model,
kind: initial_state], InitialState).
all_items([kind: initial_state], InitialState).
:- end_tests(initial_state).
install-macos.sh
View file @
4292f8d4
#!/bin/sh
brew
install
swi-prolog gsl libsbml
brew
install
swi-prolog gsl libsbml
gnuplot
macros.pl
View file @
4292f8d4
...
...
@@ -21,7 +21,7 @@ set_macro(MacroList) :-
replace_item
(
Id
,
macro
,
Macro
,
macro
(
Macro
=
Value
))
),
error
(
unknown_item
),
add_item
(
macro
,
Macro
,
macro
(
Macro
=
Value
))
add_item
(
[
kind
:
macro
,
key
:
Macro
,
item
:
macro
(
Macro
=
Value
)
]
)
)
)
).
...
...
@@ -31,9 +31,7 @@ show_macro(Macro) :-
biocham_command
,
type
(
Macro
,
macro
),
doc
(
'shows the expression associated to the given macro.'
),
find_item
(
[
model
:
current_model
,
kind
:
macro
,
key
:
Macro
,
item
:
macro
(
_
=
Expression
)]
),
find_item
([
kind
:
macro
,
key
:
Macro
,
item
:
macro
(
_
=
Expression
)]),
write
(
Expression
),
nl
.
...
...
@@ -41,7 +39,7 @@ show_macro(Macro) :-
list_macros
:-
biocham_command
,
doc
(
'lists all known macros.'
),
list_items
([
model
:
current_model
,
kind
:
macro
]).
list_items
([
kind
:
macro
]).
delete_macro
(
MacroSet
)
:-
...
...
@@ -51,7 +49,6 @@ delete_macro(MacroSet) :-
\
+
(
member
(
Macro
,
MacroSet
),
\
+
(
find_item
([
model
:
current_model
,
kind
:
macro
,
key
:
Macro
,
id
:
Id
]),
delete_item
(
Id
)
delete_item
([
kind
:
macro
,
key
:
Macro
])
)
).
macros.plt
View file @
4292f8d4
...
...
@@ -9,6 +9,6 @@ test(
clear_model,
command(set_macro(a = 1, b = 2)),
command(set_macro(b = 3)),
all_items([
model: current_model,
kind: macro], Macros).
all_items([kind: macro], Macros).
:- end_tests(macros).
models.pl
View file @
4292f8d4
...
...
@@ -2,20 +2,23 @@
models
,
[
load
/
1
,
add
/
1
,
load_biocham
/
1
,
add_biocham
/
1
,
new_model
/
0
,
clear_model
/
0
,
get_model_name
/
1
,
get_model_name
/
2
,
set_model_name
/
1
,
list_models
/
0
,
list_current_models
/
0
,
range
/
1
,
ref
/
1
,
select_model
/
1
,
set_model_name
/
1
,
delete
/
1
,
get_model_name
/
1
,
get_model_name
/
2
,
current_models
/
1
,
single_model
/
1
,
add_item
/
2
,
add_item
/
3
,
add_item
/
4
,
add_item
/
1
,
replace_item
/
4
,
set_annotation
/
3
,
get_annotation
/
3
,
...
...
@@ -28,14 +31,12 @@
list_ids
/
1
,
delete_item
/
1
,
delete_items
/
1
,
delete
/
1
,
range
/
1
add_dependency
/
2
]
).
:-
dynamic
(
fresh
/
0
).
:-
devdoc
(
'\\section{Commands}'
).
load
(
InputFile
)
:-
...
...
@@ -85,6 +86,113 @@ add_biocham(InputFile) :-
add_all
(
'.bc'
,
InputFile
).
new_model
:-
biocham_command
,
doc
(
'opens a new fresh model.'
),
new_model
(
_Id
).
clear_model
:-
biocham_command
,
doc
(
'clears the current model.'
),
current_models
(
CurrentModels
),
\
+
(
member
(
Id
,
CurrentModels
),
\
+
(
delete_item
(
Id
)
)
).
list_models
:-
biocham_command
,
doc
(
'lists all open models'
),
list_items
([
parent
:
top
,
kind
:
model
]).
list_current_models
:-
biocham_command
,
doc
(
'lists current models'
),
current_models
(
CurrentModels
),
list_ids
(
CurrentModels
).
:-
grammar
(
range
).
range
(
Integer0
-
Integer1
)
:-
integer
(
Integer0
),
integer
(
Integer1
).
range
(
Integer
)
:-
integer
(
Integer
).
:-
grammar
(
ref
).
ref
(
Range
)
:-
list
(
range
,
Range
).
ref
(
Name
)
:-
name
(
Name
).
select_model
(
RefSet
)
:-
biocham_command
,
type
(
RefSet
,
{
ref
}),
doc
(
'selects some models.'
),
findall
(
Id
,
(
member
(
Ref
,
RefSet
),