Page 1 of 1

Recreating JUST the morphology from an available model (that is coded in an unfamiliar way)

Posted: Fri May 03, 2019 10:46 am
by sbrich
Hello NEURON forums,

My continuing work on a detailed multi-compartment neuron model (that I've already posted quite a few questions on these forums regarding, haha) is nearing it's conclusion! We have a model that we're very happy with up and running, and we're now doing some in silico experiments on it to investigate it's properties before we publish it (where, of course, we will cite NEURON quite heavily!).

Part of this exploration led us to this paper by Kalmbach et. al. in Neuron: ... 18)30900-0
This paper has some interesting insights into the relationship between the h-current and theta resonance that we are investigating in our model, and as such we want to do some comparisons between our model and theirs. Of primary interest relative to the post here is the following: I'd like to test whether different morphologies affect this behavior by directly implementing our neuron model (parameters, ion channels, conductances, etc.) but with the Kalmbach morphology as opposed to the morphology of our neuron.

Doing so does not appear to be as straightforward as I would've hoped, however, primarily because the code used to create the Kalmbach model (found here: ... physiology) is quite different than what we're using in our model. In particular, it appears that the Kalmbach model makes heavy use of Python to execute their code, and unfortunately I am not a Python user (yes, I know, learning Python is amongst my long academic to-do list, haha). As such, it's become quite difficult for me to parse their code to see how the cell is actually built.

However after banging my head against things for a while, I believe I finally found what amounts to the "morphology" file, which is entitled 478230220.swc. However, this file is formatted quite differently from what I use in my model. Just as an example, here are the first few lines of the .swc file:

Code: Select all

# generated by Vaa3D Plugin sort_neuron_swc
# source file(s): E:/478230220/reconstruction - 478230220/478230220/man2.01_478230220_m_dendrite.swc
# id,type,x,y,z,r,pid
1 1 391.996 1096.83 24.36 10.95 -1
2 2 390.074 1106.29 23.419 0.56 1
3 2 389.833 1107.41 23.397 0.117 2
4 2 389.559 1108.52 23.451 0.114 3
5 2 389.261 1109.62 23.54 0.114 4
and here is the beginning of the code I use to define my morphology (note that a lot of the morphological reconstruction was "handed off" to me at the beginning of this project, and thus I'm not entirely sure how this was made, although I believe it used the IMARIS program):

Code: Select all

proc celldef() {

create filament_100000042[211]

proc topol() { local i
  for i = 1, 2 connect filament_100000042[i](0), filament_100000042(1)
  for i = 3, 4 connect filament_100000042[i](0), filament_100000042[1](1)
proc shape3d_1() {
  filament_100000042 {pt3dclear()
	pt3dadd(552.703, 988.659, 129.291, 4.79842)
	pt3dadd(552.615, 988.24, 128.971, 5.52792)
  filament_100000042[1] {pt3dclear()
	pt3dadd(552.615, 988.24, 128.971, 5.52792)
	pt3dadd(552.601, 987.718, 128.617, 6.05773)
Now, I have basic "biophys()" procs set up to distribute my ion channels, conductances, etc. into the various compartments based upon their soma, basilar dendrite, apical dendrite, axon labels (thanks to a lot of help from Ted!). Ideally I'd like to be able to just load the Kalmbach morphology and then run my biophys() proc to instantiate my model onto that morphology, but it's clear that this won't be that straightforward since I'm unfamiliar with how that model is creating the morphology. So, I guess here are my summary questions:
  1. Does the .swc file I highlighted here encapsulate the entire Kalmbach morphology, or is there something else I'm missing? I have a sense that there might be a secondary file that "labels" the various compartments, but I was unable to find it... the Github repository seems more geared towards people who simply want to "run" the code as is, with slight perturbations to the inputs, rather than get into the "guts" of the code, making this a challenge, exacerbated by my lack of Python knowledge.
  2. Once I have all the aspects of the code that makes up the Kalmbach model's morphology, how would I go about "loading" the neuron morphology as defined here, as opposed to the way I have things in my current model?
  3. Once I'm able to "load" Kalmbach's morphology, as long as the compartments are labeled similarly to how I did it, will putting my model "into" that morphology be as simple as running my biophys() proc?
Any help would be greatly appreciated here... as I mentioned this is one of the final parts of the "story" we're crafting for the paper presenting this model, and this exploration of the way our model and the Kalmbach model interact and play off of each other could potentially be the "capstone" that turns this into a high impact paper!

Thanks for reading through this long, detailed post... hopefully I included everything necessary for this question.

P.S. I understand there's a possibility that this question might be one that the authors of the paper may be better suited to answer if it goes a bit beyond simple coding issues. If that's the case please feel free to let me know and I can proceed along that path!

Re: Recreating JUST the morphology from an available model (that is coded in an unfamiliar way)

Posted: Sun May 05, 2019 3:28 pm
by ted
The file in question is an ordinary SWC morphology file that can be easily converted to a NEURON model specification with the Import3d tool. The result of that conversion will be a model cell in which each section corresponds directly to an unbranched neurite in the original biological cell, all sections have short and meaningful names (soma, axon, dend etc.), and sections are grouped into anatomically sensible subsets. What you have instead are lots of very short sections (one section for each adjacent pair of 3d data points! far more differential equations than needed for spatial accuracy!) that have strange, unwieldy section names, and no subsets--it's going to be very cumbersome to work with, and simulations will be far slower than necessary. For tutorials on how to use the Import3d tool, see the Documentation page

Re: Recreating JUST the morphology from an available model (that is coded in an unfamiliar way)

Posted: Mon May 06, 2019 10:06 am
by sbrich
Thank you very much Ted! My apologies for the confusion on what ended up being a somewhat trivial question: as I alluded to, the morphology was the one part of this project that I was not directly involved with, as it was done before I joined my lab. Unfortunately the former lab member who was in charge of that is now literally on the other side of the world, haha, so getting into the nuts and bolts of how the morphology was reconstructed, and potentially optimizing it, was put on the back burner, although with your comments in mind I'll reach out and see if it's possible to potentially improve that aspect of our model.

Now that I know recreating the .swc morphology is fairly straightforward, I will do that in the next day or two and post a follow up if I run into any roadblocks. As I mentioned I'm excited about the insights utilizing this morphology might be able to provide us in our work, so I'll be working with this in the very near future and keep you up to date!

Re: Recreating JUST the morphology from an available model (that is coded in an unfamiliar way)

Posted: Tue May 07, 2019 4:21 pm
by sbrich
Everything worked perfectly... thanks for the help Ted, and my apologies again for overlooking what was a very straightforward solution!