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
0794963b
Unverified
Commit
0794963b
authored
May 26, 2021
by
cylon-x
🤖
Committed by
St. Elmo
Jun 08, 2021
Browse files
automatic formatting changes
parent
05c3f817
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/reconstruction/community.jl
View file @
0794963b
...
...
@@ -24,7 +24,7 @@ function Base.push!(
species_name
,
has_biomass_objective
;
biomass_id
=
""
,
)
where
{
M
<:
MetabolicModel
}
)
where
{
M
<:
MetabolicModel
}
if
has_biomass_objective
&&
biomass_id
==
""
throw
(
...
...
test/reconstruction/community.jl
View file @
0794963b
...
...
@@ -12,16 +12,25 @@
exchange_rxn_ids
=
filter
(
startswith
(
"EX_"
),
boundary_rxn_ids
)
exchange_met_ids
=
filter
(
endswith
(
"_e"
),
boundary_met_ids
)
biomass_ids
=
[
"BIOMASS_Ecoli_core_w_GAM"
,
"BIOMASS_Ecoli_core_w_GAM"
]
community
=
COBREXA
.
join
([
m1
,
m2
],
exchange_rxn_ids
,
exchange_met_ids
;
add_biomass_objective
=
true
,
biomass_ids
=
biomass_ids
)
biomass_ids
=
[
"BIOMASS_Ecoli_core_w_GAM"
,
"BIOMASS_Ecoli_core_w_GAM"
]
community
=
COBREXA
.
join
(
[
m1
,
m2
],
exchange_rxn_ids
,
exchange_met_ids
;
add_biomass_objective
=
true
,
biomass_ids
=
biomass_ids
,
)
env_ex_inds
=
indexin
(
exchange_rxn_ids
,
reactions
(
community
))
m2_ex_inds
=
indexin
(
exchange_rxn_ids
,
reactions
(
m2
))
community
.
xl
[
env_ex_inds
]
.=
m2
.
xl
[
m2_ex_inds
]
community
.
xu
[
env_ex_inds
]
.=
m2
.
xu
[
m2_ex_inds
]
biomass_metabolite_inds
=
indexin
([
"species_1_BIOMASS_Ecoli_core_w_GAM"
,
"species_2_BIOMASS_Ecoli_core_w_GAM"
],
metabolites
(
community
))
biomass_metabolite_inds
=
indexin
(
[
"species_1_BIOMASS_Ecoli_core_w_GAM"
,
"species_2_BIOMASS_Ecoli_core_w_GAM"
],
metabolites
(
community
),
)
community
.
S
[
biomass_metabolite_inds
,
end
]
.=
-
1.0
community
.
c
[
end
]
=
1.0
...
...
@@ -30,7 +39,7 @@
d
=
flux_balance_analysis_dict
(
community
,
Tulip
.
Optimizer
)
@test
size
(
stoichiometry
(
community
))
==
(
166
,
211
)
@test
isapprox
(
d
[
"community_biomass"
],
0.41559777495618294
,
atol
=
TEST_TOLERANCE
,
)
@test
isapprox
(
d
[
"community_biomass"
],
0.41559777495618294
,
atol
=
TEST_TOLERANCE
)
end
@testset
"Heterogenous model join"
begin
...
...
@@ -54,7 +63,13 @@ end
biomass_ids
=
[
"BIOMASS_Ecoli_core_w_GAM"
,
"BIOMASS_Ec_iJO1366_core_53p95M"
]
community
=
COBREXA
.
join
([
m1
,
m2
],
exchange_rxn_ids
,
exchange_met_ids
;
add_biomass_objective
=
true
,
biomass_ids
=
biomass_ids
)
community
=
COBREXA
.
join
(
[
m1
,
m2
],
exchange_rxn_ids
,
exchange_met_ids
;
add_biomass_objective
=
true
,
biomass_ids
=
biomass_ids
,
)
env_ex_inds
=
indexin
(
exchange_rxn_ids
,
reactions
(
community
))
m2_ex_inds
=
indexin
(
exchange_rxn_ids
,
reactions
(
m2
))
...
...
@@ -63,21 +78,24 @@ end
for
(
env_ex
,
m2_ex
,
m1_ex
)
in
zip
(
env_ex_inds
,
m2_ex_inds
,
m1_ex_inds
)
m2lb
=
isnothing
(
m2_ex
)
?
0.0
:
m2
.
xl
[
m2_ex
]
m2ub
=
isnothing
(
m2_ex
)
?
0.0
:
m2
.
xu
[
m2_ex
]
m1lb
=
isnothing
(
m1_ex
)
?
0.0
:
m1
.
xl
[
m1_ex
]
m1ub
=
isnothing
(
m1_ex
)
?
0.0
:
m1
.
xu
[
m1_ex
]
community
.
xl
[
env_ex
]
=
m1lb
+
m2lb
community
.
xu
[
env_ex
]
=
m1ub
+
m2ub
community
.
xl
[
env_ex
]
=
m1lb
+
m2lb
community
.
xu
[
env_ex
]
=
m1ub
+
m2ub
end
biomass_metabolite_inds
=
indexin
([
"species_1_BIOMASS_Ecoli_core_w_GAM"
,
"species_2_BIOMASS_Ec_iJO1366_core_53p95M"
],
metabolites
(
community
))
biomass_metabolite_inds
=
indexin
(
[
"species_1_BIOMASS_Ecoli_core_w_GAM"
,
"species_2_BIOMASS_Ec_iJO1366_core_53p95M"
],
metabolites
(
community
),
)
community
.
S
[
biomass_metabolite_inds
,
end
]
.=
-
1.0
community
.
c
[
end
]
=
1.0
community
.
xl
[
end
]
=
0.0
community
.
xu
[
end
]
=
1000.0
@test
size
(
stoichiometry
(
community
))
==
(
2203
,
3003
)
@test
isapprox
(
d
[
"community_biomass"
],
0.8
,
atol
=
TEST_TOLERANCE
,
)
@test
isapprox
(
d
[
"community_biomass"
],
0.8
,
atol
=
TEST_TOLERANCE
)
end
cylon-x
🤖
@cylon-x
mentioned in commit
ba878edf
·
Jun 10, 2021
mentioned in commit
ba878edf
mentioned in commit ba878edfbf8ff0493cb03d7045b5e4179484eae0
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