openworm / ChannelWorm

Tools and curated datasets to build quantitative models of C. elegans ion channels
MIT License
12 stars 11 forks source link

Determine origin of scale offset in model/test comparison #96

Closed rgerkin closed 8 years ago

rgerkin commented 9 years ago

In this comparison of model and data, the scales of the resulting IV curves (cell 19, may change) differ by about a factor of 10 (data in black, model prediction in red). Where is this coming from?

VahidGh commented 9 years ago

@rgerkin, I think we need to divide the predicted current by membrane capacitance. The observed current has A/F unit (in cell 16), I'm handling this by the toSI parameter that for some reason did not consider in the peace of code you've taken from the cwFitter.

rgerkin commented 9 years ago

@VahidGh @pgleeson Good catch. Where do I find the capacitance in the "cell" used by the pyNeuroML LEMS template for doing IV curve experiments? Is it set to 1 implicitly? We need about a factor of 10 to get these things back in register.

VahidGh commented 9 years ago

The membrane capacitance value is used in the Boyle&Cohen model is ~7.2e-11 F. So if the current is in pA, then I'm not sure if dividing by this value make it better. In the other hand I don't know how this is available using LEMS or PyNeuroML, @pgleeson may could help on this. But it would be great if we had somewhere for storing such parameters.

VahidGh commented 9 years ago

