Utilizing morphology from IMARIS: help classifying "filaments" as basal/apical dendrites, etc

Managing anatomically complex model cells with the CellBuilder. Importing morphometric data with NEURON's Import3D tool or Robert Cannon's CVAPP. Where to find detailed morphometric data.
Post Reply
sbrich
Posts: 29
Joined: Tue May 08, 2018 2:08 pm

Utilizing morphology from IMARIS: help classifying "filaments" as basal/apical dendrites, etc

Post by sbrich »

Hello all (my first post here!),

I am currently "taking over" a project in my new lab that involves utilizing NEURON to create a detailed multi-compartment cell model. The existing code that was handed off to me included the cell's morphology taken utilizing the IMARIS program. While I'm not familiar with this particular program, one of its limitations seems to be that, in creating the morphology in a fashion that NEURON can utilize, it does not differentiate between soma, dendrite, and axon; instead, all portions of the cell are simply classified as "filaments". For example, the morphology file looks like the following (with details redacted):

Code: Select all

strdef neuron_name
neuron_name = "Filaments 1"

create filament_100000042[211]

filament_100000042[0]{
pt3dclear()
pt3dadd(...)
pt3dadd(...)
}

filament_100000042[1]{
...
}

...

connect filament_100000042[1](0.0), filament_100000042[0](1.0)
...

