Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LCSB-BioCore
COBREXA.jl
Commits
bbbf9611
Unverified
Commit
bbbf9611
authored
Dec 02, 2021
by
Miroslav Kratochvil
🚴
Committed by
GitHub
Dec 02, 2021
Browse files
Merge pull request #534 from LCSB-BioCore/lh-remove-duplicate
remove duplicate function definitions
parents
f0891712
3475df65
Pipeline
#50261
passed with stages
in 13 minutes and 41 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/reconstruction/CoreModel.jl
View file @
bbbf9611
...
...
@@ -444,9 +444,8 @@ end
weights = ones(length(rxn_idxs)),
)
Change the objective for `model` to reaction(s) with indices `rxn_idxs`, optionally
specifying their `weights`. By default, assume equal weights. If no objective exists in
model, sets objective. Note, also accepts `String` or `Vector{String}` of reaction ids.
Change the objective to reactions at given indexes, optionally specifying their
`weights` in the same order. By default, all set weights are 1.
"""
function
change_objective!
(
model
::
CoreModel
,
...
...
@@ -458,8 +457,24 @@ function change_objective!(
nothing
end
"""
change_objective!(model::CoreModel, rxn_idx::Int)
Change objective function of a CoreModel to a single `1` at reaction index
`rxn_idx`.
"""
change_objective!
(
model
::
CoreModel
,
rxn_idx
::
Int
)
=
change_objective!
(
model
,
[
rxn_idx
])
"""
change_objective!(
model::CoreModel,
rxn_ids::Vector{String};
weights = ones(length(rxn_ids)),
)
Change objective of given reaction IDs, optionally specifying objective
`weights` in the same order as `rxn_ids`. By default, all set weights are 1.
"""
function
change_objective!
(
model
::
CoreModel
,
rxn_ids
::
Vector
{
String
};
...
...
@@ -467,8 +482,14 @@ function change_objective!(
)
idxs
=
indexin
(
rxn_ids
,
reactions
(
model
))
any
(
isnothing
(
idx
)
for
idx
in
idxs
)
&&
throw
(
DomainError
(
rxn_ids
,
"Some reaction ids
were
not found in model
.
"
))
throw
(
DomainError
(
rxn_ids
,
"Some reaction ids not found in
the
model"
))
change_objective!
(
model
,
Int
.
(
idxs
);
weights
)
end
"""
change_objective!(model::CoreModel, rxn_id::String)
Change objective function of a CoreModel to a single `1` at the given reaction
ID.
"""
change_objective!
(
model
::
CoreModel
,
rxn_id
::
String
)
=
change_objective!
(
model
,
[
rxn_id
])
src/reconstruction/CoreModelCoupled.jl
View file @
bbbf9611
...
...
@@ -427,22 +427,13 @@ end
"""
change_objective!(
model::CoreModelCoupled,
args...
,
args...
;
kwargs...,
)
Forwards arguments to [`change_objective!`](@ref).
Forwards arguments to [`change_objective!`](@ref) of the internal
[`CoreModel`](@ref).
"""
function
change_objective!
(
model
::
CoreModelCoupled
,
args
...
;
kwargs
...
)
change_objective!
(
model
.
lm
,
args
...
;
kwargs
...
)
end
change_objective!
(
model
::
CoreModelCoupled
,
rxn_xid
::
Int
)
=
change_objective!
(
model
.
lm
,
[
rxn_xid
])
function
change_objective!
(
model
::
CoreModelCoupled
,
args
...
;
kwargs
...
)
change_objective!
(
model
.
lm
,
args
...
;
kwargs
...
)
end
change_objective!
(
model
::
CoreModelCoupled
,
rxn_id
::
String
)
=
change_objective!
(
model
,
[
rxn_id
])
cylon-x
🤖
@cylon-x
mentioned in commit
dc1a0992
·
Dec 02, 2021
mentioned in commit
dc1a0992
mentioned in commit dc1a09926bddd12ac45946d993b4fc3152448cd6
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment