Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
LCSB-BioCore
COBREXA.jl
Commits
4ebcbff7
Unverified
Commit
4ebcbff7
authored
Jun 06, 2021
by
St. Elmo
Browse files
implement reviews
parent
dfc3f696
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/reconstruction/community.jl
View file @
4ebcbff7
...
...
@@ -57,17 +57,17 @@ add_objective!(model::CoreModel, objective_met::String, objective_weight::Float6
add_objective!
(
model
,
[
objective_met
],
[
objective_weight
])
"""
add_model(
community::CoreModel,
model::M,
exchange_rxn_ids::Vector{String},
exchange_met_ids::Vector{String};
species
_name="
",
biomass_id
=""
)
where {M<:Metabolic
Model
}
add_model(
community::CoreModel,
model::M
etabolicModel
,
exchange_rxn_ids::Vector{String},
exchange_met_ids::Vector{String};
model_name = "
unknown_
species
",
biomass_id
= nothing,
)
::Core
Model
Add `model` to `community`, which is a pre-existing community model with
`exchange_rxn_ids` and `exchange_met_ids`. The `
species
_name` is appended to
`exchange_rxn_ids` and `exchange_met_ids`. The `
model
_name` is appended to
each reaction and metabolite, see [`join`](@ref). If `biomass_id` is specified
then a biomass metabolite for `model` is also added to the resulting model. The
column corresponding to the `biomass_id` reaction then produces this new biomass
...
...
@@ -76,7 +76,7 @@ metabolite with unit coefficient. Note, `exchange_rxn_ids` and
# Example
```
community = add_model(community, model, exchange_rxn_ids, exchange_met_ids;
species
_name="
species_2
", biomass_id="
BIOMASS_Ecoli_core_w_GAM
")
community = add_model(community, model, exchange_rxn_ids, exchange_met_ids;
model
_name="
species_2
", biomass_id="
BIOMASS_Ecoli_core_w_GAM
")
```
"""
function
add_model
(
...
...
@@ -84,7 +84,7 @@ function add_model(
model
::
MetabolicModel
,
exchange_rxn_ids
::
Vector
{
String
},
exchange_met_ids
::
Vector
{
String
};
species
_name
=
"unknown_species"
,
model
_name
=
"unknown_species"
,
biomass_id
=
nothing
,
)
::
CoreModel
...
...
@@ -147,12 +147,12 @@ function add_model(
lbs
=
[
lbs
;
lbsadd
]
ubs
=
[
ubs
;
ubsadd
]
rxnsadd
=
"
$(
species
_name)
_"
.*
reactions
(
model
)
rxnsadd
=
"
$(
model
_name)
_"
.*
reactions
(
model
)
if
!
isnothing
(
biomass_id
)
metsadd
=
[
"
$(
species
_name)
_"
.*
metabolites
(
model
);
"
$(
species
_name)
_"
*
biomass_id
]
[
"
$(
model
_name)
_"
.*
metabolites
(
model
);
"
$(
model
_name)
_"
*
biomass_id
]
else
metsadd
=
"
$(
species
_name)
_"
.*
metabolites
(
model
)
metsadd
=
"
$(
model
_name)
_"
.*
metabolites
(
model
)
end
rxns
=
[
reactions
(
community
);
rxnsadd
]
mets
=
[
metabolites
(
community
);
metsadd
]
...
...
@@ -172,13 +172,13 @@ end
exchange_met_ids::Vector{String};
add_biomass_objective=false,
biomass_ids::Vector{String},
species
_names=String[]
model
_names=String[]
)
Return a `CoreModel` representing the community model of `models` joined through
their `exchange_rxn_ids` and `exchange_met_ids`. These exchange reactions and
metabolites link to environmental metabolites and reactions.
Optionally specify `
species
_names` to append a specific name to each reaction
Optionally specify `
model
_names` to append a specific name to each reaction
and metabolite of an organism for easier reference (default is `species_i` for
each model index i in `models`). Note, the bounds of the environmental variables
are all set to zero. Thus, to run a simulation you need to constrain them
...
...
@@ -244,7 +244,7 @@ function join_with_exchanges(
exchange_met_ids
::
Vector
{
String
};
add_biomass_objective
=
true
,
biomass_ids
=
String
[],
species
_names
=
String
[],
model
_names
=
String
[],
)
where
{
M
<:
MetabolicModel
}
if
add_biomass_objective
&&
isempty
(
biomass_ids
)
...
...
@@ -353,7 +353,7 @@ function join_with_exchanges(
reaction_cumsum
=
cumsum
(
reaction_lengths
)
metabolite_cumsum
=
cumsum
(
metabolite_lengths
)
for
i
=
1
:
length
(
models
)
species
=
isempty
(
species
_names
)
?
"species_
$(i)
"
:
species
_names
[
i
]
species
=
isempty
(
model
_names
)
?
"species_
$(i)
"
:
model
_names
[
i
]
tlbs
,
tubs
=
bounds
(
models
[
i
])
lbs
[
reaction_offset
[
i
]
+
1
:
reaction_cumsum
[
i
]]
.=
tlbs
ubs
[
reaction_offset
[
i
]
+
1
:
reaction_cumsum
[
i
]]
.=
tubs
...
...
@@ -370,7 +370,7 @@ function join_with_exchanges(
if
add_biomass_objective
rxns
[
end
]
=
"community_biomass"
for
i
=
1
:
length
(
models
)
species
=
isempty
(
species
_names
)
?
"species_
$(i)
"
:
species
_names
[
i
]
species
=
isempty
(
model
_names
)
?
"species_
$(i)
"
:
model
_names
[
i
]
mets
[
end
-
length
(
biomass_ids
)
+
i
]
=
"
$(species)
_"
.*
biomass_ids
[
i
]
end
end
...
...
St. Elmo
@stelmo
mentioned in commit
dbb360e8
·
Jun 10, 2021
mentioned in commit
dbb360e8
mentioned in commit dbb360e8303634a49e3e6b74cf5acb60ba7c5f9c
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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