define_shape()
access filament_100000042[0]
I am currently working on putting various ion channels into the model, and am evaluating the pros and cons of doing so uniformly across all of the "filaments" or doing so differently for the soma, dendrites, and axon. However, the later option, at present, would involve me manually going through all of the filaments and classifying them by hand (which I'm also mildly concerned could lead to some unintended consequences to the code if, say, I change 200 of the filaments to be instead be objects of the form dendrite[]). So, my primary question is this: is there any way that, utilizing NEURON, I can programmatically classify and rename the various filaments that currently make up my morphology, or am I restricted by the way the morphology was taken to doing this manually? Any other thoughts/suggestions on anything brought up in this lengthy post would also be appreciated, as this project is my first major foray into utilizing NEURON in my research!

Thanks in advance for any help you all can provide.
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Utilizing morphology from IMARIS: help classifying "filaments" as basal/apical dendrites, etc

Post by ted »

Your choice is to work hard or to work smart. Hard would be to literally rename each section, and that would involve you using a text editor to modify a copy of the original file from Imaris. Very tedious, and P(making multiple, time-wasting mistakes) is 1.

Smart would be to import the morphology into a CellBuilder, and then use the CellBulider's (very convenient) ability to group sections into sets. The following instructions sound complicated, but they're really quite simple, and this is all much easier to do than to write about or read.

Start by using NEURON to execute that ugly hoc file generated by Imaris (or whatever you're using to generate hoc from Imaris data)
nrngui uglyfile.hoc
(or double click on uglyfile.hoc if you're using MSWin).

Then start a CellBuilder
NEURON Main Menu / Build / Cell Builder
In the CellBuilder click on Management, then on the Management page click on Import / Top level
This pops up a window with a message and a button labeled "Go ahead and import". Click on that button.
The CellBuilder's canvas will be full of annoying names; they're not useful to you, so click on the checkbox next to "Turn off indexed name display"

Don't worry about the fact that the figure on the canvas looks like a bunch of sticks; that appearance is caused by a drawing shortcut that the CellBuilder uses. All of the anatomical details are still present.

Now click on the CellBuilder's Subsets button, and use the Select options to group related sections into subsets. It may help to bring up a Shape plot
NEURON Main Menu / Graph / Shape plot
and then click and drag to expand the size of the Shape plot so you can see more details. You might also want to zoom in on the shape plot--click on the menu box in its upper left corner, mouse over the primary menu to bring up the secondary menu, then drag the cursor over to select Zoom in/out. Finally, click on the canvas just to the right of what you want to zoom in on, and drag the cursor to the right (zoom back out by dragging to the left). You also might find it helpful to show diameters (menu box / Shape Style / Show Diam) or switch back to showing just the centroids (menu box / Show Diam / Centroid).

The radio buttons Select One and Select Subtree on the CellBuilder's Subsets page specify what happens when you click on a section. Each time you click on a section, you toggle the selection on or off. I've never used "Select Basaename" and have no idea what it does. Clicking on the "Select" button offers a menu of set operations that act on the current selection. Click on the Hints button to learn a bit more, and play with the tool for a bit, and you'll get the hang of it. Your goal is to group related sections into subsets (SectionLists) that have mnemonic names, such as axonal, somatic, apical, basilar (or just plain dendritic).

As you go along, be sure to save the CellBuilder to a session file every so often so you can recover if a problem occurs (shouldn't happen, but better safe than sorry).

After you're finished, be sure to save the fully configured CellBuilder to a session file. Then, and only then, you can export either a top level cell specification (Management / Export / Export to file) or a cell class definition (Management / Cell Type, then use Classname to specify the name of the cell class; it may be necessary to drag the lower margin of the CellBuilder down to expose the
Save hoc code in file
button).

When the time finally comes to specify the biophysical properties of the sections in each SectionList, just iterate over the contents of each SectionList and apply whatever assignments you require, e.g. if the sections in axonal are all supposed to have mechanisms called nafast and kfast, then these hoc statements (or their Python eqivalent) will do the job:

Code: Select all

forsec axonal {
  insert nafast
  insert kfast
}
sbrich
Posts: 29
Joined: Tue May 08, 2018 2:08 pm

Re: Utilizing morphology from IMARIS: help classifying "filaments" as basal/apical dendrites, etc

Post by sbrich »

Thank you for that detailed explanation Ted! I'll try working with CellBuilder as soon as I have the time and post if any questions/issues arise, as well as if/when I've successfully utilized the tool.
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Utilizing morphology from IMARIS: help classifying "filaments" as basal/apical dendrites, etc

Post by ted »

I forgot to mention that clicking on the "Select" button (above the radio button for Select One) brings up a list of operations that include
All (selects all sections)
None (selects no sections)
Xor (inverts the current selection)
Union (selection becomes the union of two subsets)
Intersection (selection becomes the intersection of two subsets)
Subtract (selection becomes the current selection minus a subset)

Play around with the tool a bit and its usage will become very obvious.
sbrich
Posts: 29
Joined: Tue May 08, 2018 2:08 pm

Re: Utilizing morphology from IMARIS: help classifying "filaments" as basal/apical dendrites, etc

Post by sbrich »

Thanks! I've so far been able to use those tools (including the various operations under Select, that helped a ton) to do pretty much everything I needed to. The only remaining issue is classifying the soma alone: I know that it is the [0] entry in the filament array, but unfortunately when I click on individual segments in CellBuilder I don't see a way of identifying what particular filament they are (like in the PointProcessManager, where I can click on a segment and see its name). The best I was able to do was first classify the axon and the apical dendrites since they were the easiest to differentiate, and then used the tools to select the remaining segments, which are the remaining (basilar) dendrites and the soma. I figure within my code when I'm dictating the biophysical properties I can prescribe the properties of the basilar dendrites for that section, and then "overwrite" them in the case of the soma.

Is there a way within CellBuilder that I'm missing to specifically select a segment by name, or should I proceed as I have things with the basilar dendrites and soma grouped together? Thanks again!
sbrich
Posts: 29
Joined: Tue May 08, 2018 2:08 pm

Re: Utilizing morphology from IMARIS: help classifying "filaments" as basal/apical dendrites, etc

Post by sbrich »

sbrich wrote: Wed Jul 18, 2018 2:47 pm Thanks! I've so far been able to use those tools (including the various operations under Select, that helped a ton) to do pretty much everything I needed to. The only remaining issue is classifying the soma alone: I know that it is the [0] entry in the filament array, but unfortunately when I click on individual segments in CellBuilder I don't see a way of identifying what particular filament they are (like in the PointProcessManager, where I can click on a segment and see its name). The best I was able to do was first classify the axon and the apical dendrites since they were the easiest to differentiate, and then used the tools to select the remaining segments, which are the remaining (basilar) dendrites and the soma. I figure within my code when I'm dictating the biophysical properties I can prescribe the properties of the basilar dendrites for that section, and then "overwrite" them in the case of the soma.

Is there a way within CellBuilder that I'm missing to specifically select a segment by name, or should I proceed as I have things with the basilar dendrites and soma grouped together? Thanks again!
Actually, now that I've exported the .hoc file and am looking at it, I think I may be able to do that manually within the file... since it includes the code

Code: Select all

  SomaAndBasilar = new SectionList()
    for i=0, 7 filament_100000042[i] SomaAndBasilar.append()
    for i=9, 13 filament_100000042[i] SomaAndBasilar.append()
    for i=15, 21 filament_100000042[i] SomaAndBasilar.append()
    for i=24, 32 filament_100000042[i] SomaAndBasilar.append()
    for i=37, 50 filament_100000042[i] SomaAndBasilar.append()
    for i=59, 76 filament_100000042[i] SomaAndBasilar.append()
    for i=85, 98 filament_100000042[i] SomaAndBasilar.append()
    for i=109, 116 filament_100000042[i] SomaAndBasilar.append()
    for i=123, 124 filament_100000042[i] SomaAndBasilar.append()
I can simply edit this so that it doesn't include i=0, and turnt hat into a new SectionList that is just the soma.

I think this will solve that last lingering issue... please let me know if my thinking has gone awry though!
ted
Site Admin
Posts: 6287
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Utilizing morphology from IMARIS: help classifying "filaments" as basal/apical dendrites, etc

Post by ted »

All those filaments make me think of filariasis--horrible family of parasitic diseases.

With regard to your question, often the "root section" of a morphometric reconstruction is just part of the soma, or it may not even be part of the soma at all. The best way to decide what is soma and what is not soma is probably to view the Shape plot with in "show diameter" mode (zoomed in as necessary to see the vicinity of the soma in detail). Then in the CellBuilder
Select / none
so that all sticks are black.
Finally zoom in on the CellBuilder's own canvas, click the "Select One" radio button, and click on sections that look like they belong to the soma one at a time while holding the keyboard's Control key down. Finally, click on
New SectionList
and call the new list "somatic".

Alternatively you could
Select / none
then click on the "Select Subtree" radio button,
then zoom in on the CellBuilder's own canvas and click on the root section (proximal end) of each subtree that attaches to the soma while holding down the Control key. Finally, click on
Select / Xor
and the soma sections will all be highlighted so you can then click on "New SectionList" etc..
Post Reply