Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LCSB-BioCore
SBML.jl
Commits
f2db233d
Commit
f2db233d
authored
Mar 14, 2021
by
St. Elmo
Committed by
Miroslav Kratochvil
Mar 15, 2021
Browse files
read notes from species, reactions and models
Co-authored-by:
Mirek Kratochvil
<
miroslav.kratochvil@uni.lu
>
parent
8b58a03a
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/SBML.jl
View file @
f2db233d
...
...
@@ -11,6 +11,6 @@ include("utils.jl")
sbml
=
(
sym
::
Symbol
)
->
dlsym
(
SBML_jll
.
libsbml_handle
,
sym
)
export
SBMLVersion
,
readSBML
,
Model
,
UnitPart
,
Species
,
Reaction
,
getS
,
getLBs
,
getUBs
,
getOCs
readSBML
,
Model
,
Maybe
,
UnitPart
,
Species
,
Reaction
,
getS
,
getLBs
,
getUBs
,
getOCs
end
# module
src/readsbml.jl
View file @
f2db233d
...
...
@@ -31,6 +31,15 @@ function readSBML(fn::String)::Model
end
end
function
getNotes
(
x
::
VPtr
)
::
Maybe
{
String
}
str
=
ccall
(
sbml
(
:
SBase_getNotesString
),
Cstring
,
(
VPtr
,),
x
)
if
str
!=
C_NULL
return
unsafe_string
(
str
)
else
return
nothing
end
end
function
extractModel
(
mdl
::
VPtr
)
::
Model
mdl_fbc
=
ccall
(
sbml
(
:
SBase_getPlugin
),
VPtr
,
(
VPtr
,
Cstring
),
mdl
,
"fbc"
)
...
...
@@ -104,6 +113,7 @@ function extractModel(mdl::VPtr)::Model
unsafe_string
(
ccall
(
sbml
(
:
Species_getCompartment
),
Cstring
,
(
VPtr
,),
sp
)),
formula
,
charge
,
getNotes
(
sp
),
)
end
...
...
@@ -193,9 +203,14 @@ function extractModel(mdl::VPtr)::Model
end
reid
=
unsafe_string
(
ccall
(
sbml
(
:
Reaction_getId
),
Cstring
,
(
VPtr
,),
re
))
reactions
[
reid
]
=
Reaction
(
stoi
,
lb
,
ub
,
haskey
(
objectives_fbc
,
reid
)
?
objectives_fbc
[
reid
]
:
oc
)
reactions
[
reid
]
=
Reaction
(
stoi
,
lb
,
ub
,
haskey
(
objectives_fbc
,
reid
)
?
objectives_fbc
[
reid
]
:
oc
,
getNotes
(
re
),
)
end
return
Model
(
parameters
,
units
,
compartments
,
species
,
reactions
)
return
Model
(
parameters
,
units
,
compartments
,
species
,
reactions
,
getNotes
(
mdl
)
)
end
src/structs.jl
View file @
f2db233d
const
Maybe
{
X
}
=
Union
{
Nothing
,
X
}
"""
Part of a measurement unit definition that corresponds to the SBML definition
of `Unit`. For example, the unit "
per
square
megahour
", Mh^(-2), is written as:
...
...
@@ -31,7 +33,8 @@ struct Reaction
lb
::
Tuple
{
Float64
,
String
}
ub
::
Tuple
{
Float64
,
String
}
oc
::
Float64
Reaction
(
s
,
l
,
u
,
o
)
=
new
(
s
,
l
,
u
,
o
)
notes
::
Maybe
{
String
}
Reaction
(
s
,
l
,
u
,
o
,
n
)
=
new
(
s
,
l
,
u
,
o
,
n
)
end
"""
...
...
@@ -42,8 +45,9 @@ struct Species
name
::
String
compartment
::
String
formula
::
String
charge
::
Union
{
Nothing
,
Int
}
Species
(
n
,
co
,
f
,
ch
)
=
new
(
n
,
co
,
f
,
ch
)
charge
::
Maybe
{
Int
}
notes
::
Maybe
{
String
}
Species
(
na
,
co
,
f
,
ch
,
no
)
=
new
(
na
,
co
,
f
,
ch
,
no
)
end
"""
...
...
@@ -57,5 +61,6 @@ struct Model
compartments
::
Vector
{
String
}
species
::
Dict
{
String
,
Species
}
reactions
::
Dict
{
String
,
Reaction
}
Model
(
p
,
u
,
c
,
s
,
r
)
=
new
(
p
,
u
,
c
,
s
,
r
)
notes
::
Maybe
{
String
}
Model
(
p
,
u
,
c
,
s
,
r
,
n
)
=
new
(
p
,
u
,
c
,
s
,
r
,
n
)
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