Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion from MATModel produces opaque errors if fields are missing #709

Open
htpusa opened this issue Dec 8, 2022 · 3 comments
Open
Labels
quality improves maintainability and code clarity
Milestone

Comments

@htpusa
Copy link
Collaborator

htpusa commented Dec 8, 2022

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
@exaexa exaexa added the quality improves maintainability and code clarity label Dec 8, 2022
@exaexa exaexa added this to the v1.5 milestone Dec 8, 2022
@exaexa
Copy link
Collaborator

exaexa commented Dec 8, 2022

ok this should be improved. :]

Is the model available somewhere? (to make a test case)

@htpusa
Copy link
Collaborator Author

htpusa commented Dec 8, 2022

This should reproduce:

https://github.com/htpusa/moomin.jl/blob/master/test/data/toyModel.mat

@stelmo
Copy link
Collaborator

stelmo commented Dec 18, 2022

Same issue with JSONModels happens. If a model has nothing for notes the conversion to ObjectModel breaks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
quality improves maintainability and code clarity
Projects
None yet
Development

No branches or pull requests

3 participants