Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
COBREXA.jl
Manage
Activity
Members
Plan
External wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LCSB-BioCore
COBREXA.jl
Commits
c9fb9e97
Unverified
Commit
c9fb9e97
authored
3 years ago
by
St. Elmo
Browse files
Options
Downloads
Patches
Plain Diff
implement some reviews
parent
bc3911be
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/reconstruction/CoreModel.jl
+23
-72
23 additions, 72 deletions
src/reconstruction/CoreModel.jl
src/reconstruction/StandardModel.jl
+8
-32
8 additions, 32 deletions
src/reconstruction/StandardModel.jl
with
31 additions
and
104 deletions
src/reconstruction/CoreModel.jl
+
23
−
72
View file @
c9fb9e97
...
...
@@ -379,16 +379,9 @@ end
change_bounds!(
model::CoreModel,
reaction_idxs::Vector{Int};
lower_bounds = repeat(
[-_constants.default_reaction_bound],
inner = length(reaction_ids),
),
upper_bounds = repeat(
[_constants.default_reaction_bound],
inner = length(reaction_ids),
),
)
lower_bounds = fill(-_constants.default_reaction_bound, length(reaction_idxs)),
upper_bounds = fill(constants.default_reaction_bound, length(reaction_idxs)),
)
Change the bounds of all reactions with indices `reaction_idxs` in `model` in-place. Note
that if the bound argument is not supplied then a default (see
...
...
@@ -407,14 +400,8 @@ change_bounds!(model, [2, 3]; upper_bounds=[10.2, 23])
function
change_bounds!
(
model
::
CoreModel
,
rxns
::
Vector
{
Int
};
lower_bounds
=
repeat
(
[
-
_constants
.
default_reaction_bound
],
inner
=
length
(
reaction_ids
),
),
upper_bounds
=
repeat
(
[
_constants
.
default_reaction_bound
],
inner
=
length
(
reaction_ids
),
),
lower_bounds
=
fill
(
-
_constants
.
default_reaction_bound
,
length
(
rxns
)),
upper_bounds
=
fill
(
constants
.
default_reaction_bound
,
length
(
rxns
)),
)
model
.
xl
[
rxns
]
.=
lower_bounds
model
.
xu
[
rxns
]
.=
upper_bounds
...
...
@@ -455,18 +442,12 @@ end
"""
change_bounds!(
model::CoreModel,
reaction_ids::Vector{String};
lower_bounds = repeat(
[-_constants.default_reaction_bound],
inner = length(reaction_ids),
),
upper_bounds = repeat(
[_constants.default_reaction_bound],
inner = length(reaction_ids),
),
rxn_ids::Vector{String};
lower_bounds = fill(-_constants.default_reaction_bound, length(rxn_ids)),
upper_bounds = fill(constants.default_reaction_bound, length(rxn_ids)),
)
Change the bounds of all reactions with `r
eactio
n_ids` in `model` in-place. Note
Change the bounds of all reactions with `r
x
n_ids` 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.
...
...
@@ -483,14 +464,8 @@ change_bounds!(model, ["PFL", "FBA"]; upper_bounds=[10.2, 23])
function
change_bounds!
(
model
::
CoreModel
,
rxn_ids
::
Vector
{
String
};
lower_bounds
=
repeat
(
[
-
_constants
.
default_reaction_bound
],
inner
=
length
(
reaction_ids
),
),
upper_bounds
=
repeat
(
[
_constants
.
default_reaction_bound
],
inner
=
length
(
reaction_ids
),
),
lower_bounds
=
fill
(
-
_constants
.
default_reaction_bound
,
length
(
rxn_ids
)),
upper_bounds
=
fill
(
constants
.
default_reaction_bound
,
length
(
rxn_ids
)),
)
change_bounds!
(
model
,
Int
.
(
indexin
(
rxn_ids
,
reactions
(
model
)));
lower_bounds
=
lower_bounds
,
upper_bounds
=
upper_bounds
)
end
...
...
@@ -528,19 +503,13 @@ end
"""
change_bounds(
model::CoreModel,
reaction_idxs::Vector{Int};
lower_bounds = repeat(
[-_constants.default_reaction_bound],
inner = length(reaction_ids),
),
upper_bounds = repeat(
[_constants.default_reaction_bound],
inner = length(reaction_ids),
),
)
rxns::Vector{Int};
lower_bounds = fill(-_constants.default_reaction_bound, length(rxns)),
upper_bounds = fill(constants.default_reaction_bound, length(rxns)),
)
Return a shallow copy of the `model` where the bounds of all reactions with
indices `r
eaction_id
xs` in `model` have been changed. Note that if the bound
indices `rx
n
s` in `model` have been changed. 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.
...
...
@@ -557,14 +526,8 @@ new_model = change_bounds(model, [2, 3]; upper_bounds=[10.2, 23])
function
change_bounds
(
model
::
CoreModel
,
rxns
::
Vector
{
Int
};
lower_bounds
=
repeat
(
[
-
_constants
.
default_reaction_bound
],
inner
=
length
(
reaction_ids
),
),
upper_bounds
=
repeat
(
[
_constants
.
default_reaction_bound
],
inner
=
length
(
reaction_ids
),
),
lower_bounds
=
fill
(
-
_constants
.
default_reaction_bound
,
length
(
rxns
)),
upper_bounds
=
fill
(
constants
.
default_reaction_bound
,
length
(
rxns
)),
)
m
=
copy
(
model
)
m
.
xl
=
copy
(
model
.
xl
)
...
...
@@ -613,15 +576,9 @@ end
"""
change_bounds(
model::CoreModel,
reaction_ids::Vector{String};
lower_bounds = repeat(
[-_constants.default_reaction_bound],
inner = length(reaction_ids),
),
upper_bounds = repeat(
[_constants.default_reaction_bound],
inner = length(reaction_ids),
),
rxn_ids::Vector{String};
lower_bounds = fill(-_constants.default_reaction_bound, length(rxn_ids)),
upper_bounds = fill(constants.default_reaction_bound, length(rxn_ids)),
)
Change the bounds of all reactions with `reaction_ids` in `model` in-place. Note
...
...
@@ -641,14 +598,8 @@ new_model = change_bounds(model, ["PFL", "FBA"]; upper_bounds=[10.2, 23])
function
change_bounds
(
model
::
CoreModel
,
rxn_ids
::
Vector
{
String
};
lower_bounds
=
repeat
(
[
-
_constants
.
default_reaction_bound
],
inner
=
length
(
reaction_ids
),
),
upper_bounds
=
repeat
(
[
_constants
.
default_reaction_bound
],
inner
=
length
(
reaction_ids
),
),
lower_bounds
=
fill
(
-
_constants
.
default_reaction_bound
,
length
(
rxn_ids
)),
upper_bounds
=
fill
(
constants
.
default_reaction_bound
,
length
(
rxn_ids
)),
)
change_bounds
(
model
,
Int
.
(
indexin
(
rxn_ids
,
reactions
(
model
)));
lower_bounds
=
lower_bounds
,
upper_bounds
=
upper_bounds
)
end
...
...
This diff is collapsed.
Click to expand it.
src/reconstruction/StandardModel.jl
+
8
−
32
View file @
c9fb9e97
...
...
@@ -249,14 +249,8 @@ end
change_bounds!(
model::StandardModel,
reaction_ids::Vector{String};
lower_bounds = repeat(
[-_constants.default_reaction_bound],
inner = length(reaction_ids),
),
upper_bounds = repeat(
[_constants.default_reaction_bound],
inner = length(reaction_ids),
),
lower_bounds = fill(-_constants.default_reaction_bound, length(reaction_ids)),
upper_bounds = fill(_constants.default_reaction_bound, length(reaction_ids)),
)
Change the bounds of all reactions with `reaction_ids` in `model` in-place. Note
...
...
@@ -276,14 +270,8 @@ change_bounds!(model, ["PFL", "FBA"]; upper_bounds=[10.2, 23])
function
change_bounds!
(
model
::
StandardModel
,
reaction_ids
::
Vector
{
String
};
lower_bounds
=
repeat
(
[
-
_constants
.
default_reaction_bound
],
inner
=
length
(
reaction_ids
),
),
upper_bounds
=
repeat
(
[
_constants
.
default_reaction_bound
],
inner
=
length
(
reaction_ids
),
),
lower_bounds
=
fill
(
-
_constants
.
default_reaction_bound
,
length
(
reaction_ids
)),
upper_bounds
=
fill
(
_constants
.
default_reaction_bound
,
length
(
reaction_ids
)),
)
for
(
rid
,
lb
,
ub
)
in
zip
(
reaction_ids
,
lower_bounds
,
upper_bounds
)
change_bound!
(
model
,
rid
;
lower_bound
=
lb
,
upper_bound
=
ub
)
...
...
@@ -329,14 +317,8 @@ end
change_bounds(
model::StandardModel,
reaction_ids::Vector{String};
lower_bounds = repeat(
[-_constants.default_reaction_bound],
inner = length(reaction_ids),
),
upper_bounds = repeat(
[_constants.default_reaction_bound],
inner = length(reaction_ids),
),
lower_bounds = fill(-_constants.default_reaction_bound, length(reaction_ids)),
upper_bounds = fill(constants.default_reaction_bound, length(reaction_ids)),
)
Return a shallow copy of the `model` where the reaction bounds of all
...
...
@@ -355,14 +337,8 @@ new_model = change_bounds(model, ["PFL", "FBA"]; ub=[10, 22])
function
change_bounds
(
model
::
StandardModel
,
reaction_ids
::
Vector
{
String
};
lower_bounds
=
repeat
(
[
-
_constants
.
default_reaction_bound
],
inner
=
length
(
reaction_ids
),
),
upper_bounds
=
repeat
(
[
_constants
.
default_reaction_bound
],
inner
=
length
(
reaction_ids
),
),
lower_bounds
=
fill
(
-
_constants
.
default_reaction_bound
,
length
(
reaction_ids
)),
upper_bounds
=
fill
(
constants
.
default_reaction_bound
,
length
(
reaction_ids
)),
)
m
=
copy
(
model
)
m
.
reactions
=
copy
(
model
.
reactions
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment