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
6cc47e8c
Unverified
Commit
6cc47e8c
authored
May 27, 2021
by
St. Elmo
Browse files
partially implemented reviews
parent
268e2888
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/reconstruction/community.jl
View file @
6cc47e8c
...
...
@@ -167,7 +167,7 @@ function add_model(
end
"""
join(models::Vector{M},
join
_with_exchanges
(models::Vector{M},
exchange_rxn_ids::Vector{String},
exchange_met_ids::Vector{String};
add_biomass_objective=false,
...
...
@@ -223,13 +223,13 @@ unclear.
m1 = load_model(core_model_path)
m2 = load_model(CoreModel, core_model_path)
boundary_rxn_ids, boundary_met_ids =
all_
boundar
i
es(m2)
boundary_rxn_ids, boundary_met_ids = boundar
y_reactions_metabolit
es(m2)
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
(
community =
join_with_exchanges
(
[m1, m2],
exchange_rxn_ids,
exchange_met_ids;
...
...
@@ -238,12 +238,25 @@ community = COBREXA.join(
)
# output
Metabolic model of type CoreModel
[...]
⠤⡤⣤⣼⢤⣤⠀⢘⡄⢤⡼⢷⣦⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢸⣘⢀⢛⣠⠘⠀⠀⢡⠀⠻⠒⢛⢿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⢚⢛⢙⢹⡨⢌⡀⠀⠰⠹⠚⢈⠒⠔⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⣭⣨⣦⣯⠕⢺⢌⠀⠀⠒⢠⣀⠃⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⡶⠘⠉⠻⠃⡶⠮⡀⠀⢦⡀⠈⠊⠘⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠈⠀⠀⠈⠀⠈⠁⠁⠀⠁⠉⠀⠀⢀⣄⣠⣤⣦⣤⡀⠀⢆⠠⣠⣲⣦⣀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢔⠂⠐⠆⣁⠆⠀⠈⡄⠸⠶⠾⠻⡂⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠛⠜⠗⣏⣬⢂⠀⠀⠲⡼⠗⡡⢥⠄⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢐⣘⣥⣱⡲⠒⡯⡁⠀⠐⠂⣀⢐⠀⠂⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠕⠍⠙⠟⠠⠷⢢⠀⢰⡠⠉⠙⠉⠃⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠲⣄⠀⠀⠀⠀⠀⠀⠂⠀⠀⠃⠈⠙⢮⡀⠈⠙⠃⠀⠀⠲⣄⠀⠀
⠀⠀⠀⢀⠀⠀⠀⠈⠳⠄⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠙⠦⠀⠀⠀⠀⠀⠈⠳⠄
Number of reactions: 211
Number of metabolites: 166
```
"""
function
Base.join
(
function
join_with_exchanges
(
models
::
Vector
{
M
},
exchange_rxn_ids
::
Vector
{
String
},
exchange_met_ids
::
Vector
{
String
};
...
...
@@ -384,22 +397,23 @@ function Base.join(
end
"""
all_
boundar
ies(model::M) where {M<:MetabolicModel
}
boundar
y_reactions_metabolites(model::MetabolicModel)::Tuple{Vector{String}, Vector{String}
}
Return `boundary_rxns` and `boundary_mets` given `model`. Boundary reactions
are reactions with a single stoichiometric coefficient in a column in the
stoichiometric matrix, and boundary metabolites are the corresponding row/metabolite
for that column.
"""
function
all_
boundar
ies
(
model
::
M
)
where
{
M
<:
MetabolicModel
}
function
boundar
y_reactions_metabolites
(
model
::
MetabolicModel
)
::
Tuple
{
Vector
{
String
},
Vector
{
String
}
}
boundary_mets
=
String
[]
boundary_rxns
=
String
[]
S
=
stoichiometry
(
model
)
rxns
=
reactions
(
model
)
mets
=
metabolites
(
model
)
for
i
=
1
:
size
(
S
,
2
)
j
,
b
=
findnz
(
S
[
:
,
i
])
if
length
(
j
)
==
1
n
=
nnz
(
S
[
:
,
i
])
if
n
==
1
j
,
_
=
findnz
(
S
[
:
,
i
])
push!
(
boundary_mets
,
mets
[
first
(
j
)])
push!
(
boundary_rxns
,
rxns
[
i
])
end
...
...
test/reconstruction/community.jl
View file @
6cc47e8c
...
...
@@ -8,13 +8,13 @@
m1
=
load_model
(
model_path
)
m2
=
load_model
(
CoreModel
,
model_path
)
boundary_rxn_ids
,
boundary_met_ids
=
all_
boundar
i
es
(
m2
)
boundary_rxn_ids
,
boundary_met_ids
=
boundar
y_reactions_metabolit
es
(
m2
)
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
(
community
=
join_with_exchanges
(
[
m1
,
m2
],
exchange_rxn_ids
,
exchange_met_ids
;
...
...
@@ -57,13 +57,13 @@ end
m1
=
load_model
(
CoreModel
,
core_json
)
m2
=
load_model
(
CoreModel
,
iJO1366_mat
)
boundary_rxn_ids
,
boundary_met_ids
=
all_
boundar
i
es
(
m2
)
boundary_rxn_ids
,
boundary_met_ids
=
boundar
y_reactions_metabolit
es
(
m2
)
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_Ec_iJO1366_core_53p95M"
]
community
=
COBREXA
.
join
(
community
=
join_with_exchanges
(
[
m1
,
m2
],
exchange_rxn_ids
,
exchange_met_ids
;
...
...
@@ -114,12 +114,12 @@ end
)
m1
=
load_model
(
CoreModel
,
model_path
)
boundary_rxn_ids
,
boundary_met_ids
=
all_
boundar
i
es
(
m1
)
boundary_rxn_ids
,
boundary_met_ids
=
boundar
y_reactions_metabolit
es
(
m1
)
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"
]
community
=
COBREXA
.
join
(
community
=
join_with_exchanges
(
[
m1
],
exchange_rxn_ids
,
exchange_met_ids
;
...
...
St. Elmo
@stelmo
mentioned in commit
0e758e20
·
Jun 10, 2021
mentioned in commit
0e758e20
mentioned in commit 0e758e2022cea35db2e8a97bfa6d8932b500a4a9
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