Another thing is that where did the max conductance and reversal potential come from? In the Neuroml2 file for EGL-19 we don't have those parameters, they are available in a separate cell.nml file. As I didn't know how should I handle those in this repo (https://github.com/openworm/muscle_model/issues/49), I didn't include the cell file. maybe this also makes some problem!

rgerkin commented 9 years ago

@VahidGh @travs @pgleeson So I think the multiplicative offset is arbitrary unless we think we know the single channel conductance of the channel. Any patch recorded from the real cell will have a capacitance proportional to the patch area, and a current proportional to that area and to the areal density of channels on that patch. The capacitance normalization is just a proxy for areal normalization.

In contrast, the model cell has a capacitance (or capacitance per unit area), but the recorded current should be in terms of a current per channel, for .nml files specifying a single instance of the channel. So while there might have been e.g. 20 channels per micron-squared in the actual patches recorded experimentally, I think there is only one channel in the sim.

There can be no true normalization unless we know the ground truth about single channel conductance, from a recording of a patch with one or a few channels (which I don't think is in the paper). Without that, data in which patches had many low conductance channels or a few high conductance ones are indistinguishable (as long as there are enough for the data to still look continuous). If we know the single channel conductance, we could constrain that and solve for the areal density of channels, and then divide it out to get something that is on the same scale as the model (or alternatively multiply the model by the areal density).

Of course, the NML file for Ca Boyle does have a number for the conductance, and we could use that as the single channel conductance, but I don't know where that comes from. Does it come from an experiment, or was it used to make some other model work?

VahidGh commented 9 years ago

@rgerkin, assuming this would be happening for conductance, then we would have the same problem with E_rev, which is also a property of the cell membrane again (as described in NeuroML cell definitions).

In The the Boyle&Cohen model, in table A.1, there is a reported section for conductance, e_rev, and C_m, the model has generated near the same values, and then compares it with experimental reports.

So, if we want to consider a macroscopic current from some cell for each channel, then we need to consider the properties of the cell too. And this is possible only if we had dense conductance, e_rev, and membrane capacitance info for each cell we are going to model in C. elegans (#138). In addition to the same values for xenopus oocytes which is the common tool in lots of experiments.

rgerkin commented 9 years ago

@VahidGh E_rev is intrinsic to a patch of cell membrane (i.e. independent of patch size) and can be computed directly in an experiment with a large page. Total Conductance is extrinsic (scales with patch size) and will be unique to each experiment. So with E_rev there is nothing further to do to get the value that has not already been done in the original experiment. But single channel conductance needs a new experiment or a count of channels in the patch in the original experiment.

When you say "the model has generated near the same values" do you mean the model assumes nearly the same values? Or was there some process by which the model obtained those values independently?

Membrane capacitance per unit area is also intrinsic, and furthermore probably the same for every cell of a given type. I don't even think it varies by more than a factor of 2 across species, since the lipid bilayer is a pretty generic feature of biology. It's really conductance that is the odd case here, because ten 5 pA channels in a patch looks the same as five 10 pA channels, so we have no way to derive the single channel conductance without an external data source.

VahidGh commented 9 years ago

@rgerkin, I think we need to separate tests, to at least two different tests: one for channel gating (e.g. m/v, tau/v, h/v, etc.), which is independent of the cell, and one for macroscopic current (e.g. I/V, I/t, etc.) which depends on the cell and experiment. For the latter, I think by having dense conductance (e.g. S/m2, or S/F) for each experiment and recalculating that for a simulation environment (e.g. from xenopus oocyte experiment to motor neuron cell model), it is possible to deal with the problem.

As for the Boyle&Cohen model, first, they defined some constraints for min and max values based on the experimental data, and then tried to find the best set of parameters. After optimization, they reported the above-mentioned parameters are near the same values reported by others.

And yes, specific capacitance is 0.01 F/m2 for all the cells. But a channel with E_rev of 50 mV (which is the value for EGL-19) with a holding potential of 0 has also a 5-fold current in compare with the same condition but E_rev of 10 mV :) Of course, E_rev is not the main problem in your case, but is needed for an accurate generic test.

rgerkin commented 9 years ago

@VahidGh Of course E_rev is just as important as single channel conductance. But one is trivial to compute in a patch clamp experiment and the other requires a sufficiently small patch size or sufficiently low channel density, or non-stationary fluctuation analysis (which @pgleeson's boss has done many times).

For the purposes for our model, if we don't care about the small channel density regime, then we should just apply a scale multiplier in the simulation to maximize the agreement between model and data. Then we would note that either 1) we don't really know the single channel conductance, and it is likely off by an arbitrary scale constant or 2) we know the single channel conductance with certainty, so any scale difference is due to incidental experimental parameters which are irrelevant.

So the ultimate question is: do we want to try to solve for that scale constant by figuring out the area of the patch in each experiment, or do we want to just make one up in each test by assuming that the single channel conductance in the NML file is gold?

VahidGh commented 9 years ago

@rgerkin, agreed, maybe considering two other steps in a validation test, makes it more clear and robust. One, comparing parameters used in the simulation environment for the test, with those used by the model. And two, validating the model by using it with/within other models.

pgleeson commented 9 years ago

@VahidGh @rgerkin I've added a script https://github.com/openworm/muscle_model/blob/master/NeuroML2/ivcurve_ca_boyle.sh which generates a better iv curve for ca from the NML model;

selection_244

Left is Python version, right is ivcurve_ca_boyle.sh

Note that the the value used in conductance="10pS" in ca_boyle.channel.nml is quite arbitrary. It's not normally used in the cell model as this is overridden by the condDensity value on the channelDensity element. The iv curve does use this value though, and what that plot represents is: the current required by a voltage clamp to counteract the current through a single ion channel (with conductance="10pS") on a cell with only that channel.

The approach I'd take to comparing these plots (note this file):

rgerkin commented 9 years ago

@pgleeson @VahidGh OK I'll start there, and it sounds like applying a pre-scaling factor to minimize the difference between model and experiment is the way to go. The algorithm for that should be similar to the one in this old friend that I have implemented before.

rgerkin commented 9 years ago

@pgleeson @VahidGh With the use of an arbitrary scaling factor (an arbitrary capacitance; I could have used a surface area but this is basically the same idea) and the python quantities package, I have addressed this here. I am going to handle units with quantities going forward, so fudge factors like this should be transparent.

VahidGh commented 9 years ago

@rgerkin, Great, and maybe by using another scaling factor, scales getting better! But now the question is why the peak current, is shifted ~20 mV, from the original one, and the model generated by @pgleeson?!

rgerkin commented 9 years ago

Probably because the model parameters are wrong! If we trust this data, a next step is to tune the model parameters to achieve a better fit.

rgerkin commented 8 years ago

@VahidGh @pgleeson I've implemented a scaling factor here to produce the closest possible agreement between model and experimental IV curves. I updated this testing notebook to utilize it.