-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extend community model #696
Conversation
/format |
✔️ Auto-formatting triggered by this comment succeeded, commited as b439fc8 |
/format |
✔️ Auto-formatting triggered by this comment succeeded, commited as 0b51955 |
Codecov ReportBase: 90.21% // Head: 89.93% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## next #696 +/- ##
==========================================
- Coverage 90.21% 89.93% -0.29%
==========================================
Files 82 84 +2
Lines 2106 1977 -129
==========================================
- Hits 1900 1778 -122
+ Misses 206 199 -7
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
/format |
✔️ Auto-formatting triggered by this comment succeeded, commited as 9dead6f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get this in, I added some TODOs for myself for later.
(I'll convert them to issues)
@@ -0,0 +1,333 @@ | |||
@testset "BalancedGrowthCommunityModel: simple model" begin | |||
m1 = ObjectModel(id = "Model1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you technically reuse some of the models in data_static ? (possibly just adding a few genes to them?)
A helper function to get the unique environmental metabolites. | ||
""" | ||
get_env_mets(cm::BalancedGrowthCommunityModel) = | ||
unique(hcat([get_exchange_mets(m) for m in cm.members]...)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_env_mets is pretty slow and it's repeated everywhere, it might be much better to cache the result in the model structure directly
appended as a prefix with the delimiter `#`. | ||
""" | ||
Accessors.genes(cm::BalancedGrowthCommunityModel) = | ||
[m.id * "#" * gid for m in cm.members for gid in genes(m.model)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[m.id * "#" * gid for m in cm.members for gid in genes(m.model)] | |
["$(m.id)#$gid" for m in cm.members for gid in genes(m.model)] |
delimiter `#`. The environmental metabolites have no prefix. | ||
""" | ||
function Accessors.metabolites(cm::BalancedGrowthCommunityModel) | ||
mets = [m.id * "#" * mid for m in cm.members for mid in metabolites(m.model)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mets = [m.id * "#" * mid for m in cm.members for mid in metabolites(m.model)] | |
mets = ["$(m.id)#$mid" for m in cm.members for mid in metabolites(m.model)] |
io, | ||
"A balanced growth community model comprised of $(length(cm.members)) underlying models.", | ||
) | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this isn't very useful, I guess the generic show will suffice for now. I'll eventually make a bigger PR with MultiModelWrapper
that fixes this forever
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(as in, pls remove the custom show
s here)
""" | ||
Base.@kwdef mutable struct CommunityMember | ||
"Name of model appended to intracellular reactions and metabolites." | ||
id::String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO for myself, for later:
id
should be outside of the community member, making the members
a dict.
"List of all exchange reactions in model." | ||
exchange_reaction_ids::Vector{String} | ||
"ID of biomass metabolite." | ||
biomass_metabolite_id::String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO for myself later: biomass balancing is a function of the class that provides the balance, so the metabolite (= equality constraint) should be created externally, not by the community member.
Currently our community model framework is rather fragile. Let's extend it to: