Neuron in shape plot not in cellBuilder

The basics of how to develop, test, and use models.
Post Reply
GTR

Neuron in shape plot not in cellBuilder

Post by GTR »

I have been sent a single neuron model with its mod files and some hoc files to run it.
The problem is that I want to make a small network of them to see its response.
Although I can see its topology from the Shape Plot from the Graph option of the MainMenu, I assumed that
if I opened its CellBuilder[0], I would be able to get it from there, instead of this I can only see the default (a soma).
So from Network Cell I wanted to retrieve it by choosing 'from cellbuilder' so as to design my network,but there is nothing in cellbuilder[0].
Is there any way to retrieve it from shape plot?
What else can I do to import it in NetworkCell?

The sender has its geometry-data (number of dendrites,lengths,diam etc.) in two .dat files from where they are read from hoc but I assume that as long as it is in shape plot,he had built it via cellBuilder.
Last edited by GTR on Fri Aug 04, 2006 3:42 pm, edited 1 time in total.
Raj
Posts: 220
Joined: Thu Jun 09, 2005 1:09 pm
Location: Groningen, The Netherlands
Contact:

Post by Raj »

Shapeplot shows cells irrespective of the way they were created.

With cellbuilders manager (One of the radio buttons in the builder) you can import an existing cell into the builder, which, if it works, is the easiest solution.
ted
Site Admin
Posts: 6394
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Importing a model cell into the CellBuilder

Post by ted »

How to import into the CellBuilder is described in the CellBuilder tutorial
that you will find on NEURON's Documentation WWW page
http://www.neuron.yale.edu/neuron/docs
Caveats:
Import into the CellBuilder gets topology and 3D information, but does NOT
get stylized (L, diam) specification of geometry, nor does it preserve subsets
or biophysical properties.
GTR

Post by GTR »

I followed the tutorial's instructions but when ' go ahead and import' I get the message ''Can only import a top level cell.Currently accessed section is in SThcell[0]''

Where this Sthcell[0] refers to?
Raj
Posts: 220
Joined: Thu Jun 09, 2005 1:09 pm
Location: Groningen, The Netherlands
Contact:

Post by Raj »

This tutorial explains exactly what SThcell stands for:
http://www.anc.ed.ac.uk/school/neuron/t ... /tutC.html

You might want to read the other tutorials from the same series aswell.

The message seems to indicate that you have to build the cell outside of a template to be able to import it.
ted
Site Admin
Posts: 6394
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

Raj wrote:The message seems to indicate that you have to build the cell outside of a template to be able to import it.
Exactly so. The CellBuilder can only import a cell whose sections are "top-
level" (i.e. not encapsulated in an object). Just peel away the "boilerplate"
statements that make it a template, and you will find a core of code that,
when executed, creates one "top-level" cell. If you need to learn more
about templates, start reading here
http://www.neuron.yale.edu/neuron/stati ... rogramming
or read chapter 13 of The NEURON Book.
GTR

Post by GTR »

My Dear ted/Dear Raj,

I am trying to remove the statements that make it a template and to result in a "top-level cell", so as to import it in the CellBuilder with a view to make a subthalamic network in the network builder.
I am trying to understand the whole procedure from PartC of Gillies' tutorial and that's exactly I want to achieve although I understand most of it doesn't so analytically describe the whole procedure so as to familiarise with the code cited below.

But First of all I want your view:
I know that one way is to try to make the whole network by my own implementing the code of partC via hoc but I prefer working via NEURON's powerful networkGUI as well as trying to modify the code I cite below so as to import it into cell builder and use then 'network cell' and 'network builder'.

So let's assume that I removed "begin/end template" statements

