Skip to content
Snippets Groups Projects
Commit b46d0045 authored by Miroslav Kratochvil's avatar Miroslav Kratochvil :bicyclist:
Browse files

clean up reaction_stoichiometry comments

parent 25577855
No related branches found
No related tags found
No related merge requests found
...@@ -84,8 +84,7 @@ objective(a::CoreModel)::SparseVec = a.c ...@@ -84,8 +84,7 @@ objective(a::CoreModel)::SparseVec = a.c
""" """
reaction_stoichiometry(model::CoreModel, rid::String)::Dict{String, Float64} reaction_stoichiometry(model::CoreModel, rid::String)::Dict{String, Float64}
Return the reaction equation of reaction with ID `rid` in model. The reaction Return the stoichiometry of reaction with ID `rid`.
equation maps metabolite ids to their stoichiometric coefficients.
""" """
reaction_stoichiometry(m::CoreModel, rid::String)::Dict{String,Float64} = reaction_stoichiometry(m::CoreModel, rid::String)::Dict{String,Float64} =
Dict(m.mets[k] => v for (k, v) in zip(findnz(m.S[:, first(indexin([rid], m.rxns))])...)) Dict(m.mets[k] => v for (k, v) in zip(findnz(m.S[:, first(indexin([rid], m.rxns))])...))
...@@ -93,8 +92,7 @@ reaction_stoichiometry(m::CoreModel, rid::String)::Dict{String,Float64} = ...@@ -93,8 +92,7 @@ reaction_stoichiometry(m::CoreModel, rid::String)::Dict{String,Float64} =
""" """
reaction_stoichiometry(model::CoreModel, ridx::Integer)::Dict{String, Float64} reaction_stoichiometry(model::CoreModel, ridx::Integer)::Dict{String, Float64}
Return the reaction equation of reaction with index `ridx` in model. The reaction Return the stoichiometry of reaction at index `ridx`.
equation maps metabolite ids to their stoichiometric coefficients.
""" """
reaction_stoichiometry(m::CoreModel, ridx::Integer)::Dict{String,Float64} = reaction_stoichiometry(m::CoreModel, ridx::Integer)::Dict{String,Float64} =
Dict(m.mets[k] => v for (k, v) in zip(findnz(m.S[:, ridx])...)) Dict(m.mets[k] => v for (k, v) in zip(findnz(m.S[:, ridx])...))
......
...@@ -101,16 +101,14 @@ coupling_bounds(a::CoreModelCoupled)::Tuple{SparseVec,SparseVec} = (a.cl, a.cu) ...@@ -101,16 +101,14 @@ coupling_bounds(a::CoreModelCoupled)::Tuple{SparseVec,SparseVec} = (a.cl, a.cu)
""" """
reaction_stoichiometry(model::CoreModelCoupled, rid::String)::Dict{String, Float64} reaction_stoichiometry(model::CoreModelCoupled, rid::String)::Dict{String, Float64}
Return the reaction equation of reaction with id `rid` in model. The reaction Return the stoichiometry of reaction with ID `rid`.
equation maps metabolite ids to their stoichiometric coefficients.
""" """
reaction_stoichiometry(m::CoreModelCoupled, rid::String) = reaction_stoichiometry(m.lm, rid) reaction_stoichiometry(m::CoreModelCoupled, rid::String) = reaction_stoichiometry(m.lm, rid)
""" """
reaction_stoichiometry(model::CoreModelCoupled, ridx::Integer)::Dict{String, Float64} reaction_stoichiometry(model::CoreModelCoupled, ridx::Integer)::Dict{String, Float64}
Return the reaction equation of reaction with index `ridx` in model. The reaction Return the stoichiometry of reaction at index `ridx`.
equation maps metabolite ids to their stoichiometric coefficients.
""" """
function reaction_stoichiometry(m::CoreModelCoupled, ridx::Integer)::Dict{String,Float64} function reaction_stoichiometry(m::CoreModelCoupled, ridx::Integer)::Dict{String,Float64}
reaction_stoichiometry(m.lm, ridx) reaction_stoichiometry(m.lm, ridx)
......
...@@ -259,8 +259,7 @@ metabolite_notes(model::JSONModel, mid::String)::Notes = ...@@ -259,8 +259,7 @@ metabolite_notes(model::JSONModel, mid::String)::Notes =
""" """
reaction_stoichiometry(model::JSONModel, rid::String)::Dict{String, Float64} reaction_stoichiometry(model::JSONModel, rid::String)::Dict{String, Float64}
Return the reaction equation of reaction with ID `rid` in model. The reaction Return the stoichiometry of reaction with ID `rid`.
equation maps metabolite ids to their stoichiometric coefficients.
""" """
reaction_stoichiometry(model::JSONModel, rid::String)::Dict{String,Float64} = reaction_stoichiometry(model::JSONModel, rid::String)::Dict{String,Float64} =
model.rxns[model.rxn_index[rid]]["metabolites"] model.rxns[model.rxn_index[rid]]["metabolites"]
......
...@@ -171,8 +171,7 @@ metabolite_compartment(m::MATModel, mid::String) = _maybemap( ...@@ -171,8 +171,7 @@ metabolite_compartment(m::MATModel, mid::String) = _maybemap(
""" """
reaction_stoichiometry(model::MATModel, rid::String)::Dict{String, Float64} reaction_stoichiometry(model::MATModel, rid::String)::Dict{String, Float64}
Return the reaction equation of reaction with ID `rid` in model. The reaction Return the stoichiometry of reaction with ID `rid`.
equation maps metabolite ids to their stoichiometric coefficients.
""" """
function reaction_stoichiometry(m::MATModel, rid::String)::Dict{String,Float64} function reaction_stoichiometry(m::MATModel, rid::String)::Dict{String,Float64}
ridx = first(indexin([rid], m.mat["rxns"])) ridx = first(indexin([rid], m.mat["rxns"]))
...@@ -182,8 +181,7 @@ end ...@@ -182,8 +181,7 @@ end
""" """
reaction_stoichiometry(model::MATModel, ridx::Integer)::Dict{String, Float64} reaction_stoichiometry(model::MATModel, ridx::Integer)::Dict{String, Float64}
Return the reaction equation of reaction with index `ridx` in model. The reaction Return the stoichiometry of reaction at index `ridx`.
equation maps metabolite ids to their stoichiometric coefficients.
""" """
function reaction_stoichiometry(m::MATModel, ridx::Integer)::Dict{String,Float64} function reaction_stoichiometry(m::MATModel, ridx::Integer)::Dict{String,Float64}
met_inds = findall(m.mat["S"][:, ridx] .!= 0.0) met_inds = findall(m.mat["S"][:, ridx] .!= 0.0)
......
...@@ -139,8 +139,7 @@ const _sbml_export_notes = _sbml_export_annotation ...@@ -139,8 +139,7 @@ const _sbml_export_notes = _sbml_export_annotation
""" """
reaction_stoichiometry(model::SBMLModel, rid::String)::Dict{String, Float64} reaction_stoichiometry(model::SBMLModel, rid::String)::Dict{String, Float64}
Return the reaction equation of reaction with ID `rid` in model. The reaction Return the stoichiometry of reaction with ID `rid`.
equation maps metabolite ids to their stoichiometric coefficients.
""" """
reaction_stoichiometry(m::SBMLModel, rid::String)::Dict{String,Float64} = reaction_stoichiometry(m::SBMLModel, rid::String)::Dict{String,Float64} =
m.sbml.reactions[rid].stoichiometry m.sbml.reactions[rid].stoichiometry
......
...@@ -270,8 +270,7 @@ reaction_annotations(model::StandardModel, id::String)::Maybe{Annotations} = ...@@ -270,8 +270,7 @@ reaction_annotations(model::StandardModel, id::String)::Maybe{Annotations} =
""" """
reaction_stoichiometry(model::StandardModel, rid::String)::Dict{String, Float64} reaction_stoichiometry(model::StandardModel, rid::String)::Dict{String, Float64}
Return the reaction equation of reaction with id `rid` in model. The reaction Return the stoichiometry of reaction with ID `rid`.
equation maps metabolite ids to their stoichiometric coefficients.
""" """
reaction_stoichiometry(m::StandardModel, rid::String)::Dict{String,Float64} = reaction_stoichiometry(m::StandardModel, rid::String)::Dict{String,Float64} =
m.reactions[rid].metabolites m.reactions[rid].metabolites
......
...@@ -307,16 +307,16 @@ function reaction_subsystem(model::MetabolicModel, reaction_id::String)::Maybe{S ...@@ -307,16 +307,16 @@ function reaction_subsystem(model::MetabolicModel, reaction_id::String)::Maybe{S
end end
""" """
reaction_stoichiometry(model::MetaboliteModel, rxn_id::String)::Dict{String, Float64} reaction_stoichiometry(model::MetaboliteModel, rid::String)::Dict{String, Float64}
Return the reaction equation of reaction with id `rxn_id` in model. The reaction Return the stoichiometry of reaction with ID `rid` in the model. The dictionary
equation maps metabolite ids to their stoichiometric coefficients. maps the metabolite IDs to their stoichiometric coefficients.
""" """
function reaction_stoichiometry(m::MetabolicModel, rxn_id::String)::Dict{String,Float64} function reaction_stoichiometry(m::MetabolicModel, rid::String)::Dict{String,Float64}
mets = metabolites(m) mets = metabolites(m)
Dict( Dict(
mets[k] => v for (k, v) in mets[k] => v for (k, v) in
zip(findnz(stoichiometry(m)[:, first(indexin([rxn_id], reactions(m)))])...) zip(findnz(stoichiometry(m)[:, first(indexin([rid], reactions(m)))])...)
) )
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment