Skip to content

Commit

Permalink
Merge pull request #683 from LCSB-BioCore/mk-fix-mergeability
Browse files Browse the repository at this point in the history
backmerge `master` changes to `develop` to resolve merge conflicts
  • Loading branch information
exaexa committed Oct 14, 2022
2 parents cfaed93 + 40c15f8 commit 677b099
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/base/constants.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
),
Expand Down
4 changes: 2 additions & 2 deletions src/base/types/MATModel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

"""
Expand Down
7 changes: 7 additions & 0 deletions src/base/types/SBMLModel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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} =
Expand Down

0 comments on commit 677b099

Please sign in to comment.