Commit d88a4ae5 authored by HUANG Wei Chih's avatar HUANG Wei Chih
Browse files

add option to toggle ma/mm kinetics of zero-order ultrasensitivity sigmoid...

add option to toggle ma/mm kinetics of zero-order ultrasensitivity sigmoid function and make document genetation time short
parent de932e8c
......@@ -16,7 +16,8 @@ option(
conservation_size: 4,
query: current_spec,
output_to_library: no,
simplify_variable_init: no
simplify_variable_init: no, % used in odefunction.pl
zero_ultra_mm: no % used in odefunction.pl
).
......@@ -381,6 +381,8 @@ control_flow_keyword( 'endwhile' ).
add_function(FunctionList) :-
biocham_command(*),
type(FunctionList, '*'(term = term)),
option( 'zero_ultra_mm', yesno, _,
'set the kinetics of zero-order ultrasensitivity to Michaelis-Menten kinetics' ),
devdoc( "Compile the statement into chemical reactions." ),
doc('
adds reactions to compute the result of a function of the current variables in the concentration of a new variable, at steady state.
......@@ -416,6 +418,8 @@ compile_program( InputFile ) :-
type( InputFile, input_file ),
option( 'simplify_variable_init', yesno, _,
'set if the variable initialization in program need to be simplified to \\emph{present} command' ),
option( 'zero_ultra_mm', yesno, _,
'set the kinetics of zero-order ultrasensitivity to Michaelis-Menten kinetics' ),
devdoc( "Transform the terms in a file into internal list format of 'add_function'." ),
doc( "Compile the high-level language program from file." ),
......@@ -431,18 +435,18 @@ compile_program( Program ) :-
doc( "Using atom \\emph{Program} as the program code." ),
doc( "We can write the follwing program and compile it in reactions." ),
biocham_silent( clear_model ),
biocham( compile_program( 'z := 2. x := z + 1. y := x - z.' ) ),
biocham( compile_program( 'z := 2. x := z + 1. y := x - z.', zero_ultra_mm: yes ) ),
biocham( numerical_simulation( time: 60, method: msbdf ) ),
biocham( plot( show:{ x_p, x_n, y_p, y_n, z_p, z_n } ) ),
doc( "This is equivalent to '\\texttt{add_function( z = ( 2 post ), x = ( pre z + 1 post ), y = ( pre x - z )).}' and can be compared with the parallel version of the program, without pre and post conditions."),
biocham( clear_model ),
biocham( compile_program( 'z := 2, x := z + 1, y := x - z.' ) ),
biocham( compile_program( 'z := 2, x := z + 1, y := x - z.', zero_ultra_mm: yes ) ),
biocham( numerical_simulation( time: 20 ) ),
biocham( plot( show:{ x_p, x_n, y_p, y_n, z_p, z_n } ) ),
doc( "Here is an example shows the compilation result of euclid division: "),
biocham_silent( clear_model ),
biocham( compile_program( 'a := 7, b := 3. while( a >= b ). t1 := a - b, t2 := q + 1. a := t1, q := t2. endwhile. r := a.', simplify_variable_init: yes ) ),
biocham( compile_program( 'a := 7, b := 3. while( a >= b ). t1 := a - b, t2 := q + 1. a := t1, q := t2. endwhile. r := a.', simplify_variable_init: yes, zero_ultra_mm: yes ) ),
biocham( numerical_simulation( time: 200, method: msbdf ) ),
biocham( plot( show:{ a_p, a_n, b_p, b_n, q_p, q_n, r_p, r_n } ) ),
doc( "\\end{example}" ),
......@@ -2536,10 +2540,18 @@ init_sin( OdeSystem, Z, T, G ) :-
pos_sigmoid_to_PIVP( OdeSystem, X, Z ) :-
constant( true, True ),
Threshold is True / 2,
new_variable( T ),
zero_order_ma_to_PIVP( OdeSystem, Threshold, X, _, T ),
multiplication_to_PIVP( OdeSystem, T, 0.01, Z ).
get_option( 'zero_ultra_mm', MM ),
(
MM == no
->
new_variable( T ),
zero_order_ma_to_PIVP( OdeSystem, Threshold, X, _, T ),
multiplication_to_PIVP( OdeSystem, T, 0.01, Z )
;
zero_order_to_PIVP( OdeSystem, Threshold, X, _, Z )
).
% }}}
/* z = neg_sigmoid( x ):{{{
*
......@@ -2553,10 +2565,18 @@ pos_sigmoid_to_PIVP( OdeSystem, X, Z ) :-
neg_sigmoid_to_PIVP( OdeSystem, X, Z ) :-
constant( true, True ),
Threshold is True / 2,
new_variable( T ),
zero_order_ma_to_PIVP( OdeSystem, Threshold, X, T, _, true ),
multiplication_to_PIVP( OdeSystem, T, 0.01, Z ).
get_option( 'zero_ultra_mm', MM ),
(
MM == no
->
new_variable( T ),
zero_order_ma_to_PIVP( OdeSystem, Threshold, X, T, _, true ),
multiplication_to_PIVP( OdeSystem, T, 0.01, Z )
;
zero_order_to_PIVP( OdeSystem, Threshold, X, Z, _, true )
).
% }}}
/* z = pos_number_to_bool( x ):{{{
*
......@@ -2568,9 +2588,17 @@ neg_sigmoid_to_PIVP( OdeSystem, X, Z ) :-
% The output is true when input is greater than a theshold, otherwise it is false.
% Ideally, the theshold should be close to 0.
pos_number_to_bool_to_PIVP( OdeSystem, X, Z ) :-
new_variable( T ),
zero_order_ma_to_PIVP( OdeSystem, 0.2, X, _, T ),
multiplication_to_PIVP( OdeSystem, T, 0.01, Z ).
get_option( 'zero_ultra_mm', MM ),
(
MM == no
->
new_variable( T ),
zero_order_ma_to_PIVP( OdeSystem, 0.2, X, _, T ),
multiplication_to_PIVP( OdeSystem, T, 0.01, Z )
;
zero_order_to_PIVP( OdeSystem, 0.2, X, _, Z )
).
%% pos_number_to_bool_to_PIVP(+OdeSytem:'ode system', +VariableXName:name, +VariableZName:name, ++Bidir ) is det
%
......@@ -2593,9 +2621,17 @@ pos_number_to_bool_to_PIVP( OdeSystem, X, Z, bidir ) :-
% The output is true when input is smaller than a theshold, otherwise it is false.
% Ideally, the theshold should be close to 0.
neg_number_to_bool_to_PIVP( OdeSystem, X, Z ) :-
new_variable( T ),
zero_order_ma_to_PIVP( OdeSystem, 0.2, X, T, _, true ),
multiplication_to_PIVP( OdeSystem, T, 0.01, Z ).
get_option( 'zero_ultra_mm', MM ),
(
MM == no
->
new_variable( T ),
zero_order_ma_to_PIVP( OdeSystem, 0.2, X, T, _, true ),
multiplication_to_PIVP( OdeSystem, T, 0.01, Z )
;
zero_order_to_PIVP( OdeSystem, 0.2, X, Z, _, true )
).
%% neg_number_to_bool_to_PIVP(+OdeSytem:'ode system', +VariableXName:name, +VariableZName:name, Bidir ) is det
%
......
Supports Markdown
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