What to do with objref statement do I also have to remove it?
I hope that this f that creates a file doesn't bother.
What to do with this local variable res ,I get :
func diam() {local res nrniv: syntax error near line 511 there when I run the code via the interpreter
the same with the tree lengths L(tree,branch): func L() {local res
nrniv: L : Redeclaring at top level
near line 181
func L() {local res


and with diameters :

func diam() {local res
nrniv: syntax error
near line 162


as well as with:
Ra(tree) returns the recorded Ra
oc> func Ra() {local res
nrniv: Ra : Redeclaring at top level
near line 200
func Ra() {local res
do all these errors have to do with the object definition?

What else do I have to remove/modify in order to gradually end up with the 'clean' code ?


I have 'tree0-nom.dat' and 'tree1-nom.dat' in a seperate folder within the hoc file below so as to be read if they are called via f.ropen.

That's the code I want to make "top-level".A prototype STh cell class is firstly implemented and then the STh CELL OBJECT :

Code: Select all

//SThprotocell
begintemplate SThproto
 public ntrees,ntree0,ntree1,somadiam,somaL,PI
 public ref,child,diam,L,nseg,Ra,Cm

 objref f
 objref tree0ref,tree0c1,tree0c2,tree0diam,tree0L,tree0nseg,tree0dist,tree0var
 objref tree1ref,tree1c1,tree1c2,tree1diam,tree1L,tree1nseg,tree1dist,tree1var

 proc init() {local i, j, me, child1, child2

  somaL = 18.8
  somadiam = 18.3112
  
  nsegscale = 1

  ntrees = 2
  tc=0
  PI=3.14159265358979

  printf("  %d trees\n",ntrees)

  // TREE 1

  ntree0=23
  tree0ref  = new Vector(ntree0)
  tree0c1   = new Vector(ntree0)
  tree0c2   = new Vector(ntree0)
  tree0diam = new Vector(ntree0)
  tree0L    = new Vector(ntree0)
  tree0nseg = new Vector(ntree0)
  tree0dist = new Vector(ntree0)
  tree0var  = new Vector(ntree0)

  f = new File()
  f.ropen("sth-data/tree0-nom.dat")
  i=0
  while (!f.eof()) {
   if (i<ntree0) {
    tree0ref.x[i]  = f.scanvar()-1 // myref
    tree0c1.x[i]   = f.scanvar()-1 // child1
    tree0c2.x[i]   = f.scanvar()-1 // child2
    tree0diam.x[i] = f.scanvar()   // diam
    tree0L.x[i]    = f.scanvar()   // L
    tree0nseg.x[i] = nsegscale*f.scanvar()   // nseg
   }
   i=i+1
  }
  if (i!=ntree0) printf("WARNING file tree0ns.dat is inconsistent expecting %d branches got %d \n",ntree0,i)

  // sort Vectors

  sortv(ntree0,tree0ref,tree0c1,tree0c2,tree0diam,tree0L,tree0nseg)

  printf("  loaded tree 0 (%d branches)\n",ntree0)
  f.close()

  // TREE 2

  //  THE STh CELL OBJECT
//
[b]
begintemplate SThcell[/b]
 public soma, dend0, dend1

 // declare the variables we will be using

 create soma, dend0[1], dend1[1]

 objref sthtype

 strdef cmd

 proc init() {local i, j, me, child1, child2

   // $1   = cell reference number
   // $o2  = cell prototype
   
   cellref = $1
   
   sthtype = $o2

   SThndend0  = sthtype.ntree0
   SThndend1  = sthtype.ntree1

   create soma, dend0[SThndend0], dend1[SThndend1]

   soma {
     nseg = sthtype.nseg(-1,-1)
     Ra = sthtype.Ra(-1)
     diam = sthtype.diam(-1,-1)
     L = sthtype.L(-1,-1)
     cm = sthtype.Cm(-1)

     // channels
     
     insert SThinsert Na insert NaL insert KDR insert Kv31 insert Ih insert Cacum insert sKCa insert CaT insert HVA
   }

   for i = 0,SThndend0-1 {
     
     me = sthtype.ref(0,i)
     child1 = sthtype.child(0,i,0)
     child2 = sthtype.child(0,i,1)

     dend0[me] {

       if (child1 >= 0) {
        connect dend0[child1](0), 1
       }

       if (child2 >= 0) {
        connect dend0[child2](0), 1
       }

       diam = sthtype.diam(0,i)
       L = sthtype.L(0,i)
       Ra = sthtype.Ra(0)
       nseg = sthtype.nseg(0,i)
       cm = sthtype.Cm(0)
       
       // channels
       
       insert STh insert Na insert NaL insert KDR insert Kv31 insert Ih insert Cacum insert sKCa insert CaT insert HVA
     }
   }

   for i = 0,SThndend1-1 {

     me = sthtype.ref(1,i)
     child1 = sthtype.child(1,i,0)
     child2 = sthtype.child(1,i,1)

     dend1[me] {

       if (child1 >= 0) {
        connect dend1[child1](0), 1
       }

       if (child2 >= 0) {
        connect dend1[child2](0), 1
       }

       diam = sthtype.diam(1,i)
       L = sthtype.L(1,i)
       Ra = sthtype.Ra(1)
       nseg = sthtype.nseg(1,i)
       cm = sthtype.Cm(0)       
 
       // channels
       
       insert STh insert Na insert NaL insert KDR insert Kv31 insert Ih insert Cacum insert sKCa  insert CaT insert HVA
     }
   }

   // connect trees to soma

   connect dend0[0](0), soma(1)
   connect dend1[0](0), soma(0)
 }
endtemplate Sthcell
To sum up,is it feasible from this code to 'peel away' all the statements that make it an object?
Any help, remarks and advices are welcome!!
Last edited by GTR on Fri Aug 04, 2006 3:46 pm, edited 1 time in total.
ted
Site Admin
Posts: 6394
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

I am trying to remove the statements that make it a template and to result in a "top-level cell", so as to import it in the CellBuilder with a view to make a subthalamic network in the network builder.
Forget about it. The code in your template uses the stylized method (specifying L & diam)
to define geometry. Importing a stylized model into the CellBuilder gets only topology--
you'll lose all the lengths and diameters.
GTR

Post by GTR »

Forget about it
I had an inkling about this judging from "kind of information imported" of the cell builder's management section.
So I can't work via NetworkBuilder?
So the only way is to deal with "templates" and "Netcon" commands based on partC which doesn't so analytically describe the whole procedure so as to familiarise with hoc code.
The code in your template uses the stylized method (specifying L & diam)
Do you mean also 'tree0-nom.dat' and 'tree1-nom.dat' of sth-data which are imported with f.ropen and includes the geometrical features of the cell?

What about trying to import Sth cell's topology into the CellBiulder and then typing the values for L and diam one by one with the help of the geometry section(I have the values for 11 and 23 sections of tree0-nom and tree1-nom respectively)?
Is this feasible?What part of the code do I have to isolate so as to import neuron's topology?
But then how to import conductances' levels and distribution of each channel along the dendrites which I also have in sth-data.
ted
Site Admin
Posts: 6394
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

GTR wrote:So I can't work via NetworkBuilder?
A model created by the code in your template cannot be imported into the CellBuilder.
So the only way is to deal with "templates" and "Netcon" commands based on partC
False. There are many different strategies for setting up network models that use cell
classes and NEURON's event delivery scheme for implementing spike triggered synaptic interactions. Call them "different network management strategies" if you like.
The basic tasks are the same, no matter what strategy you adopt:
--create the model cells
--connect the model cells
Gillies & Sterratt's tutorial exemplifies one way to do this, and the hoc code emitted by
the Network Builder is a second, but others also exist. You are free to use either* of
these approaches, or develop your own.

*--You can adopt the style exemplified by the Network Builder's output without first
using your own cell class's code in a toy net created with the Network Builder. Just
make a toy net with a couple of very simple model cells, and study the Network Builder's
hoc output. From that you will see what changes may be needed to accommodate your
own cells, or what changes may be necessary in your own code.
GTR wrote:
The code in your template uses the stylized method (specifying L & diam)
Do you mean also 'tree0-nom.dat' and 'tree1-nom.dat' of sth-data which are imported with f.ropen and includes the geometrical features of the cell?
Your code specifies L and diam, and does not use pt3dadd statements.
What about trying to import Sth cell's topology into the CellBiulder and then typing the values for L and diam one by one with the help of the geometry section(I have the values for 11 and 23 sections of tree0-nom and tree1-nom respectively)?
The choice is either to work harder or to work smarter. You decide.
What part of the code do I have to isolate so as to import neuron's topology?
I don't understand this question. If the sections exist at the top level, the CellBuilder can
import topology.
But then how to import conductances' levels and distribution of each channel along the dendrites which I also have in sth-data.
Easy--they won't be imported into the CellBuilder. So don't even try. If you have to use
model cells created by that template of yours, you have to work smarter.
GTR

Post by GTR »

Dear ted / Raj,
based on PartC of the tutorial (Gillies and Sterratt) I made my subthalamic network model (using my own treeA and treeB data).

Just to cite a part of it: (similar to the code of partC)

Code: Select all

load_file("nrngui.hoc")

objref cvode

cvode = new CVode(0)

begintemplate SThcell
public soma, treeA, treeB, nclist

create soma, treeA[1], treeB[1]
objectvar f, nclist

proc init() {local i, me, child1, child2

    create soma

    nclist = new List()

    soma {
      nseg = 1
      diam = 18.8
      L = 18.8
      Ra = 123.0
      insert hh
      ena = 71.5
      ek = -89.1
      gnabar_hh=0.25
      gl_hh = .0001666
      el_hh = -60.0
      
      // channels
     
          insert Na
     insert NaL
         insert Ih
     insert Cacum
     insert sKCa
          insert CaN
     insert CaT
.....................
     }

f = new File()
    f.ropen("treeA.dat")
    
    ndendA = f.scanvar()
    create treeA[ndendA]

    for i = 0,ndendA-1 {
      me = f.scanvar() - 1
      child1 = f.scanvar() - 1
      child2 = f.scanvar() - 1

      treeA[me] {
        nseg = 1
        diam = f.scanvar()
        L = f.scanvar()
        Ra = 123
        // initialise and clear the 3D information
        pt3dclear()
	pt3dadd(f.scanvar(),f.scanvar(),f.scanvar(),diam)
	pt3dadd(f.scanvar(),f.scanvar(),f.scanvar(),diam)
        
	// channels
................................
     
     	if (child1 >= 0) {
          printf("connecting tree A dendrite %d (0 end) to parent %d (1 end)\n",child1,me)
          connect treeA[child1](0), 1
        }
        if (child2 >= 0) {
	  printf("connecting tree A dendrite %d (0 end) to parent %d (1 end)\n",child2,me)
          connect treeA[child2](0), 1
        }
      }
    }
    f.close()

    f.ropen("treeB.dat")

    //the same for treeB
.................................................................

// Connect trees to the soma
    connect treeA[0](0), soma(1)
    connect treeB[0](0), soma(0)
}

endtemplate SThcell

tstop = 800
ndend = 2
nSThcells = 4

objectvar SThcells[nSThcells]

for i = 0, nSThcells-1 {
    SThcells[i] = new SThcell()
}

objectvar stim[nSThcells]

//the stimuli
.......................................................
// SThcells[0] -> SThcells[1].soma

maxsyn = 10
objectvar syn[maxsyn]

SThcells[1].treeA[1] syn[0] = new ExpSyn(0)
SThcells[0].soma SThcells[1].nclist.append(new NetCon(&v(0), syn[0], -20, 1, 0.8))

access SThcells[0].soma

// SThcells[1] -> SThcells[2].soma

SThcells[2].treeA[2] syn[1] = new ExpSyn(0)
SThcells[1].soma SThcells[2].nclist.append(new NetCon(&v(1), syn[1], -18, 1, 0.8))

access SThcells[1].soma

// SThcells[2] -> SThcells[3].soma

SThcells[3].soma syn[2] = new ExpSyn(0)
SThcells[2].soma SThcells[3].nclist.append(new NetCon(&v(2), syn[2], -18, 1, 0.9))

access SThcells[2].soma

xopen("SthNet.ses")
run()
Your code specifies L and diam, and does not use pt3dadd statements.


Now just from curiosity about an older question:
my code above uses pt3dclear and pt3dadd statements is it now possible to make it 'top-level' and import the topology into CellBuilder even though losing diam and L?
If yes ,apart from removing template statements what else can I modify?


Referring to the lower part of the code I tried to connect the four cells together by making three synaptic objects guided by "dealing with lists " of partC. So I made the consecutive connections: sthcells[0] -> sthcells[1] -> sthcells[2]->sthcells[3]

Although I have to admit that I haven't tottaly grasped the function and syntax form of lists,nclist,append and netcon objects,I have some questions referring to the lower part of the code :

1)If I guess right, ExpSyn[0] refers to a kind of synapse with exponential decay but I don't understand where the subscript [0] refers to?

2)The same question about Syn[?],
I put Syn[0] Syn[1] Syn[2] respectively as you can see.

3)About the argument of ......new NetCon(&v(), syn[1],.........))
I see that "&v()" refers to the voltage source but for example in my first synapse:

// SThcells[0] -> SThcells[1].soma
SThcells[1].treeA[1] syn[0] = new ExpSyn(0)
SThcells[0].soma SThcells[1].nclist.append(new NetCon(&v(0), syn[0], -20, 1, 0.8))

what this (0) means?
Was it right to put v(1) v(2) v(3) for each one?

4)I understand this: SThcells[1].treeA[1] syn[0] = new ExpSyn(0)
as a synapse of expDecay attached to treeA[1] branch of SThcells[1]
but what about this part of the code: .nclist.append(new NetCon(&v(0),... of the next line?what does this nclist offer?



P.S. I tried to understand them from the examples of Chapter 11:modeling networks but I didn't make it,
Have you anywhere any tutorial or index for these statements lists,nclist,append and netcon (their function and syntax form) similar to that you have for NMODL statements?
GTR

Post by GTR »

Ok I found the answer to my first question 1):

from chapter 10 of neuron book:

Example 10.3:Synapse with exponential decay
// attach an ExpSyn1 point process called syn
// to the 0.3 location on dend[3] of cell[5]

objref syn
cell[5].dend[3] syn = new ExpSyn1(0.3)

So in my case it refers to 0 location on treeA[1] of sthcells[1]
ted
Site Admin
Posts: 6394
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Post by ted »

my code above uses pt3dclear and pt3dadd statements is it now possible to make it 'top-level' and import the topology into CellBuilder even though losing diam and L?
Topology is merely the branched architecture. It imports regardless of whether geometry
was specified with the stylized (L, diam) or 3D (pt3dadd) style. Geometry does not import unless specified with the 3D style. When 3D specification exists, NEURON computes
effective L and diam from the xyzdiam data.
ExpSyn[0] refers to a kind of synapse with exponential decay but I don't understand where the subscript [0] refers to?
It is not really a subscript. It is a computer-generated part of the name of an object.
Every instance of an object class has a name that has two components: the name of
the class, and an automatically generated "index" that distinguishes this particular
instance from every other instance of the same class. Read about object names in
chapter 13 of The NEURON Book, which discusses object-oriented programming in
NEURON.
About the argument of ......new NetCon(&v(), syn[1],.........))
I see that "&v()" refers to the voltage source but for example in my first synapse:

// SThcells[0] -> SThcells[1].soma
SThcells[1].treeA[1] syn[0] = new ExpSyn(0)
SThcells[0].soma SThcells[1].nclist.append(new NetCon(&v(0), syn[0], -20, 1, 0.8))

what this (0) means?
v is a range variable. v(0) means "v at the 0 end of the currently accessed section."
Was it right to put v(1) v(2) v(3) for each one?
Given what you know now, what do you think?
I understand this: SThcells[1].treeA[1] syn[0] = new ExpSyn(0)
as a synapse of expDecay attached to treeA[1] branch of SThcells[1]
but what about this part of the code: .nclist.append(new NetCon(&v(0),... of the next line?what does this nclist offer?

I don't understand the question.
Have you anywhere any tutorial or index for these statements lists,nclist,append and netcon (their function and syntax form) similar to that you have for NMODL statements?
The Programmer's Reference entries on features and usage of the List and NetCon classes
tend to be terse, but they are complete, definitive, and accompanied by illustrative examples.
If you are looking for something more explicit, I can only suggest a careful reading of the
tutorial by Gillies and Sterratt, and Chapter 11 of The NEURON Book.
Post Reply