LCSB-BioCore / COBREXA.jl

Constraint-Based Reconstruction and EXascale Analysis
https://lcsb-biocore.github.io/COBREXA.jl/
Apache License 2.0
43 stars 9 forks source link

Warning when reaction is added with metabolites not yet in model #797

Closed HettieC closed 4 months ago

HettieC commented 11 months ago

When adding reactions to a model, currently cobrexa allows you to add them if the metabolites used are not present in the model and only throws an error when you later try to do something with the model. The error also only mentions one metabolite that is not present, instead of listing them

E.g.

using COBREXA
model = StandardModel("")
add_reaction!(
    model,
    Reaction("R";
    metabolites = Dict(
        "m1" => -1,
        "m2" => 1
        )
    )
)
display(model)

Gives the error:

ERROR: DomainError with m2:
Metabolite m2 not found in model but occurs in stoichiometry of R

It would be nice if when calling add_reaction! an error was thrown if any metabolites are not already in the model, or if when calling display(model) a list of the missing metabolites was given instead of just one.

exaexa commented 11 months ago

Hi! I actually assume this is the intended behavior -- the checking is actually quite costly. I agree this is not very user-friendly; we might want to do something about this later.

exaexa commented 4 months ago

deprecated by AbstractFBCModels interface