access to section!

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

access to section!

Post by thats_karlo »

Hi,

Suppose you have a complex morphology data of a cell, and you have successfully convert it to neuron.

in "sh" windowes, when i type oc> topology() i will see my sections that consists of :
soma , dend1[0], dend1[1],.........
dend2[0], dend2[1],.........
.......................................
.......................................
dend10[0], dend10[1],.........

i want to write a code that contain a for loop,which in this loop i like to have access to every section. Assume, we can show dendrtic segment with symbol dendj[0:end], that "j" showes barnch , [0:end] shows number for barnch segmant( i hope it is clear).

my for loop is like:

for j=1,end{
for i=1,end{
accecc dendj

dendj.dima=2*j // for example!
}
}

so, is there any command to find how many barnch we have? j=1,?
is there any command to find how many segment are attributed to a barnch? i=1,?

or, maybe you have other way, to have access to every segment?

Thanks in advance!

Karlo
Raj
Posts: 220
Joined: Thu Jun 09, 2005 1:09 pm
Location: Groningen, The Netherlands
Contact:

Post by Raj »

thats_karlo

Post by thats_karlo »

Hi,
thanks Raj,

I look at "forall" and "forsec" , but i doesn't help me.

consider you have soma, and 10 barnch of dendrits, and ever brach contanis defferent number of section. so, in NEURON section names are consiste of:

soma

dend1[0],dend1[1],......dend1[n1]
dend2[0],dend2[1],......dend2[n2]
....
.....
dend10[0], dend10[1],......dend10[n10]


1-do you know any way to determine, how many barnches we have?

here, 10 barnch

2- for every barnch, how many sub-section we have?

here, what 's n1,n2,....n10?


3-Can i change the name of section from

(dend1[0],..dend1[n1],dend2[0],...dend2[n2],.....dend10[n10])

to

(dend[0],dend[1],dend[2],.......,dend[100],.........dend[500])

4- Or, can i make a section list, with some command to access every emembre of list,e.g,

mylist=[dend1[0] dend1[1]........dend5[18]........dend10[11]]

for i=1, size(list){
access mylist
mylist.diam=2*i // for example!
}



await for any suggestion!

thanks,

Karlo
Raj
Posts: 220
Joined: Thu Jun 09, 2005 1:09 pm
Location: Groningen, The Netherlands
Contact:

Post by Raj »

Code: Select all

forall {
	print secname()
}
gives you all section names.

Alternatively you can use the topology function:http://www.neuron.yale.edu/neuron/stati ... l#topology
The output of this function also gives you how they are connected and you can read of the information you need. In this is case it might not be worth it to try to automate the process further.

With for example

Code: Select all

forsec "dend11" {
// do my thing
}
You can now operate on most of the individual branches, but be in for a surprise when you use dend1, you will get dend11 and dend10 for free! If you only use dend you will get them all, which you can use to make the SectionList you like to use:

Running

Code: Select all

objref dendriticSections
dendriticSections=new SectionList()
forsec "dend" {
dendriticSections.append()
}
adds all section which have dend in their name to the section list.
With:

Code: Select all

forsec dendriticSections {
// do my thing
}
you can now iterate over all sections in your sectionList.
thats_karlo

Post by thats_karlo »

Thanks,

Just could you tell more one more point! in the code

Code: Select all

objref dendriticSections
dendriticSections=new SectionList()
forsec "dend" {
                    dendriticSections.append()
}

forsec dendriticSections {
                                 // do my thing
}
i like to insert my function in part "// do my thing". Actually i use my function like

Code: Select all

sectionname   result=myfunc()
print result

or

access sectionname
result= myfunc()
print result
Could you tell me how can i use, my function in
forsec dendriticSections {
// do my thing
}

to do calculation for every member of section list!


thanks again,

Karlo
Raj
Posts: 220
Joined: Thu Jun 09, 2005 1:09 pm
Location: Groningen, The Netherlands
Contact:

Post by Raj »

Just define a function, example:

Code: Select all

func myfunc(){
  return diam
}
and call it:

Code: Select all

forsec dendriticSections {
  print myfunc()
}
thats_karlo

Post by thats_karlo »

Thanks Raj!

Your comments were very usefull. I have learned alot from this post.
Post Reply