Skip to content
Snippets Groups Projects
Unverified Commit f0456c24 authored by St. Elmo's avatar St. Elmo
Browse files

add macro for change_bound!

parent 5ecf86cb
No related branches found
No related tags found
No related merge requests found
......@@ -408,28 +408,7 @@ function change_bounds!(
end
end
"""
change_bound!(
model::CoreModel,
reaction_idx::Int;
lower_bound = -_constants.default_reaction_bound,
upper_bound = _constants.default_reaction_bound,
)
Change the bound of a reaction with index `reaction_idx` in `model` in-place. Note
that if the bound argument is not supplied then a default (see
`_constants.default_reaction_bound`) is used. The same default bound argument is
used for each reaction bound if not supplied.
See also: [`change_bound`](@ref), [`change_bound!`](@ref), [`change_bounds`](@ref)
# Example
```
change_bound!(model, 2; lower_bounds=-10, ub=22)
change_bound!(model, 2; lower_bounds=-10.2) # all upper_bounds are set to _constants.default_reaction_bound
change_bound!(model, 2; upper_bounds=10.2)
```
"""
@_change_bound!("CoreModel")
function change_bound!(
model::CoreModel,
rxn::Int;
......@@ -472,27 +451,7 @@ function change_bounds!(
change_bounds!(model, Int.(indexin(rxn_ids, reactions(model))); lower_bounds = lower_bounds, upper_bounds = upper_bounds)
end
"""
change_bound!(
model::CoreModel,
reaction_id::String;
lower_bound = -_constants.default_reaction_bound,
upper_bound = _constants.default_reaction_bound,
)
Change the bounds of a reaction with `reaction_id` in `model` in-place. Note
that if the bound argument is not supplied then a default (see
`_constants.default_reaction_bound`) is used.
See also: [`change_bound`](@ref), [`change_bounds!`](@ref), [`change_bounds!`](@ref)
# Example
```
change_bound!(model, "PFL"; lower_bound=-10, ub=10)
change_bound!(model, "PFL"; lower_bound=-10.2) # upper_bound is set to _constants.default_reaction_bound
change_bound!(model, "PFL"; upper_bound=10)
```
"""
@_change_bound!("CoreModel",)
function change_bound!(
model::CoreModel,
rxn_id::String;
......
......@@ -362,7 +362,6 @@ function change_coupling_bounds!(
end
end
"""
change_bounds!(
model::CoreModelCoupled,
......@@ -396,28 +395,7 @@ function change_bounds!(
end
end
"""
change_bound!(
model::CoreModelCoupled,
reaction_idx::Int;
lower_bound = -_constants.default_reaction_bound,
upper_bound = _constants.default_reaction_bound,
)
Change the bound of a reaction with index `reaction_idx` in `model` in-place. Note
that if the bound argument is not supplied then a default (see
`_constants.default_reaction_bound`) is used. The same default bound argument is
used for each reaction bound if not supplied.
See also: [`change_bound`](@ref), [`change_bound!`](@ref), [`change_bounds`](@ref)
# Example
```
change_bound!(model, 2; lower_bounds=-10, ub=22)
change_bound!(model, 2; lower_bounds=-10.2) # all upper_bounds are set to _constants.default_reaction_bound
change_bound!(model, 2; upper_bounds=10.2)
```
"""
@_change_bound!("CoreModelCoupled",)
function change_bound!(
model::CoreModelCoupled,
rxn::Int;
......@@ -460,27 +438,7 @@ function change_bounds!(
change_bounds!(model, Int.(indexin(rxn_ids, reactions(model))); lower_bounds = lower_bounds, upper_bounds = upper_bounds)
end
"""
change_bound!(
model::CoreModelCoupled,
reaction_id::String;
lower_bound = -_constants.default_reaction_bound,
upper_bound = _constants.default_reaction_bound,
)
Change the bounds of a reaction with `reaction_id` in `model` in-place. Note
that if the bound argument is not supplied then a default (see
`_constants.default_reaction_bound`) is used.
See also: [`change_bound`](@ref), [`change_bounds!`](@ref), [`change_bounds!`](@ref)
# Example
```
change_bound!(model, "PFL"; lower_bound=-10, ub=10)
change_bound!(model, "PFL"; lower_bound=-10.2) # upper_bound is set to _constants.default_reaction_bound
change_bound!(model, "PFL"; upper_bound=10)
```
"""
@_change_bound!("CoreModelCoupled",)
function change_bound!(
model::CoreModelCoupled,
rxn_id::String;
......
......@@ -213,27 +213,7 @@ remove_gene!(model, "g1")
remove_gene!(model::StandardModel, gid::String; knockout_reactions::Bool = false) =
remove_genes!(model, [gid]; knockout_reactions = knockout_reactions)
"""
change_bound!(
model::StandardModel,
reaction_id::String;
lower_bound = -_constants.default_reaction_bound,
upper_bound = _constants.default_reaction_bound,
)
Change the bounds of a reaction with `reaction_id` in `model` in-place. Note
that if the bound argument is not supplied then a default (see
`_constants.default_reaction_bound`) is used.
See also: [`change_bound`](@ref), [`change_bounds!`](@ref), [`change_bounds!`](@ref)
# Example
```
change_bound!(model, "PFL"; lower_bound=-10, ub=10)
change_bound!(model, "PFL"; lower_bound=-10.2) # upper_bound is set to _constants.default_reaction_bound
change_bound!(model, "PFL"; upper_bound=10)
```
"""
@_change_bound!("StandardModel",)
function change_bound!(
model::StandardModel,
reaction_id::String;
......
macro _change_bound!(model_type, index_type, example)
return :(
"""
change_bound!(
model::$model_type,
rxn::$index_type;
lower_bound = -_constants.default_reaction_bound,
upper_bound = _constants.default_reaction_bound,
)
Change the bounds of a reaction with `rxn` in `model` in-place. Note
that if the bound argument is not supplied then a default (see
`_constants.default_reaction_bound`) is used.
See also: [`change_bound`](@ref), [`change_bounds!`](@ref), [`change_bounds!`](@ref)
# Example
```
change_bound!(model, $example; lower_bound=-10, ub=10)
change_bound!(model, $example; lower_bound=-10.2) # upper_bound is set to _constants.default_reaction_bound
change_bound!(model, $example; upper_bound=10)
```
"""
)
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