NeuroML / NeuroML2

This repository hosts the NeuroML 2 Schema, the ComponentType definitions in LEMS and the core documentation of NeuroML2.
https://docs.neuroml.org
GNU Lesser General Public License v3.0
51 stars 24 forks source link

Add synapse centred network description #18

Open pgleeson opened 11 years ago

pgleeson commented 11 years ago

As opposed to just an instance based network description:

network
    cell type 1
        cell morphology
            segment 1
            ...
    cell type 2
        cell morphology 
            segment 1
            ...
    population 1  (cell type 1; size = n)
    population 2  (cell type 2; size = m)
    projection  (pop 1 -> pop2)
        connection 1 (cell #1, seg 3 -> cell #2, seg 6) 
        connection 2 (cell #3, seg 2 -> cell #6, seg 1)
        ...

specification of the synapses at cell level should also be supported:

network
    cell type 1
        cell morphology
            segment 1
            ...
        synapse list
            synapse 1 (seg 10, fract 0.5, direction pre)    
            synapse 2 (seg 4, fract 0.2, direction post)
    cell type 2
        cell morphology 
        ...
        synapse list
        ...
    population 1  (cell type 1; size = 1)
    population 2  (cell type 2; size = 1)
    projection  (pop 1 -> pop2)
        connection 1 (syn 1 -> syn 3)   
        connection 2 (syn 7 -> syn 5)
        ...

This will allow greater portability of the (cell & its synapses) and will allow neuronal reconstruction applications to export cell descriptions together with synapse locations (without requiring another post/pre cell).

pgleeson commented 7 years ago

@russelljjarvis will have a look at this.

Some suggestions for tool support after this is completed:

russelljjarvis commented 7 years ago

Hi Padraig,

So to test out what my changes do. I should down load neural connectivity data from the neocortical micro circuit. https://bbp.epfl.ch/nmc-portal/downloads

I noticed in the portal a link to: https://github.com/OpenSourceBrain/BlueBrainProjectShowcase/blob/master/NMC/NeuroML2/README.md

I will play around with your code in OSB, in order to try to get orientated.

pgleeson commented 7 years ago

Sounds good @russelljjarvis. I hadn't realised they had added the json files there with the connectivity/synaptic properties.

pgleeson commented 7 years ago

@russelljjarvis While the BBP cells/connectivity is useful to aim at, the files involved will be quite large and it will be difficult to visually check correct export. 2 more modest multicompartmental connected network examples are at:

https://github.com/NeuroML/NeuroML2/blob/master/examples/NML2_MultiCompCellNetwork.nml

https://github.com/OpenSourceBrain/ACnet2/blob/master/neuroConstruct/generatedNeuroML2/MediumNet.net.nml

With these, especially the first, you should be able to see where the synapses are be located on the cells and make sure the cell centred net version is the same as the connection centred version.

You can see connection lines with pyNeuroML:

 pynml-povray NML2_MultiCompCellNetwork.nml -scalez 15 -conns -conn_points
 povray NML2_MultiCompCellNetwork.pov

nml2_multicompcellnetwork

 pynml-povray MediumNet.net.nml  -scalez 7 -conns -conn_points
 povray MediumNet.net.pov

mediumnet net

russelljjarvis commented 7 years ago

Okay I had to do a few python3 related fixes as python3 does not support: .has_key

So for example I replaced:

if pop_id_vs_cell.has_key(projection.presynaptic_population):

with:

if projection.presynaptic_population in pop_id_vs_cell.keys():

However after I have made these substitutions. Povray loads briefly flashes the connectivity geometry on the screen, and then quits. I am currently reading about where to retrieve the saved image from, or alternatively a command that keeps povray open instead of quiting.

Okay I just read that the flag +F achieves this for example povray +F NML2_MultiCompCellNetwork.pov

However I think either I broke the code, or I need to find a way to make povray zoom out such that it has a view of the more of the multicompartment network geometry.

povray

pgleeson commented 7 years ago

@russelljjarvis thanks for the suggestion re python 3. I've made these changes and added a test for pynml-povray, see commit above.

Re changing the image, try:

 pynml-povray -h

for a list of options. -scalez 5 will pull the camera back 5x from the bounding box around the cell in the z direction. There is also -viewx etc. to move the point the camera looks at. I generally use -movie, and this produces a set of images which orbit around the cell/network, though you'll generally have to pull back from it first with -scalez. Also, I usually generate the image file(s) with povray and look at them afterwards in an external image preview program.

russelljjarvis commented 7 years ago

Hi Padriag, This is great, I git cloned the repository into the Dockerfile I am working with, and your python3 fixes are working well now. image

I didn't realize that you could run povray on the .pov file in order to generate .png files.

povray Antialias=On Antialias_Depth=10 Antialias_Threshold=0.1 +W1200 +H900 -movie NML2_MultiCompCellNetwork.nml.pov