Page 1 of 1

Recording individual fluxes on a species that includes multiple mechanisms

Posted: Tue May 02, 2023 3:04 pm
by duytanph
Hello,

I was wondering if there was a way to record the contribution of individual mechanisms that all act on the same species.

For example, intracellular calcium in the cytosol (which would be defined as an rxd.Species()) has multiple mechanisms that affect its concentration. The mechanisms can be defined in rxd as some combination of rxd.Rate()s, rxd.Reaction()s, and rxd.MultiComparmentReaction()s.

Is there a way to parse out and record the effective flux due to each individual mechanism over time? In other words, is it possible to record the calcium flux due to mechanism 1, mechanism 2, ...etc.?

This would be very helpful for debugging purposes and monitoring which mechanism has the largest contribution to the dynamics of a species.

One way that I've tried to do this is to make a "dummy" species, one for each mechanism, and define its rate to be identical to its corresponding mechanism... and then record the dummy species which would provide the calcium concentration output of that mechanism (ie, the integral of calcium flux). However, I think this has only been successful for mechanisms defined as an rxd.Rate(). But for ones defined as a reaction or multi-compartment reaction, they don't seem to work as nicely.

Thank you for any help you can provide!

Re: Recording individual fluxes on a species that includes multiple mechanisms

Posted: Tue May 02, 2023 11:08 pm
by ted
Easily done with mechanisms specified in NMODL. Doubtless the rxd approach is more elegant and expressive.

Re: Recording individual fluxes on a species that includes multiple mechanisms

Posted: Mon May 08, 2023 5:34 pm
by bouteill
duytanph wrote: Tue May 02, 2023 3:04 pm Hello,

I was wondering if there was a way to record the contribution of individual mechanisms that all act on the same species.

For example, intracellular calcium in the cytosol (which would be defined as an rxd.Species()) has multiple mechanisms that affect its concentration. The mechanisms can be defined in rxd as some combination of rxd.Rate()s, rxd.Reaction()s, and rxd.MultiComparmentReaction()s.

Is there a way to parse out and record the effective flux due to each individual mechanism over time? In other words, is it possible to record the calcium flux due to mechanism 1, mechanism 2, ...etc.?

This would be very helpful for debugging purposes and monitoring which mechanism has the largest contribution to the dynamics of a species.

One way that I've tried to do this is to make a "dummy" species, one for each mechanism, and define its rate to be identical to its corresponding mechanism... and then record the dummy species which would provide the calcium concentration output of that mechanism (ie, the integral of calcium flux). However, I think this has only been successful for mechanisms defined as an rxd.Rate(). But for ones defined as a reaction or multi-compartment reaction, they don't seem to work as nicely.

Thank you for any help you can provide!
Great question! How could we record these fluxes in RXD?
Thank you - any help would be greatly appreciated!

Re: Recording individual fluxes on a species that includes multiple mechanisms

Posted: Wed May 10, 2023 12:42 pm
by adamjhn
Sorry for the late reply. Current for MultiCompartmentReaction aren’t stored so cannot be directly recorded from. However by recording the contributing states, concentrations, etc. it is possible to calculate the current for any MultiCompartmentReaction.

Here is an example comparing NEURON’s Hodgkin-Huxley NMODL mechanism with an equivalent rxd implementation. I’ve recorded the currents from the mechanism and calculated them for the MultiCompartmentReactions. I’ve also inferred the corresponding flux from the currents.

Re: Recording individual fluxes on a species that includes multiple mechanisms

Posted: Wed May 17, 2023 6:59 pm
by duytanph
Thank you for your response and coding example... This really helps! I did have one follow-up question concerning the way the node is set up.

From the code you have:

Code: Select all

node = na[cyt].nodes(soma(0.5))[0]
na_cur = rxd_flux_mA(na_current, node)
k_cur = rxd_flux_mA(k_current, node)
leak_cur = rxd_flux_mA(leak_current, node)

na_flux = rxd_flux_mM(na_current, node)
k_flux = rxd_flux_mM(k_current, node)
leak_flux = rxd_flux_mM(leak_current, node)
A variable called "node" is defined using the na species and that same node is used to calculate other currents such as the k potassium current. Out of curiosity, I tried setting up another node2 variable but using the k species... and then printing out the result:

Code: Select all

node = na[cyt].nodes(soma(0.5))[0]
node2 = k[cyt].nodes(soma(0.5))[0]
print(node)
print(node2)
The printed output was:

Code: Select all

<neuron.rxd.node.Node1D object at 0x7f8904c3e3e0>
<neuron.rxd.node.Node1D object at 0x7f8904c3e410>
From the printed output, the 2 node objects do not seem to be the same reference. However, doing the calculation using node2 for the potassium current did not seem to make a difference in the current trace.

Are these 2 nodes "aliases" of the same node? Is it pretty much always safe to use the same node object on different species when recording?

Thanks!