AllenInstitute / bmtk

Brain Modeling Toolkit
https://alleninstitute.github.io/bmtk/
BSD 3-Clause "New" or "Revised" License
265 stars 86 forks source link

Extracting synapses placement along depth axis #344

Open nicolomeneghetti opened 8 months ago

nicolomeneghetti commented 8 months ago

Dear all,

hope this issue finds you all well.

I've been experimenting with extracting the synaptic placement along the morphology of a neuron, following the guidelines outlined in your workshop (https://github.com/AllenInstitute/bmtk-workshop/blob/main/Ch2_single_cell/2.%20Single%20Cell.ipynb).

I've observed some results that seem odd (at least to me).

I've built a network composed of a single pyramidal neuron:


`scnn1a = NetworkBuilder('cell')

scnn1a.add_nodes(

required

        N=1,
        model_type='biophysical',
        model_template='ctdb:Biophys1.hoc',
        model_processing='aibs_perisomatic',
        dynamics_params='471819401_fit.json',
        morphology='Ntsr1-Cre_Ai14-181184.02.02.01_491771181_m.swc',
        rotation_angle_xaxis=0.0,
        rotation_angle_yaxis=0.0,
        rotation_angle_zaxis=-3.847567702,
        x=0.0,
        y=0.0,
        z=0.0

)

scnn1a.build() scnn1a.save(output_dir='network') `


This neuron receives excitatory inputs in the apical dendrites from an external neuronal family:

`virt_exc = NetworkBuilder('virt_exc')

virt_exc.add_nodes( N=200, model_type='virtual', ei_type='exc' ) conns = virt_exc.add_edges( source=virt_exc.nodes(), target=scnn1a.nodes(), connection_rule=12, model_template='Exp2Syn', dynamics_params='AMPA_ExcToExc.json', delay=2.0, syn_weight=0.01 ) conns.add_properties( ['afferent_section_id', 'afferent_section_pos', 'afferent_swc_id', 'afferent_swc_pos', 'coord_x', 'coord_y', 'coord_z'], rule=rand_syn_locations, rule_params={ 'sections': ['apical'], 'distance_range': [0.0, 1.0e20], 'morphology_dir': 'components/morphologies', 'dL': 1.0, ‘return_coords':True }, dtypes=[int, float, int, float, float, float, float] ) virt_exc.build() virt_exc.save(output_dir='network')`


I attempted to modify the distance_range for synaptic placement, gradually moving the lower limit further away from the soma of the pyramidal neuron.

Consequently, I have attempted to access the distribution of synapses along the depth axis, which runs parallel to the main axis of the neuron's morphology or, equivalently, the axis orthogonal to the pia.

In order to do so, I just accessed the 3 coord variables saved in the h5 file edge file:

h5file = h5py.File('./network/virt_exc_cell_edges.h5', "r")

coord_x = h5file['edges']['virt_exc_to_cell']['0']['coord_x'][:] coord_y = h5file['edges']['virt_exc_to_cell']['0']['coord_y'][:] coord_z = h5file['edges']['virt_exc_to_cell']['0']['coord_z'][:]

However, I have observed an unexpected result. It seems that the synaptic placement along the depth axis is more accurately represented by the coord_x values, whereas I anticipated a better correlation with the coord_y values (see the images below).

Am I overlooking something?

nicolomeneghetti commented 7 months ago

‘sections': ['apical'], 'distance_range': [0.0, 1.0e20],

distance_range_0


‘sections': ['apical'], 'distance_range': [50.0, 1.0e20],

distance_range_50


‘sections': ['apical'], 'distance_range': [100.0, 1.0e20],

distance_range_100


‘sections': ['apical'], 'distance_range': [150.0, 1.0e20],

distance_range_150


‘sections': ['apical'], 'distance_range': [200.0, 1.0e20],

distance_range_200


‘sections': ['apical'], 'distance_range': [300.0, 1.0e20],

distance_range_300


‘sections': ['apical'], 'distance_range': [400.0, 1.0e20], distance_range_400

nicolomeneghetti commented 7 months ago

I've also tried changing the morphology for the very same task. This time I've used a layer23 excitatory neuron. Specifically I've used the same code as reported above. I've just changed the following: 1) morphology='Cux2-CreERT2_Ai14-211772.05.02.01_496085150_m.swc', 2) rotation_angle_zaxis=-2.7288499560000004

Here follows the same plots as above, but for this pyramidal neuron.


‘sections': ['apical'], 'distance_range': [0.0, 1.0e20],

23_distance_range_0


‘sections': ['apical'], 'distance_range': [50.0, 1.0e20], 23_distance_range_50


‘sections': ['apical'], 'distance_range': [100.0, 1.0e20],

23_distance_range_100


‘sections': ['apical'], 'distance_range': [200.0, 1.0e20], 23_distance_range_200


‘sections': ['apical'], 'distance_range': [300.0, 1.0e20],

23_distance_range_300


Even in this case, the values of coord_x seem to better capture the depth profile distrbution of the synapses: this time, however, they take negative values for some reason.

Any help would be truly appreciated.

Thanks in advance,

Nicolò Meneghetti