Page 1 of 1

Adding NMODL-specified mechanisms to a model

Posted: Wed Jan 18, 2012 2:28 am
by sanjaybioe
Dear Ted, I have successfully created copies of CA3 pyramidal neurons from the model 101629, using the GUI. The hoc file generated in the process ("new21nov11.hoc") has the template. There is a simultaneous .ses file also created. I created a folder X having a mainfile.hoc which has the statements


load_file("nrngui.hoc")

//xopen("new21nov11.hoc")

xopen("new21nov11.ses")

How do I go about including the MOD files for the channels? Is it correct to copy all MOD files from the published model, put it in the same folder X and compile them? I tried this and found no error. But I would like to know where to include the 'insert' keyword for the channel mechanisms. My aim as of now is to see that the two identical neurons that i have created from the template give me the same response independently as that of the published single neuron model and thereafter to have synaptic connections between them.

Re: Adding NMODL-specified mechanisms to a model

Posted: Wed Jan 18, 2012 10:08 am
by ted
sanjaybioe wrote:Is it correct to copy all MOD files from the published model, put it in the same folder X and compile them?
Yes.
I would like to know where to include the 'insert' keyword for the channel mechanisms.
Good question. You could proceed in a couple of different ways.

The contents of your mainfile.hoc indicate that, up to this point, you have been using the GUI to specify the properties of your model--probably with a CellBuilder, if your cell has complex anatomy. You could continue to proceed using the CellBuilder. When you first used the CellBuilder to specify model properties, before compiling the mod files, the Biophysics page would have offered only a few density mechanisms: pas, hh, extracellular. After compiling the mod files, if you once again execute mainfile.hoc, new mechanisms will be listed on the Biophysics page (assuming that your mod files specify density mechanisms, that is). This allows you to add the mechanisms directly to your CellBuilder, but it also has two implications:
1. you must be sure to save a new ses file so that your changes will be saved; otherwise the next time you execute mainfile.hoc, your model cell will only have the original mechanisms that were specified.
2. if you plan to compare two model implementations that are descendants of some parent model, you will probably want to save a separate CellBuilder ses file for each of the implementations. You'll probably want to give these distinctive names. For example, suppose your original model was entirely passive, but your project goal is to compare a model that has the hh mechanism against a model that has mechanisms taken from one of Migliore's papers. It would make sense to call the ses files cell_pas.ses, cell_hh.ses, and cell_mig.ses, respectively.

"Fine, but my current ses file contains not just a CellBuilder but also a RunControl panel, a Graph, and a PointProcessManager configured as an IClamp."

So your very first step should be to start NEURON, load your existing ses file, and then use the Print & File Window Manager to save just the original CellBuilder to cell_pas.ses, and then save the RunControl panel, Graph, and PointProcessManager (to learn about this tool, see
Q: I've used the NEURON Main Menu to construct and manage models. How can I save what I have done?
in the FAQ list--link to the FAQ list is on the Documentation page of http://www.neuron.yale.edu) to another file that you might call rig.ses ("rig" because it is a "virtual experimental rig," analogous to the rack of equipment used by wet lab experimentalists).

Next create a new hoc file called init.hoc that contains these statements:
load_file("nrngui.hoc")
load_file("cell_pas.ses")
load_file("rig.ses")
and you will find that using NEURON to execute init.hoc will recreate your model and your experimental rig.

Then, after you add hh to your model and save a ses file called cell_hh.ses, you merely revise init.hoc to read
load_file("nrngui.hoc")
// load_file("cell_pas.ses")
load_file("cell_hh.ses")
load_file("rig.ses")
and, lo and behold, you are prepared to do the same experiment on your new model as you did on the original one. Ah, the advantages of organizing code in a modular manner.

"Fine, but is there a way that I could have used hoc statements to modify my model?"

Yes, and this approach has some advantages--for one thing, you only need one CellBuilder ses file, because all of your channel insertions and uninsertions can be done with hoc statements. But first you must make sure that your CellBuilder is not in "Continuous Create" mode; otherwise if you do anything at all with the CellBuilder, the CellBuilder will overwrite whatever changes you have made by executing your own hoc statements. For example, this init.hoc ensures that the CellBuilder does NOT stay in Continuous Create mode, then adds the hh mechanism to, and removes the pas mechanism from, all sections named axon*

Code: Select all

load_file("init.hoc")
load_file("cell_pas.ses") // a CellBuilder that specifies an entirely passive model cell
// at this point there will be just one instance of the CellBuilder class
// and its name will be CellBuild[0]
// and, assuming that the CellBuilder was saved in Continuous Create mode,
// a model cell will exist.

CellBuild[0].continuous = 0 // ensures that the CellBuilder is NOT in Continuous Create mode
forsec "axon*" {
  insert hh
  uninsert pas
}
And if you wanted to compare a model with hh against a model with some other mechanisms, you could still use modular programming, but now the modularity would involve the insert and uninsert statements, not which ses file would be loaded. For example, you might start with this init.hoc file

Code: Select all

load_file("init.hoc")
load_file("cell_pas.ses")
CellBuild[0].continuous = 0

load_file("use_hh.hoc")
and create a file called use_hh.hoc that contains these statements

Code: Select all

forsec "axon*" {
  insert hh
  uninsert pas
}
Then when you want to use Migliore's mechanisms, you revise init.hoc to read

Code: Select all

load_file("init.hoc")
load_file("cell_pas.ses")
CellBuild[0].continuous = 0

// load_file("use_hh.hoc")
load_file("use_mig.hoc")
and create a file called use_mig.hoc that contains whatever insert statements are necessary to add the mechanisms you want, where you want them.