Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LCSB-BioCore
SBML.jl
Commits
eb12d0cc
Unverified
Commit
eb12d0cc
authored
Jun 27, 2021
by
Miroslav Kratochvil
Committed by
GitHub
Jun 27, 2021
Browse files
Merge pull request #98 from LCSB-BioCore/mk-aj-math
comprehensive math
parents
bae9557e
52a28006
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/symbolics.jl
View file @
eb12d0cc
...
...
@@ -11,22 +11,57 @@ unambiguously represented in Julia; it is supposed to be extended by the user
if more functions need to be supported.
"""
const
default_symbolics_mapping
=
Dict
{
String
,
Any
}(
"*"
=>
:*
,
"+"
=>
:+
,
"-"
=>
:-
,
"*"
=>
:*
,
"/"
=>
:/
,
"power"
=>
:^
,
"lt"
=>
:<
,
"leq"
=>
:<=
,
"geq"
=>
:>=
,
"gt"
=>
:>
,
"abs"
=>
:
abs
,
"arccos"
=>
:
acos
,
"arccosh"
=>
:
acosh
,
"arccot"
=>
:
acot
,
"arccoth"
=>
:
acoth
,
"arccsc"
=>
:
acsc
,
"arccsch"
=>
:
acsch
,
"arcsec"
=>
:
asec
,
"arcsech"
=>
:
asech
,
"arcsin"
=>
:
asin
,
"arcsinh"
=>
:
asinh
,
"arctan"
=>
:
atan
,
"arctanh"
=>
:
atanh
,
"ceiling"
=>
:
ceil
,
"cos"
=>
:
cos
,
"cosh"
=>
:
cosh
,
"cot"
=>
:
cot
,
"coth"
=>
:
coth
,
"csc"
=>
:
csc
,
"csch"
=>
:
csch
,
"eq"
=>
:
isequal
,
"exp"
=>
:
exp
,
"factorial"
=>
:
factorial
,
"floor"
=>
:
floor
,
"piecewise"
=>
:
(
Core
.
ifelse
),
"geq"
=>
:>=
,
"gt"
=>
:>
,
"leq"
=>
:<=
,
"ln"
=>
:
log
,
"exp"
=>
:
exp
,
"log"
=>
:
sbmlLog
,
"lt"
=>
:<
,
"piecewise"
=>
:
(
Core
.
ifelse
),
"power"
=>
:^
,
"root"
=>
:
sbmlRoot
,
"sech"
=>
:
sech
,
"sec"
=>
:
sec
,
"sinh"
=>
:
sinh
,
"sin"
=>
:
sin
,
"tanh"
=>
:
tanh
,
"tan"
=>
:
tan
,
)
sbmlLog
(
x
)
=
log
(
x
,
10
)
sbmlLog
(
base
,
x
)
=
log
(
base
,
x
)
sbmlRoot
(
x
)
=
sqrt
(
x
)
sbmlRoot
(
power
,
x
)
=
x
^
(
1
/
power
)
allowed_sym
(
x
,
allowed_funs
)
=
haskey
(
allowed_funs
,
x
)
?
allowed_funs
[
x
]
:
throw
(
DomainError
(
x
,
"Unknown SBML function"
))
...
...
test/loadmodels.jl
View file @
eb12d0cc
...
...
@@ -40,6 +40,14 @@ sbmlfiles = [
4
,
2
,
),
# this contains some special math
(
joinpath
(
@__DIR__
,
"data"
,
"sbml01565.xml"
),
"https://raw.githubusercontent.com/sbmlteam/sbml-test-suite/master/cases/semantic/01565/01565-sbml-l3v1.xml"
,
"14a80fbce316eea2adb566f67b4668ad151db8954e487309852ece7f730c8c99"
,
104
,
52
,
),
]
@testset
"Loading of models from various sources"
begin
...
...
@@ -108,3 +116,12 @@ end
@test
subterm
.
args
[
1
]
==
SBML
.
MathIdent
(
"S1"
)
@test
isapprox
(
subterm
.
args
[
2
]
.
val
,
1.0
)
end
@testset
"logBase and root math functions"
begin
m
=
readSBML
(
joinpath
(
@__DIR__
,
"data"
,
"sbml01565.xml"
))
@test
convert
(
Num
,
m
.
reactions
[
"J23"
]
.
kinetic_math
)
==
0.0
@variables
S29
S29b
@test
isequal
(
convert
(
Num
,
m
.
reactions
[
"J29"
]
.
kinetic_math
),
2.0
*
S29
*
S29b
)
end
cylon-x
🤖
@cylon-x
mentioned in commit
7e99eeb6
·
Jun 27, 2021
mentioned in commit
7e99eeb6
mentioned in commit 7e99eeb6da6a35882a1234bc6befd95fb93e9c74
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment