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

.mat model not loading #691

Closed
HettieC opened this issue Nov 3, 2022 · 6 comments
Closed

.mat model not loading #691

HettieC opened this issue Nov 3, 2022 · 6 comments
Labels
bug Something isn't working minor Easy fix with low priority, likely just cosmetic
Milestone

Comments

@HettieC
Copy link
Contributor

HettieC commented Nov 3, 2022

using COBREXA
download("https://github.com/SysBioChalmers/ecModels/raw/main/ecYeastGEM/model/ecYeastGEM.mat","ecYeastGEM.mat")
model = load_model(StandardModel, "ecYeastGEM.mat")

Gives the following error:

julia> model = load_model(StandardModel, "ecYeastGEM.mat")
ERROR: MethodError: Cannot `convert` an object of type Float64 to an object of type String
Closest candidates are:
  convert(::Type{String}, ::String) at essentials.jl:218
  convert(::Type{T}, ::T) where T<:AbstractString at strings/basic.jl:231
  convert(::Type{T}, ::AbstractString) where T<:AbstractString at strings/basic.jl:232
  ...
Stacktrace:
 [1] convert(#unused#::Type{Union{Nothing, String}}, x::Float64)
   @ Base ./some.jl:36
 [2] Metabolite(id::String; name::String, formula::String, charge::Int64, compartment::Float64, notes::Dict{String, Vector{String}}, annotations::Dict{String, Vector{String}})
   @ COBREXA ~/.julia/packages/COBREXA/i07GX/src/base/types/Metabolite.jl:32
 [3] convert(#unused#::Type{StandardModel}, model::MATModel)
   @ COBREXA ~/.julia/packages/COBREXA/i07GX/src/base/types/StandardModel.jl:345
 [4] load_model(type::Type{StandardModel}, file_name::String)
   @ COBREXA ~/.julia/packages/COBREXA/i07GX/src/io/io.jl:41
 [5] top-level scope
   @ REPL[3]:1
@exaexa exaexa added bug Something isn't working minor Easy fix with low priority, likely just cosmetic labels Nov 3, 2022
@exaexa
Copy link
Collaborator

exaexa commented Nov 3, 2022

Hi! Looks like there is something shady in the MAT file that should be String but is in fact a number. I'll check asap

@exaexa exaexa added this to the v1.5 milestone Nov 3, 2022
@exaexa
Copy link
Collaborator

exaexa commented Nov 3, 2022

ok this is a problem where metComps in the model are actual float (!) indexes into comps. I think we can add a switch for that

@HettieC HettieC closed this as completed Nov 3, 2022
@HettieC HettieC reopened this Nov 3, 2022
@HettieC
Copy link
Contributor Author

HettieC commented Nov 3, 2022

thanks!

@exaexa
Copy link
Collaborator

exaexa commented Nov 3, 2022

something like this should serve as a quick workaround for now:

model = load_model("ecYeastGEM.mat")
model.mat["metComps"] = model.mat["comps"][Int.(model.mat["metComps"])]
model = convert(StandardModel, model)

exaexa added a commit that referenced this issue Nov 3, 2022
@HettieC
Copy link
Contributor Author

HettieC commented Nov 3, 2022

that's perfect thank you

@exaexa
Copy link
Collaborator

exaexa commented Nov 3, 2022

Seems fixed in #692 . Please use COBREXA from develop for now, I'll try to release this asap.

(this should work:

] add git@github.com:LCSB-BioCore/COBREXA.jl.git#develop

)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working minor Easy fix with low priority, likely just cosmetic
Projects
None yet
Development

No branches or pull requests

2 participants