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
b24d1b13
Commit
b24d1b13
authored
Jul 03, 2021
by
Miroslav Kratochvil
🚴
Browse files
juliaformatter
parent
1f0b8e29
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/converters.jl
View file @
b24d1b13
...
...
@@ -6,11 +6,18 @@ A converter to pass into [`readSBML`](@ref) that enforces certain SBML level
and version.
"""
set_level_and_version
(
level
,
version
)
=
doc
->
check_errors
(
ccall
(
sbml
(
:
SBMLDocument_setLevelAndVersion
),
Cint
,
(
VPtr
,
Cint
,
Cint
),
doc
,
level
,
version
),
doc
,
ErrorException
(
"Setting of level and version did not succeed"
))
doc
->
check_errors
(
ccall
(
sbml
(
:
SBMLDocument_setLevelAndVersion
),
Cint
,
(
VPtr
,
Cint
,
Cint
),
doc
,
level
,
version
,
),
doc
,
ErrorException
(
"Setting of level and version did not succeed"
),
)
"""
libsbml_convert(conversion_options::Vector{Pair{String, Dict{String, String}}})
...
...
@@ -38,8 +45,11 @@ libsbml_convert(
opt
,
)
end
check_errors
(
ccall
(
sbml
(
:
SBMLDocument_convert
),
Cint
,
(
VPtr
,
VPtr
),
doc
,
props
),
doc
,
ErrorException
(
"Conversion returned errors"
))
check_errors
(
ccall
(
sbml
(
:
SBMLDocument_convert
),
Cint
,
(
VPtr
,
VPtr
),
doc
,
props
),
doc
,
ErrorException
(
"Conversion returned errors"
),
)
end
end
...
...
src/readsbml.jl
View file @
b24d1b13
...
...
@@ -93,8 +93,7 @@ end)
function
readSBML
(
fn
::
String
,
sbml_conversion
=
document
->
nothing
)
::
SBML
.
Model
doc
=
ccall
(
sbml
(
:
readSBML
),
VPtr
,
(
Cstring
,),
fn
)
try
get_error_messages
(
doc
,
AssertionError
(
"Opening SBML document has reported errors"
))
get_error_messages
(
doc
,
AssertionError
(
"Opening SBML document has reported errors"
))
sbml_conversion
(
doc
)
...
...
src/utils.jl
View file @
b24d1b13
...
...
@@ -142,7 +142,7 @@ Show the error messages reported by SBML in the `doc` document and throw the
function
get_error_messages
(
doc
::
VPtr
,
error
::
Exception
)
n_errs
=
ccall
(
sbml
(
:
SBMLDocument_getNumErrors
),
Cuint
,
(
VPtr
,),
doc
)
for
i
=
1
:
n_errs
err
=
ccall
(
sbml
(
:
SBMLDocument_getError
),
VPtr
,
(
VPtr
,
Cuint
),
doc
,
i
-
1
)
err
=
ccall
(
sbml
(
:
SBMLDocument_getError
),
VPtr
,
(
VPtr
,
Cuint
),
doc
,
i
-
1
)
msg
=
string
(
strip
(
get_string
(
err
,
:
XMLError_getMessage
)))
@error
"SBML reported error:
$(msg)
"
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