Loading a morphology as a hoc file
Loading a morphology as a hoc file
Hi Ted
I am trying to load a morphology as a hoc file in GUI instead of using the import3d<cell builder tool (because i don't have the swc file).
When I do this, I don't get something similar to the cell builder tool. I double checked that using the model view option.
Can you point where I am going wrong.
Thanks
I am trying to load a morphology as a hoc file in GUI instead of using the import3d<cell builder tool (because i don't have the swc file).
When I do this, I don't get something similar to the cell builder tool. I double checked that using the model view option.
Can you point where I am going wrong.
Thanks
-
- Posts: 270
- Joined: Fri Nov 28, 2008 3:38 pm
- Location: Yale School of Public Health
Re: Loading a morphology as a hoc file
Can you expand your comment? What do you get and how is it different from what you expected?
If there's a HOC file morphology, you can load it from the GUI or from e.g. `h.load_file("my_morphology.hoc")`
If there's a HOC file morphology, you can load it from the GUI or from e.g. `h.load_file("my_morphology.hoc")`
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Loading a morphology as a hoc file
I think I understand this up to the word "file." Specifically, you're saying that you have a hoc file that contains statements that will create and connect sections and assign the correct length and diameter properties to them.I am trying to load a morphology as a hoc file in GUI
I'm guessing that by saying you're doing this "in GUI" that maybe you're using the NEURON Main Menu toolbar's "File / load hoc" to make NEURON read your "morphology hoc file."
If the "morphology hoc file" contains only statements that create sections, connect them, and assign diameters and lengths to them, you won't see a CellBuilder because the file didn't contain any statement that creates a CellBuilder.When I do this, I don't get something similar to the cell builder tool.
Model View, shmodel View. Just bring up a Shape plot (NEURON Main Menu / Graph / Shape plot). Do you get a box that tells you No accessed section: Can't start a PlotShape or do you get a graph window that shows a line drawing of a model cell?I double checked that using the model view option.
-
- Posts: 270
- Joined: Fri Nov 28, 2008 3:38 pm
- Location: Yale School of Public Health
Re: Loading a morphology as a hoc file
If you want to create a CellBuilder from a HOC morphology, you can load the HOC morphology, then open a CellBuilder, click the Management tab, then Import - top level. Confirm by clicking "go ahead and import" and then you can work with it in the CellBuilder.
Re: Loading a morphology as a hoc file
Thanks for your prompt responses.
What I tried to do-
1) Double click and load the hoc file. It did not bring up the morphology, and I got this when i tried bringing the shape plot
This I got in the command prompt
2) I tried loading through python
3 GUI, File>Load hoc option, that didn't work either.
I suspect there is a problem becasue the hoc file is linked to mod files, or there is some problem with anaconda.
All the mod files used are present in the same folder and compiled.
Another Question:
Is there a way to convert a hoc file to swc format?
I am expecting to load the morphology (similar to loading a swc file), check different parameters to make sure I can use it for my simulations.What do you get and how is it different from what you expected?
What I tried to do-
1) Double click and load the hoc file. It did not bring up the morphology, and I got this when i tried bringing the shape plot
No accessed section: Can't start a PlotShape
This I got in the command prompt
Code: Select all
NEURON -- VERSION 7.8.1 release/7.8.1 (47cd8c85) 2020-07-18
Duke, Yale, and the BlueBrain Project -- Copyright 1984-2019
See http://neuron.yale.edu/neuron/credits
loading membrane mechanisms from C:\Users\Jackie.MEDICINE\Desktop\NEURON\project
\previous_models\Piriform-master\nrnmech.dll
Additional mechanisms from files
GABA.mod HHstshort.mod glutamate.mod glutamate_ves.mod
Could not open C:/Users/Jackie.MEDICINE/AppData/Roaming/Microsoft/Windows/Start
Menu/Programs/Anaconda3 (64-bit)/Anaconda Prompt.lnk
Could not open C:/Users/Jackie.MEDICINE/AppData/Roaming/Microsoft/Windows/Start
Menu/Programs/Anaconda3 (64-bit)/Anaconda Prompt.lnk
Cannot find executable python3 or python
failed: C:\nrn\mingw\usr\bin\bash C:/nrn/bin/nrnpyenv.sh --NEURON_HOME=C:/nrn
oc>
Code: Select all
h.load_file(r"C:\Users\Jackie.MEDICINE\Desktop\NEURON\project\previous_models\Piriform-master\piri30_09_17.hoc")
NEURON: Can't open C:UsersJackie.MEDICINEDesktopNEURONprojectprevious_modelsPiriform-masterpiri30_09_17.hoc
near line 1
{xopen("C:UsersJackie.MEDICINEDesktopNEURONprojectprevious_modelsPiriform-masterpiri30_09_17.hoc")}
^
xopen("C:UsersJac...")
execute1("{xopen("C:...")
load_file("C:\Users\J...")
0.0
3 GUI, File>Load hoc option, that didn't work either.
When I use this it only shows me a soma in the plot.Confirm by clicking "go ahead and import" and then you can work with it in the CellBuilder.
I suspect there is a problem becasue the hoc file is linked to mod files, or there is some problem with anaconda.
All the mod files used are present in the same folder and compiled.
Another Question:
Is there a way to convert a hoc file to swc format?
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Loading a morphology as a hoc file
The mod files have nothing to do with the problems you're having.
begintemplate Foo
where Foo is a single string of characters not including punctuation (might or might not be capitalized)?
This means you won't be able to use Python as an interpreter. A totally separate problem from the one that led you to start this thread. For the sake of clarity, we won't address this in this thread.Could not open C:/Users/Jackie.MEDICINE/AppData/Roaming/Microsoft/Windows/Start
Menu/Programs/Anaconda3 (64-bit)/Anaconda Prompt.lnk
Could not open C:/Users/Jackie.MEDICINE/AppData/Roaming/Microsoft/Windows/Start
Menu/Programs/Anaconda3 (64-bit)/Anaconda Prompt.lnk
Cannot find executable python3 or python
This means the hoc file contains no "top level" statements (statements outside of a "template", i.e. class definition) that create sections. Time to examine the hoc file. Does it contain a statment of the formNo accessed section: Can't start a PlotShape
begintemplate Foo
where Foo is a single string of characters not including punctuation (might or might not be capitalized)?
Re: Loading a morphology as a hoc file
Yes.Does it contain a statment of the form
begintemplate Foo
Following are the starting statements
begintemplate celltemplate
public soma,dend,all,dends,basal,apcounter,apvec,nil,LOTlist,CClist,FocalList,Vvec,numdend,primedends//,FocalDends,NumberActiveDends
objref all,dends,basal,apcounter,apvec,nil,LOTlist,CClist,Vvec[2]
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Loading a morphology as a hoc file
Everything between
begintemplate celltemplate
and
endtemplate celltemplate
defines a class. If those statements include one or more "create" statements and "connect" statements, it's a cell class. If that's the case, what you have is a hoc file that defines a cell class but doesn't create any instance of that class.
If you want to create a model cell that is based on this class definition, just executeand presto! you'll have a model cell whose sections are called foo.soma etc. (assuming one of the create statements is
create soma
).
begintemplate celltemplate
and
endtemplate celltemplate
defines a class. If those statements include one or more "create" statements and "connect" statements, it's a cell class. If that's the case, what you have is a hoc file that defines a cell class but doesn't create any instance of that class.
If you want to create a model cell that is based on this class definition, just execute
Code: Select all
objref foo // or whatever you want to call the instance
foo = new celltemplate()
create soma
).
Re: Loading a morphology as a hoc file
Amazing. Thanks!
-
- Site Admin
- Posts: 6384
- Joined: Wed May 18, 2005 4:50 pm
- Location: Yale University School of Medicine
- Contact:
Re: Loading a morphology as a hoc file
A nice consequence of defining a cell class: you can use it to make as many instances as you like. Each instance will have its own name, membrane potentials, ionic currents, etc.. Very useful for modeling networks. Example:
objref pyrlist
pyrlist = new List()
for i = 0,9 pyrlist.append(new Pyr()) // assuming Pyr is the name of a cell class
print pyrlist.o(3).soma.v(0.5) // assuming the section called soma is a public member of Pyr
objref pyrlist
pyrlist = new List()
for i = 0,9 pyrlist.append(new Pyr()) // assuming Pyr is the name of a cell class
print pyrlist.o(3).soma.v(0.5) // assuming the section called soma is a public member of Pyr