SciML / ReactionNetworkImporters.jl

Julia Catalyst.jl importers for various reaction network file formats like BioNetGen and stoichiometry matrices
https://docs.sciml.ai/ReactionNetworkImporters/stable/
MIT License
26 stars 8 forks source link

Unable to load file .net file (generated from bngl, via BioNetGen, from Gupta&Mendes benchmark paper) #65

Closed TorkelE closed 2 years ago

TorkelE commented 2 years ago

Concerning the Gupta&Mended paper (https://www.ncbi.nlm.nih.gov/pmc/articles/PMC6013266/) which benchmarks CRN solvers. There is one model (the one I have tried so far) which I have problems loading into Julia. First I get their .bngl file, egfr_net.bngl (attached to the post, both attached files have added an extra ".txt at the end of the name so that GitHub accepts them). I load the egfr_net.bngl into BioNetGen (2.3.1, using RuleBender). and run it with generate_network({}); at the end. This generates the "egfr_net.net" file (also attached). When trying to load this one with ReactionNetworkImporters I first gets some prints:

Parsing parameters...done
Adding parameters...done
Parsing species...done
Adding species...done
Creating ModelingToolkit versions of species and parameters...done
Parsing and adding reactions...done
Parsing groups...

followed by an error message:

ArgumentError: invalid base 10 digit '*' in "2*8"

Stacktrace:
  [1] tryparse_internal(#unused#::Type{Int64}, s::SubString{String}, startpos::Int64, endpos::Int64, base_::Int64, raise::Bool)
    @ Base ./parse.jl:137
  [2] parse(::Type{Int64}, s::SubString{String}; base::Nothing)
    @ Base ./parse.jl:241
  [3] parse
    @ ./parse.jl:241 [inlined]
  [4] #14
    @ ./none:0 [inlined]
  [5] iterate
    @ ./generator.jl:47 [inlined]
  [6] collect(itr::Base.Generator{Vector{SubString{String}}, ReactionNetworkImporters.var"#14#15"{Vector{Symbol}, Sym{Real, Base.ImmutableDict{DataType, Any}}, Dict{Term{Real, Base.ImmutableDict{DataType, Any}}, Int64}}})
    @ Base ./array.jl:678
  [7] parse_groups(ft::BNGNetwork, lines::Vector{String}, idx::Int64, idstoshortsyms::Vector{Symbol}, rn::ReactionSystem)
    @ ReactionNetworkImporters ~/.julia/packages/ReactionNetworkImporters/fTk6C/src/parsing_routines_bngnetworkfiles.jl:159
  [8] loadrxnetwork(ft::BNGNetwork, rxfilename::String; name::Symbol, kwargs::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ ReactionNetworkImporters ~/.julia/packages/ReactionNetworkImporters/fTk6C/src/parsing_routines_bngnetworkfiles.jl:237
  [9] loadrxnetwork(ft::BNGNetwork, rxfilename::String)
    @ ReactionNetworkImporters ~/.julia/packages/ReactionNetworkImporters/fTk6C/src/parsing_routines_bngnetworkfiles.jl:188
 [10] top-level scope
    @ In[10]:1
 [11] eval
    @ ./boot.jl:360 [inlined]
 [12] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
    @ Base ./loading.jl:1094

Is this a recognisable error? I think it occurs at the end (which I basically think are some kind of observables, basically these are the 12 or something properties which are usually plotted of the network (instead of the ~350 species). The lines goes something like:

begin groups
    1 Dimers               2*8,2*9,2*10,2*13,...
    2 Sos_act              18,24,29,34,35,40,44,47,2*49,....
    ...
end groups

and are at the end of the file.

I also tried loading using SBMLToolkit, but get an: SBML models with listOfRules are not yet implemented., so probably not possible just yet.

egfr_net.net.txt egfr_net.bngl.txt

isaacsas commented 2 years ago

I’ll try to figure out what is going on. Observables probably aren’t fully handled…

TorkelE commented 2 years ago

With the latest updates this works, should be fine when the updates have gone through.

isaacsas commented 2 years ago

Merging will be hung up till a Catalyst release, which will in turn be hung up till the next ModelingToolkit release. Hopefully this will all get settled soon!