-
Notifications
You must be signed in to change notification settings - Fork 212
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
cobra.flux_analysis.reaction #537
Comments
Thank you for catching that. We'll make a fix shortly. |
Trying to ‘pop’ some metabolites form reactions using cobrapy, as described here http://cobrapy.readthedocs.io/en/0.3.0b1/reactions.html <http://cobrapy.readthedocs.io/en/0.3.0b1/reactions.html>, gives me the following error:
'Reaction' object has no attribute ‘pop’
… On Jul 5, 2017, at 11:22 AM, Moritz E. Beber ***@***.***> wrote:
Thank you for catching that. We'll make a fix shortly.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#537 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AP6ciFLKNThZHtwReB7YWyYLp4Ljjkteks5sK1XXgaJpZM4OOCdu>.
|
This is because the docs you reference are for version In [1]: from cobra.test import create_test_model
In [2]: mod = create_test_model("textbook")
In [3]: bm = mod.reactions.Biomass_Ecoli_core
In [4]: atp = mod.metabolites.atp_c
In [5]: bm.metabolites.pop(atp)
Out[5]: -59.81 Hope that helps 😄 |
Thanks, I’ll make sure to check the newest docs from now on, but that still does not remove it from the model.
print(bm.reaction)
print(bm.metabolites,'\n')
bm.metabolites.pop(atp)
mod.repair()
print(bm.reaction)
print(bm.metabolites)
I found a quick n dirty work around that is good enough for me though
… On Aug 2, 2017, at 5:33 PM, Christian Diener ***@***.***> wrote:
This is because the docs you reference are for version 0.3.0 whereas we are currently at version 0.8.1 which has its own updated docs <http://cobrapy.readthedocs.io/en/0.8.1/>. The pop now only exists on Reaction.metabolites, meaning the following still works:
In [1]: from cobra.test import create_test_model
In [2]: mod = create_test_model("textbook")
In [3]: bm = mod.reactions.Biomass_Ecoli_core
In [4]: atp = mod.metabolites.atp_c
In [5]: bm.metabolites.pop(atp)
Out[5]: -59.81
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#537 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AP6ciH-WKniszljmLms-XbMo0vzpVV5mks5sUJbXgaJpZM4OOCdu>.
|
Ah ok that is true. It does not do the same thing as In [39]: coef = bm.metabolites[atp]
In [40]: coef
Out[40]: -59.81
In [41]: bm.subtract_metabolites({atp: coef})
In [42]: bm.metabolites
Out[42]:
{<Metabolite 3pg_c at 0x7f08ea92de10>: -1.496,
<Metabolite accoa_c at 0x7f08d6ab3240>: -3.7478,
<Metabolite e4p_c at 0x7f08d6aab7f0>: -0.361,
<Metabolite f6p_c at 0x7f08d6abb320>: -0.0709,
<Metabolite g3p_c at 0x7f08d6aa9748>: -0.129,
<Metabolite g6p_c at 0x7f08d6aa99b0>: -0.205,
<Metabolite gln__L_c at 0x7f08d6aa9e80>: -0.2557,
<Metabolite glu__L_c at 0x7f08ea97c0f0>: -4.9414,
<Metabolite h2o_c at 0x7f08ea97c908>: -59.81,
<Metabolite nad_c at 0x7f08ea977048>: -3.547,
<Metabolite nadph_c at 0x7f08ea977908>: -13.0279,
<Metabolite oaa_c at 0x7f08ea975908>: -1.7867,
<Metabolite pep_c at 0x7f08ea975ba8>: -0.5191,
<Metabolite pyr_c at 0x7f08ea9744e0>: -2.8328,
<Metabolite r5p_c at 0x7f08ea974da0>: -0.8977,
<Metabolite adp_c at 0x7f08d6ab3898>: 59.81,
<Metabolite akg_c at 0x7f08d6ab3978>: 4.1182,
<Metabolite coa_c at 0x7f08d6aab240>: 3.7478,
<Metabolite h_c at 0x7f08ea97a278>: 59.81,
<Metabolite nadh_c at 0x7f08ea977358>: 3.547,
<Metabolite nadp_c at 0x7f08ea977630>: 13.0279,
<Metabolite pi_c at 0x7f08ea975e10>: 59.81} |
I'm using Mac OS X 10.10.5 (Yosemite)
cobrapy 0.6.2
python 3.5
when using functions that need to use "cobra/flux_analysis/reaction.py", such as:
cobra.flux_analysis.reaction.assess
cobra.flux_analysis.gapfill
----------- erroneous output -----------
should be
if model.optimize(solver=solver).objective_value >= flux_coefficient_cutoff:
The text was updated successfully, but these errors were encountered: