-
Notifications
You must be signed in to change notification settings - Fork 1
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
ENH: Add KineticModel
method for calculating net cycle fluxes
#57
Comments
One consideration is for cycles that move 2 protons (for example), we would likely need to store that value. So it would really be nice to store an integer for each species in each cycle in the range [-2, 2] which indicates its direction and magnitude. So a -2 would be moving 2 substrates in the CW direction, and a +1 would move a single substrate in the CCW direction. Of course this would require that we define "CCW is positive" for all cycles, which should be avoided I think. I'll have to think about this more. |
I think there are 2 issues here that are being conflated:
The first issue is easy to handle -- all cycles should follow the same convention (i.e. CCW is positive). This is how it is done in the literature, and I think it is overall a simpler strategy. The second issue is a little more complicated, and I think that is what I was addressing in previous comments. When generating flux expressions from net cycle flux expressions, some net cycle fluxes will require a negative sign based on the relative orientation of their corresponding cycles. For example, in the following diagram
the net transition flux for |
KineticModel
method for calculating net cycle fluxes
With GH-83 merged, I think this issue can change direction slightly, and focus primarily on adding a new The difficulties discussed above are still relevant, as well as the following comment from #68:
Solutions have been discussed in GH-83 (here and here), where the latter is probably more tractable. I'll paste it here for convenience:
|
More info regarding cycle directions -- A simple way to calculate the orientation of a cycle in a 2D plane is the shoelace formula. There's a nice blog that discusses it too. This answer on StackOverflow covers a potentially simpler calculation, which is explained here.
|
At the moment it is difficult to calculate operational fluxes because each cycle has to have its direction chosen "by hand". For example, the
kda.calculations
functionscalc_thermo_force
,calc_pi_difference
,calc_net_cycle_flux
, etc. require the user to input the "order" of the cycle, which is a deliberately ordered pair of nodes which is compared to the input cycle to determine which direction is the "forward" cycle direction. While this method allows for complete control over the cycle direction, it is very cumbersome and requires the user to manually record node pairs.A better solution might be to create a function that operates on the input diagram
G
which goes through each cycle and labels them as "CCW" or "CW" (or some other naming convention) based on the node positions and a user-defined direction. That way a user would only be required to specify the "positive" direction once, and if they attempted to use a function that requires these to be labeled an error could be raised. The inputs to this function would likely be a dictionary containing the information of any ions/substrates that are being transported. For example,dict("H+"=(0, 1))
would mean a proton is transported in the positive direction through the edge(0, 1)
.With this information, something like the following could be performed:
dict
keys (substrate names) in the diagram objectNone
None
We might have to temporarily store all of the "positive" and "reverse" edge tuples for each cycle but hopefully that can be avoided.
This is probably a naïve solution, but storing this data along with the cycle data (maybe even in a new object) will help prevent user errors using the current method, and allow for easier cycle verification before calculations are performed. It might even warrant a special plotting function that draws each cycle and (where applicable) a CW/CCW arrow for each substrate it transports. That would make it very simple to double check things by eye.
The text was updated successfully, but these errors were encountered: