Commit 486efbb9 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil
Browse files

consistent arg order for `fix_mass_balanced`

...together with the other commits in this branch, this:

Closes #330
parent d7c31b25
Pipeline #43050 passed with stages
in 8 minutes and 37 seconds
......@@ -175,8 +175,8 @@ check_duplicate_reaction(pgm_duplicate, model.reactions; only_metabolites = fals
# ## Checking the internals of `StandardModel`s: `is_mass_balanced`
# Finally, `is_mass_balanced` can be used to check if a reaction is mass
# Finally, [`is_mass_balanced`](@ref) can be used to check if a reaction is mass
# balanced based on the formulas of the reaction equation.
pgm_duplicate.metabolites = Dict{String,Float64}("3pg_c" => 1, "2pg_c" => -1, "h2o_c" => 1) # not mass balanced now
is_bal, extra_atoms = is_mass_balanced(pgm_duplicate, model) # extra_atoms shows which atoms are in excess/deficit
is_bal, extra_atoms = is_mass_balanced(model, pgm_duplicate) # extra_atoms shows which atoms are in excess/deficit
......@@ -50,14 +50,14 @@ function is_boundary(rxn::Reaction)::Bool
end
"""
is_mass_balanced(rxn::Reaction, model::StandardModel)
is_mass_balanced(model::StandardModel, rxn::Reaction)
Checks if `rxn` is atom balanced. Returns a boolean for whether the reaction is balanced,
and the associated balance of atoms for convenience (useful if not balanced).
See also: [`get_atoms`](@ref), [`check_duplicate_reaction`](@ref)
"""
function is_mass_balanced(rxn::Reaction, model::StandardModel)
function is_mass_balanced(model::StandardModel, rxn::Reaction)
atom_balances = Dict{String,Float64}() # float here because stoichiometry is not Int
for (met, stoich) in rxn.metabolites
atoms = metabolite_formula(model, met)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment