Closed luadam4c closed 5 years ago
this is expected behaviour, now you have sliders for I_ext
and you can vary those as parameters.
do you want to have a dynamically varying I_ext while varying parameters?
this is expected behaviour, now you have sliders for
I_ext
and you can vary those as parameters.do you want to have a dynamically varying I_ext while varying parameters?
Yes. I'm trying to keep the holding potential constant in current clamp mode as I vary the parameters with x.manipulate. To do that, I will need to update the holding current as parameters (gbar, E etc.) are changed. The most accurate way to do that is to do a quick simulation of the same model under voltage clamp and the final current will be the holding current necessary for reaching that holding potential. This holding current is then added to the current clamp protocol for the actual simulation. This also answers your question of why I wanted to copy the model by value. I think switching the model back and forth between voltage clamp and current clamp mode might cause interference. I got it to work at least for the single compartment case, but only if the parameters were sliding very slowly (it runs into an error if I slide too fast or use the arrow buttons). I suspect that if I can generate another model with the same parameters and use it for voltage clamp, the two models can work in parallel more easily.
And the reason I want to keep the holding potential constant is because I'm visually comparing the simulated trace with a data trace, which has a fixed holding potential. I think xolotl is very promising for this ability for having a quick visualization of how each parameter influences the response and which parameters would be important for fitting the data. This is something that might not be possible in NEURON. So please make this work! It will be a great tool for electrophysiologists around the world!
I'm trying to keep the holding potential constant in current clamp mode
not sure I follow. if you want to keep V_m at some fixed value, don't you want to voltage clamp it?
To do that, I will need to update the holding current as parameters (gbar, E etc.) are changed
just to be clear -- are you using V_clamp or I_ext? are you calling I_ext
the holding current? is it time varying?
The most accurate way to do that is to do a quick simulation of the same model under voltage clamp and the final current will be the holding current necessary for reaching that holding potential.
don't follow at all.
This holding current is then added to the current clamp protocol for the actual simulation. This also answers your question of why I wanted to copy the model by value.
OK, i see.
I think switching the model back and forth between voltage clamp and current clamp mode might cause interference
don't think so. setting either V_clamp
or I_ext
"unsets" the other variable, so you can only be in one of the two modes.
but only if the parameters were sliding very slowly (it runs into an error if I slide too fast or use the arrow buttons)
what error?
I suspect that if I can generate another model with the same parameters and use it for voltage clamp, the two models can work in parallel more easily.
are these two models interacting?
I think xolotl is very promising for this ability for having a quick visualization of how each parameter influences the response and which parameters would be important for fitting the data.
we have a whole another toolbox that uses xolotl to fit models to arbitrary constraints. it's here (https://github.com/sg-s/procrustes), will be made public soon
not sure I follow. if you want to keep V_m at some fixed value, don't you want to voltage clamp it?
Not always. Often when you do an experiment in current clamp mode, you still try to hold the cell at a certain level (rather than at rest) before starting the actual current injection protocol. You usually do that by altering what is called the "holding current" in MultiClamp. So in order for the simulation to match the data, a constant current has to be added onto the current protocol (the pulse or waveform).
just to be clear -- are you using V_clamp or I_ext? are you calling
I_ext
the holding current? is it time varying?
I am talking about current clamp mode, so using I_ext. The current protocol is time-varying. The holding current is not. But since xolotl can only take one I_ext, the sum is time-varying indeed.
The most accurate way to do that is to do a quick simulation of the same model under voltage clamp and the final current will be the holding current necessary for reaching that holding potential. don't follow at all.
So the problem is that the holding current is usually tuned manually by the patch-clamper and is not recorded by the computer. Therefore, as in my case (I'm using someone else's data), the holding current information is lost. Therefore, I need to estimate the holding current somehow. I can either do that by theory, but that requires some prior knowledge of the input resistance, which is something I'm trying to fit. Therefore, one technique that I have tried is to run the model under a voltage clamp at the target holding potential until it stabilizes. Then the final current necessary to hold the cell at that holding potential will be the holding current I use for the current clamp simulations. However, this needs to be redone whenever parameters are changed, since the input resistance is often changed as well.
don't think so. setting either
V_clamp
orI_ext
"unsets" the other variable, so you can only be in one of the two modes. what error?
Actually I just tried it again with the December 17 release on a single compartment model and there is no error anymore. Not sure what part of my code changed since I got that error. If it shows up again I will let you know.
However, with the latest updates, I can still apply the strategy I described above with the single compartment, but this error keeps showing up:
Error using xolotl/set.I_ext (line 231) Size of I_ext is incorrect::1st dimension size should be 10000
Error in cpplab/subsasgn (line 68) self = builtin('subsasgn',self,S,value);
Error in m3ha_xolotl_plot (line 319) xolotlObject.I_ext = externalCurrentOrig;
Error in xolotl/manipulateEvaluate (line 42) self.manipulate_plot_func{i}(self);
Error in xolotl/manipulate>@(varargin)self.manipulateEvaluate(varargin{:}) (line 152) p.callback_function = @self.manipulateEvaluate;
Error in puppeteer/sliderCallback (line 205) self.callback_function(self.parameter_names(idx),self.parameter_values(idx))
Error in puppeteer>@(varargin)self.sliderCallback(varargin{:}) (line 111) sliders(i) = uicontrol(self.handles.fig,'Position',[80 self.base_y_pos(i) 230 20],'Style', 'slider','Callback',@self.sliderCallback,'Min',lb(i),'Max',ub(i),'Value',parameter_values(i)); Error using xolotl/integrate (line 161) Error while evaluating UIControl Callback.
Is it possible to revert this behavior?
I suspect that if I can generate another model with the same parameters and use it for voltage clamp, the two models can work in parallel more easily.
are these two models interacting?
One will compute the holding current for the other, so they work in series. Perhaps it's not necessary to have two models.
I think xolotl is very promising for this ability for having a quick visualization of how each parameter influences the response and which parameters would be important for fitting the data.
we have a whole another toolbox that uses xolotl to fit models to arbitrary constraints. it's here (https://github.com/sg-s/procrustes), will be made public soon
That will be very useful indeed and I look forward to it. But for now I just want to play around with parameters. That way I can decide on what objective function to use and what constraints I want to apply to the fitting. Also to validate whether my theoretical calculations make sense or not.
Just to rephrase, for my own understanding (correct me if I am wrong):
You want to hold the cell at a known state by injecting a constant (holding) current in order to get to a steady-state, and then perform some set of time-varying current pulses.
If you want to add some holding current I such that the membrane potential V is some predetermined quantity, you can do this in several ways.
The first is to open up your network in manipulate
and then move the I_ext
slider to find the best holding current (i.e. cross-reference by eye against the plot of voltage over time).
The second would be to voltage-clamp and determine the total transmembrane current and then apply the opposite as injected holding current. I think this will work, at least, haven't ever tried it.
The last way would be to use procrustes
to optimize a single parameter (I_ext
). As @sg-s noted, it's not public yet though.
Of course, you could also be tricky and just snapshot the parameters after a long voltage-clamp simulation and then reset to that snapshot for each set of parameters.
Then, you can design your current injection protocol by prepending a long period of holding current before the experiment.
If you wanted to come up with a theoretical justification for your holding current, it is defined by Ohm's law, where the input resistance is the sum of the inverse resistances of each conductance type. You should be able to compute the resistances of each conductance type by using the relation R = 1 / G = 1 / (gbar m^ph^q) and so on. Since you're assuming steady state, you can set m and h to their activation/(de)inactivation gating functions, for the given V you want.
Just to rephrase, for my own understanding (correct me if I am wrong):
You want to hold the cell at a known state by injecting a constant (holding) current in order to get to a steady-state, and then perform some set of time-varying current pulses.
Yes, indeed.
- The second would be to voltage-clamp and determine the total transmembrane current and then apply the opposite as injected holding current. I think this will work, at least, haven't ever tried it.
This is what I was describing, and it works without error on the December 17 release, but not with the latest updates.
Then, you can design your current injection protocol by prepending a long period of holding current before the experiment.
Actually you would apply the same holding current throughout the simulation, as you would do with MultiClamp in an experiment.
If you wanted to come up with a theoretical justification for your holding current, it is defined by Ohm's law, where the input resistance is the sum of the inverse resistances of each conductance type. You should be able to compute the resistances of each conductance type by using the relation R = 1 / G = 1 / (gbar m^ph^q) and so on. Since you're assuming steady state, you can set m and h to their activation/(de)inactivation gating functions, for the given V you want.
Yes, but it wasn't matching up when I tried it. I think it's because it is multi-compartment so I will need to account for axial resistance and can't use the entire surface area of the cell.
Also I haven't added any active currents to my xolotl model yet. Right now just having leak channels in the three compartments. The simplest three-compartment model possible.
I still don't understand what you're trying to do (and I suspect that there's a much simpler way to do this...) but it seems to me that the immediate problem is that you want to manipulate models with a time-varying I_ext, and xolotl doesn't let you do that. OK, that can be fixed.
the way this would work is a setting in x.pref where I_ext would be offered as something that can be manipulated. the default should be true.
What you were trying to do (include code to reproduce error)
Use x.manipulate when the custom plot function uses a current pulse protocol
What you expected to happen
It used to work before I updated xolotl this morning
What actually happened
This is the warning:
Indeed I_ext is reset ...