COBREXA.jl
COBREXA.jl copied to clipboard
Conversion from MATModel produces opaque errors if fields are missing
julia> m = load_model("model.mat") # model has no metCharge field
julia> convert(StandardModel,m)
ERROR: MethodError: no method matching isnan(::Nothing)
Closest candidates are:
isnan(::Complex) at /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/base/complex.jl:147
isnan(::FixedPointNumbers.FixedPoint) at ~/.julia/packages/FixedPointNumbers/HAGk2/src/FixedPointNumbers.jl:103
isnan(::ColorTypes.Colorant) at ~/.julia/packages/ColorTypes/1dGw6/src/traits.jl:453
...
Stacktrace:
[1] metabolite_charge(m::COBREXA.MATModel, mid::String)
@ COBREXA ~/.julia/packages/COBREXA/28ssY/src/base/types/MATModel.jl:163
[2] convert(#unused#::Type{COBREXA.StandardModel}, model::COBREXA.MATModel)
@ COBREXA ~/.julia/packages/COBREXA/28ssY/src/base/types/StandardModel.jl:340
[3] top-level scope
@ none:1
ok this should be improved. :]
Is the model available somewhere? (to make a test case)
This should reproduce:
https://github.com/htpusa/moomin.jl/blob/master/test/data/toyModel.mat
Same issue with JSONModels happens. If a model has nothing for notes the conversion to ObjectModel breaks