Page 1 of 1

Mechanisms not accessible in template

Posted: Tue Nov 26, 2013 4:08 pm
by Yaeger
Hi, I am trying to create a template of a cell class in hoc. The only variable that I am declaring as public is soma, which contains all of the channel mechanisms. When I create an object from the template in Neuron, it clearly only has a capacitor (i.e. Neuron is not "seeing" the channels inserted into the soma). Does anyone know how to fix this? Here is an abbreviated version of my code below:

Code: Select all

begintemplate granule
	public soma
	create soma
	soma {
		nseg=1
		diam=11.8
		L=11.8 
		Ra=100
		cm=1
		celsius = 30
		
		insert GRC_LKG1 
		insert GRC_NA 
		insert GRC_KV
	}

endtemplate granule

Re: Mechanisms not accessible in template

Posted: Wed Nov 27, 2013 1:55 pm
by ted
A lot of effort is involved in writing a template from scratch, including much detail that seems quite artibrary, and there are many opportunities to make mistakes. Save yourself a lot of time and use the CellBuilder or the Network Builder, either of which is capable of exporting a correctly structured template that defines a new cell class.

"But I want to grow the cell (or specify its biophysical properties) algorithmically, and neither the CellBuilder nor the Network Builder lets me do that."

So construct a toy model cell with just a few sections and modest membrane properties, and export a cell class based on that. Then with that toy example as your starting point, use a text editor to add the stuff you want, one bit at a time and testing at each step, until you have accomplished your goal. Be sure to save the original exported template of your toy example, because it's a pattern that you can follow to create additional cell classes.

"But I really want to do all of this by writing code."

Don't worry, there'll be plenty of programming to do.-

Re: Mechanisms not accessible in template

Posted: Wed Nov 27, 2013 2:16 pm
by Yaeger
I believe that I have solved the problem by including an init command in the template file:

Code: Select all

begintemplate Granule

public soma
	
create soma

proc init() {	
	create soma
	soma {
		nseg=1
		diam=11.8
		L=11.8 
		Ra=100
		cm=1
		insert GRC_LKG1 
		insert GRC_NA 
		insert GRC_KV
		}
}

endtemplate Granule
Now, after creating a new cell from this template, when I call the init() procedure, the cell clearly has access to the channels inserted into the soma.

Re: Mechanisms not accessible in template

Posted: Wed Nov 27, 2013 2:17 pm
by Yaeger
Thanks Ted. I am now testing the template against the otherwise identical non-templated hoc file specifying the cell.