Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

biophysical models: convert .json parameters to .hoc #107

Closed
caparvulus opened this issue Jan 2, 2018 · 8 comments
Closed

biophysical models: convert .json parameters to .hoc #107

caparvulus opened this issue Jan 2, 2018 · 8 comments

Comments

@caparvulus
Copy link

caparvulus commented Jan 2, 2018

Is there any way to convert .json parameters to .hoc files? Do I have to rewrite the code loading parameters to generate the .hoc file? And how can I make sure my code is faithful in respect of parameters?

@caparvulus caparvulus changed the title convert .json parameters to .hoc biophysical models: convert .json parameters to .hoc Jan 2, 2018
@dyf
Copy link
Contributor

dyf commented Feb 1, 2018

Hi @caparvulus -- there's no way to convert our .json files to .hoc files. You can see in this file how we use NEURON to initialize the model:

https://github.com/AllenInstitute/AllenSDK/blob/master/allensdk/model/biophysical/utils.py

Can I ask why you're trying to perform this conversion?

@caparvulus
Copy link
Author

caparvulus commented Feb 1, 2018

Hi @dyf , thank you for your reply. Because I want to simulate LFPs with these biophysical models with some opensource modules like LFPy: https://github.com/LFPy. Most of these modules ask for .hoc files to work. I have tried to write a conversion but I hardly have ways to tell if my code is faithful with respect to the original parameters. I mostly copied and pasted the code from AllenSDK for initializing the model (creating the h object) and output these codes as a hoc script, but I still can' figure out a way to check if my conversion is really correct, and unfortunately for some models my .hoc converted doesn't even work (syntax errors when loaded).

@kaeldai
Copy link
Contributor

kaeldai commented Feb 2, 2018

Hi @caparvulus - Unfortunately at the moment we don't have tools for conversion from our json files to hoc and other formats, although there are plan to in the future.

However, if you want to simulate LFP using our Cell Types .json parameters files we do have a tool for that. Our BioNet simulator (part of the Brain Modeling Toolkit) will load in .json parameters files, run a simulation and record the LFP on a simulated MEA. We have examples for simulating LFP on one cell:
https://github.com/AllenInstitute/bmtk/tree/develop/docs/examples/simulator/bionet/1cell_all_active

or on a multi-cell network:
https://github.com/AllenInstitute/bmtk/tree/develop/docs/examples/simulator/bionet/14cells_ecp

@caparvulus
Copy link
Author

Hi @kaeldai - Thank you so much for your information. However, after I checked the BioNet simulator, it looks like it does not use any morphology information from the original model but just treats each neuron as a point source. Is there any way to record LFPs at different locations based on the morphology information (more biophysically realistic)?

@kaeldai
Copy link
Contributor

kaeldai commented Feb 3, 2018

Hi @caparvulus - BioNet will use the cell's morphology to calculate the LFP. Basically, it uses the distance from the center of each NEURON segment to the electrode to find a resistance coefficient for each segment in the cell. Then at each step during the simulation it takes the sum of seg-resistance * seg-potential for every segment to find LFP at a given electrode.

When you run a simulation you can specify the location of the electrodes using a csv file. For the location of the cell(s) you can specify the x,y,z coordinates of the soma, plus optional rotational angles, in the nodes file. We use swc files to build the morphology of each cell, then translate and rotate into the correct position. From what I recall LFPy uses the absolute morphology built into hoc files.

@dyf
Copy link
Contributor

dyf commented Feb 15, 2018

Do you want to move this conversation to BMTK? I will close if so.

@kaeldai
Copy link
Contributor

kaeldai commented Feb 15, 2018

You can go ahead and close this.

@dyf dyf closed this as completed Feb 15, 2018
@caparvulus
Copy link
Author

@kaeldai I actually have some questions about BioNet, because it does not seem to work at all. In fact, the examples you showed me as "1cell_all_active" would not work at all. there is no file called "318331342_fit.json", and also even if I changed to some existing file, it would still give me error TypeError: init() got multiple values for keyword argument 'network'
at line 24: sim = Simulation(conf, network=net) # initialize a simulation

do you have any other alternative way to do the task we discussed before?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants