Unverified Commit 647f4230 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil Committed by GitHub
Browse files

Merge pull request #66 from LCSB-BioCore/mk-converter-types

Sanitize `libsbml_converter` types
parents 0949dfac 4da6d4bf
...@@ -24,7 +24,7 @@ A converter that runs the SBML conversion routine, with specified conversion ...@@ -24,7 +24,7 @@ A converter that runs the SBML conversion routine, with specified conversion
options. The argument is a vector of pairs to allow specifying the order of options. The argument is a vector of pairs to allow specifying the order of
conversions. conversions.
""" """
libsbml_convert(conversion_options::Vector{Pair{String,Dict{String,String}}}) = libsbml_convert(conversion_options::AbstractVector{Pair{String,Dict{String,String}}}) =
doc -> begin doc -> begin
for (converter, options) in conversion_options for (converter, options) in conversion_options
props = ccall(sbml(:ConversionProperties_create), VPtr, ()) props = ccall(sbml(:ConversionProperties_create), VPtr, ())
...@@ -55,8 +55,9 @@ Quickly construct a single run of a `libsbml` converter from keyword arguments. ...@@ -55,8 +55,9 @@ Quickly construct a single run of a `libsbml` converter from keyword arguments.
readSBML("example.xml", libsbml_convert("stripPackage", package="layout")) readSBML("example.xml", libsbml_convert("stripPackage", package="layout"))
``` ```
""" """
libsbml_convert(converter::String; kwargs...) = libsbml_convert(converter::String; kwargs...) = libsbml_convert([
libsbml_convert([converter => Dict(string(k) => string(v) for (k, v) in kwargs)]) converter => Dict{String,String}(string(k) => string(v) for (k, v) in kwargs),
])
""" """
convert_simplify_math convert_simplify_math
...@@ -65,6 +66,5 @@ Shortcut for [`libsbml_convert`](@ref) that expands functions, local ...@@ -65,6 +66,5 @@ Shortcut for [`libsbml_convert`](@ref) that expands functions, local
parameters, and initial assignments in the SBML document. parameters, and initial assignments in the SBML document.
""" """
convert_simplify_math = libsbml_convert( convert_simplify_math = libsbml_convert(
["promoteLocalParameters", "expandFunctionDefinitions"] .=> ["promoteLocalParameters", "expandFunctionDefinitions", "expandInitialAssignments"] .=> Ref(Dict{String,String}()),
Ref(Dict{String,String}()),
) )
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
sbmlfile = "Ec_core_flux1.xml" sbmlfile = "Ec_core_flux1.xml"
if !isfile(sbmlfile) if !isfile(sbmlfile)
download( Downloads.download(
"http://systemsbiology.ucsd.edu/sites/systemsbiology.ucsd.edu/files/Attachments/Images/InSilicoOrganisms/Ecoli/Ecoli_SBML/Ec_core_flux1.xml", "http://systemsbiology.ucsd.edu/sites/systemsbiology.ucsd.edu/files/Attachments/Images/InSilicoOrganisms/Ecoli/Ecoli_SBML/Ec_core_flux1.xml",
sbmlfile, sbmlfile,
) )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment