Coder Social home page Coder Social logo

Comments (4)

adamkova avatar adamkova commented on August 17, 2024 1

Good day to you too, Pierre,

Thank you for the new update and the detailed explanation. The pace at which you addressed these issues is impressive 👍.

This thumb rule about the use cases of fluxes and raw makes good sense to me now. I also agree that for completeness, solution.raw should contain everything.

The changes seem to have done the trick, the code regained its flow.

Regarding suggestions, I would not make any now. It is a big project, and I could see that it takes quite some time to get a good enough overview of what is happening under the hood. Momentarily, it seems more feasible to assume that you made all the right choices during coding. :)

With that, please feel free to close this issue.

Keep it up,
Adam

from pytfa.

psalvy avatar psalvy commented on August 17, 2024

Good day Adam!

Thank you for the kind words :) We appreciate that people read our prose and use our tools !

Indeed, I forgot to adapt this part of the code to the new fields of the solution attribute. The problem of your solution is that backward_use.id will yield for example PGI instead of BU_PGI, and PGI is the variable name of the reaction PGI -- which might create some issues since that would mean bounding an integer with continuous values ;) (This also explains why you do not get a key error)

However, i replaced solution.x_dict by solution.raw, which yields the raw Series of variable values at solution - this should work. Try pulling from dev (commit b9f14d2) - and tell me if that solves your problem :)

Cheers,
Pierre

from pytfa.

adamkova avatar adamkova commented on August 17, 2024

Hi Pierre,

Appreciate the quick response and the update! You are right, I was binding the integers inappropriately... After pulling the update, it works like a charm, thanks.

Subsequently, I found x_dicts to be replaced in /analysis/variability.py as well. Would the below changes make sense (as per your previous update)?
77: profiles[iter_count] = solution.x_dictprofiles[iter_count] = solution.raw
207: fluxes = solution.x_dict[reaction_id]fluxes = solution.raw[reaction_id]
210: deltag = pd.Series({x.id:solution.x_dict[x.name]deltag = pd.Series({x.id:solution.raw[x.name]

In the case of line 207, I am a bit confused about the deprecated x_dicts from cobrapy (which were suggested to be changed to fluxes) and these x_dicts that should be changed to raw. Can you maybe suggest an intuitive way to differentiate them? This pytfa - cobrapy integration and tracking the attributes/variables gets a bit tricky for me at certain points... :)

Thanks ahead!
Adam

from pytfa.

psalvy avatar psalvy commented on August 17, 2024

Good day Adam,

Thank you for pointing these out!
Yes, I kinda coded this in a hurry without proper documentation ... Here was my reasoning:

  • solution.fluxes in cobrapy is a transformed version of the solver output, as it actually calculates the net flux of each reaction by substracting the reverse variable value to the forward variable value. This should be used anytime one needs the actual flux value

  • solution.raw is an attribute I added to get a clear copy of the solver output. From there one can access the value at solution for all the variables of the problem. However, looking for a reaction ID in there will only give the forward flux. This should be used for any other variable than fluxes.

I did not want to remove fluxes from solution.raw because then, well, it would not be raw anymore ...
However if you have suggestions with respect to this I would gladly take them !
I should have corrected the last remnants of x_dict in the latest push (dev, commit a985ce8)

Let me know if that solved your plroblem, and I'll close the issue :)

Cheers,
Pierre

from pytfa.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.