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
3500090e
Unverified
Commit
3500090e
authored
Jun 15, 2021
by
Miroslav Kratochvil
Committed by
GitHub
Jun 15, 2021
Browse files
Merge pull request #58 from LCSB-BioCore/mk-init-cs
add initial concentration, fix certainty of units
parents
d8e40b32
42299f85
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/converters.jl
View file @
3500090e
"""
conver
t_level_and_version(level, version)
se
t_level_and_version(level, version)
A converter to pass into [`readSBML`](@ref) that enforces certain SBML level
and version.
"""
conver
t_level_and_version
(
level
,
version
)
=
se
t_level_and_version
(
level
,
version
)
=
doc
->
begin
ccall
(
sbml
(
:
SBMLDocument_setLevelAndVersion
),
...
...
@@ -45,6 +45,19 @@ libsbml_convert(conversion_options::Vector{Pair{String,Dict{String,String}}}) =
end
end
"""
libsbml_convert(converter::String; kwargs...)
Quickly construct a single run of a `libsbml` converter from keyword arguments.
# Example
```
readSBML("
example
.
xml
", libsbml_convert("
stripPackage
", package="
layout
"))
```
"""
libsbml_convert
(
converter
::
String
;
kwargs
...
)
=
libsbml_convert
([
converter
=>
Dict
(
string
(
k
)
=>
string
(
v
)
for
(
k
,
v
)
in
kwargs
)])
"""
convert_simplify_math
...
...
@@ -52,6 +65,6 @@ Shortcut for [`libsbml_convert`](@ref) that expands functions, local
parameters, and initial assignments in the SBML document.
"""
convert_simplify_math
=
libsbml_convert
(
[
"promoteLocalParameters"
,
"expandFunctionDefinitions"
,
"setLevelAndVersion"
]
.=>
[
"promoteLocalParameters"
,
"expandFunctionDefinitions"
]
.=>
Ref
(
Dict
{
String
,
String
}()),
)
src/readsbml.jl
View file @
3500090e
...
...
@@ -88,7 +88,7 @@ single parameter, which is the C pointer to the loaded SBML document (C type
# Example
```
m = readSBML("
my_model
.
xml
", doc -> begin
conver
t_level_and_version(3, 1)(doc)
se
t_level_and_version(3, 1)(doc)
convert_simplify_math(doc)
end)
```
...
...
@@ -240,7 +240,15 @@ function extractModel(mdl::VPtr)::SBML.Model
if ccall(sbml(:Species_isSetInitialAmount), Cint, (VPtr,), sp) != 0
ia = (
ccall(sbml(:Species_getInitialAmount), Cdouble, (VPtr,), sp),
get_string(sp, :Species_getSubstanceUnits),
get_optional_string(sp, :Species_getSubstanceUnits),
)
end
ic = nothing
if ccall(sbml(:Species_isSetInitialConcentration), Cint, (VPtr,), sp) != 0
ic = (
ccall(sbml(:Species_getInitialAmount), Cdouble, (VPtr,), sp),
get_optional_string(sp, :Species_getSubstanceUnits),
)
end
...
...
@@ -255,6 +263,7 @@ function extractModel(mdl::VPtr)::SBML.Model
formula,
charge,
ia,
ic,
get_optional_bool(
sp,
:Species_isSetHasOnlySubstanceUnits,
...
...
src/structs.jl
View file @
3500090e
...
...
@@ -142,12 +142,13 @@ struct Species
boundary_condition
::
Maybe
{
Bool
}
formula
::
Maybe
{
String
}
charge
::
Maybe
{
Int
}
initial_amount
::
Maybe
{
Tuple
{
Float64
,
String
}}
initial_amount
::
Maybe
{
Tuple
{
Float64
,
Maybe
{
String
}}}
initial_concentration
::
Maybe
{
Tuple
{
Float64
,
Maybe
{
String
}}}
only_substance_units
::
Maybe
{
Bool
}
notes
::
Maybe
{
String
}
annotation
::
Maybe
{
String
}
Species
(
na
,
co
,
b
,
f
,
ch
,
ia
,
osu
,
no
=
nothing
,
a
=
nothing
)
=
new
(
na
,
co
,
b
,
f
,
ch
,
ia
,
osu
,
no
,
a
)
Species
(
na
,
co
,
b
,
f
,
ch
,
ia
,
ic
,
osu
,
no
=
nothing
,
a
=
nothing
)
=
new
(
na
,
co
,
b
,
f
,
ch
,
ia
,
ic
,
osu
,
no
,
a
)
end
"""
...
...
cylon-x
🤖
@cylon-x
mentioned in commit
5173210b
·
Jun 15, 2021
mentioned in commit
5173210b
mentioned in commit 5173210be45f7d76ab0d282c31df0b5c99c48124
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