Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Gitlab will go into maintenance Friday 3rd February from 9:00 to 10:00
Open sidebar
LCSB-BioCore
SBML.jl
Commits
aefe4708
Commit
aefe4708
authored
Apr 13, 2021
by
Miroslav Kratochvil
🚴
Browse files
add space for kineticLaw math rules
parent
8d14fb90
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/SBML.jl
View file @
aefe4708
...
...
@@ -6,6 +6,7 @@ using SparseArrays
include
(
"structs.jl"
)
include
(
"version.jl"
)
include
(
"readsbml.jl"
)
include
(
"math.jl"
)
include
(
"utils.jl"
)
sbml
=
(
sym
::
Symbol
)
->
dlsym
(
SBML_jll
.
libsbml_handle
,
sym
)
...
...
src/math.jl
0 → 100644
View file @
aefe4708
"""
parseMath(ast::VPtr)::Math
This attempts to parse out a decent Julia-esque ([`Math`](@ref) AST from a
pointer to `ASTNode_t`.
"""
function
parseMath
(
ast
::
VPtr
)
::
Math
@info
"got
$
ast"
MathIdent
(
"placeholder"
)
end
src/readsbml.jl
View file @
aefe4708
...
...
@@ -216,6 +216,7 @@ function extractModel(mdl::VPtr)::Model
lb = (-Inf, "") # (bound value, unit id)
ub = (Inf, "")
oc = 0.0
math = nothing
# kinetic laws store a second version of the bounds and objectives
kl = ccall(sbml(:Reaction_getKineticLaw), VPtr, (VPtr,), re)
...
...
@@ -233,6 +234,10 @@ function extractModel(mdl::VPtr)::Model
oc = pval()
end
end
if ccall(sbml(:KineticLaw_isSetMath), Cint, (VPtr,), kl) != 0
math = parseMath(ccall(sbml(:KineticLaw_getMath), VPtr, (VPtr,), kl))
end
end
# TRICKY: SBML spec is completely silent about what should happen if
...
...
@@ -272,6 +277,7 @@ function extractModel(mdl::VPtr)::Model
add_stoi(sr, 1)
end
# gene product associations
association = nothing
if re_fbc != C_NULL
gpa = ccall(
...
...
@@ -294,6 +300,7 @@ function extractModel(mdl::VPtr)::Model
ub,
haskey(objectives_fbc, reid) ? objectives_fbc[reid] : oc,
association,
math,
getNotes(re),
getAnnotation(re),
)
...
...
src/structs.jl
View file @
aefe4708
...
...
@@ -55,6 +55,33 @@ struct GPAOr <: GeneProductAssociation
terms
::
Vector
{
GeneProductAssociation
}
end
"""
A simplified representation of MathML-specified math AST
"""
abstract type
Math
end
"""
A literal value (usually a numeric constant) in mathematical expression
"""
struct
MathVal
{
T
}
<:
Math
where
{
T
}
val
::
T
end
"""
An identifier (usually a variable name) in mathematical expression
"""
struct
MathIdent
<:
Math
id
::
String
end
"""
Function application ("
call
by
name
", no tricks allowed) in mathematical expression
"""
struct
MathApply
<:
Math
fn
::
String
attributes
::
Dict
{
String
,
String
}
args
::
Vector
{
Math
}
end
"""
Reaction with stoichiometry that assigns reactants and products their relative
...
...
@@ -68,9 +95,10 @@ struct Reaction
ub
::
Tuple
{
Float64
,
String
}
oc
::
Float64
gene_product_association
::
Maybe
{
GeneProductAssociation
}
kinetic_math
::
Maybe
{
Math
}
notes
::
Maybe
{
String
}
annotation
::
Maybe
{
String
}
Reaction
(
s
,
l
,
u
,
o
,
as
,
n
=
nothing
,
an
=
nothing
)
=
new
(
s
,
l
,
u
,
o
,
as
,
n
,
an
)
Reaction
(
s
,
l
,
u
,
o
,
as
,
km
,
n
=
nothing
,
an
=
nothing
)
=
new
(
s
,
l
,
u
,
o
,
as
,
km
,
n
,
an
)
end
"""
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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