diff --git a/src/base/constants.jl b/src/base/constants.jl index b789b71af..001c82087 100644 --- a/src/base/constants.jl +++ b/src/base/constants.jl @@ -26,7 +26,7 @@ const _constants = ( ids = ["id", "description"], metformulas = ["metFormula", "metFormulas"], metcharges = ["metCharge", "metCharges"], - metcompartments = ["metCompartment", "metCompartments"], + metcompartments = ["metCompartment", "metCompartments", "metComp", "metComps"], rxnnames = ["rxnNames"], metnames = ["metNames"], ), diff --git a/src/base/types/MATModel.jl b/src/base/types/MATModel.jl index 2d1a147e5..bd8d6f512 100644 --- a/src/base/types/MATModel.jl +++ b/src/base/types/MATModel.jl @@ -155,12 +155,12 @@ $(TYPEDSIGNATURES) Extract metabolite charge from `metCharge` or `metCharges`. """ -function metabolite_charge(m::MATModel, mid::String) +function metabolite_charge(m::MATModel, mid::String)::Maybe{Int} met_charge = _maybemap( x -> x[findfirst(==(mid), metabolites(m))], gets(m.mat, nothing, _constants.keynames.metcharges), ) - isnan(met_charge) ? 0 : met_charge + _maybemap(Int, isnan(met_charge) ? nothing : met_charge) end """ diff --git a/src/base/types/SBMLModel.jl b/src/base/types/SBMLModel.jl index 37ab4bef0..fe14efda8 100644 --- a/src/base/types/SBMLModel.jl +++ b/src/base/types/SBMLModel.jl @@ -120,6 +120,13 @@ metabolite_formula(model::SBMLModel, mid::String)::Maybe{MetaboliteFormula} = """ $(TYPEDSIGNATURES) +Get the compartment of a chosen metabolite from [`SBMLModel`](@ref). +""" +metabolite_compartment(model::SBMLModel, mid::String) = model.sbml.species[mid].compartment + +""" +$(TYPEDSIGNATURES) + Get charge of a chosen metabolite from [`SBMLModel`](@ref). """ metabolite_charge(model::SBMLModel, mid::String)::Maybe{Int} =