navis-org / pymaid

Python library to interface with CATMAID servers. Fully interoperable with navis.
https://pymaid.readthedocs.io/en/latest/
GNU General Public License v3.0
23 stars 11 forks source link

pymaid.cluster_xyz #192

Open ArefZarin opened 5 years ago

ArefZarin commented 5 years ago

Screen Shot 2019-08-12 at 3 40 58 PM Hi Philip, Could you please explain the 0-80000 scale on the Y-axis? Also, how can I change the code to incorporate the skids (ideally neuron names) next to the dendrogram? Currently, I can not tell where a given neuron located in the dendrogram. Thanks Aref

schlegelp commented 5 years ago

pymaid.cluster_xyz is a thin wrapper for scipy.scipy.spatial.distance and simply returns a ClustResult object holding the euclidian distance between the x/y/z points you passed to the function.

In your example code, you are using the combined connector table of all your neurons as input (n.connectors). The function is smart enough to extract the x/y/z coordinates from the table but it doesn't respect the origin of the connectors (or whether they are pre or post for that matter). Instead it treats them as one giant cloud of points and calculates the Euclidian distance between all pairs of points. So the 0-80,000 scale is the distance in nanometers and the connectors seem to cluster in two spatially separate locations (axon/dendrite?).

pymaid.cluster_xyz is a very basic function and was never really meant to be used with multiple neurons (notice that the docstring example uses a single neuron). I'll update the docstring to better reflect that.

Does that answer your question? If you let me know what it is that you are after, I'm happy to provide more pointers.

ArefZarin commented 5 years ago

Thanks for your detailed response! The annotation (ZarinMNs) calls 29 MN pairs (58 total) reconstructed in left and right A1 segments. Overall, each pair is morphologically distinct than the other, but some pairs are somehow similar. Also, obviously, the left and right counterparts of the same MN type are morphologically very similar. I was curious to see if pymaid.cluster_xyz is capable of parsing out MN pairs from one another, by grouping left and right counterparts together and distinguishing different pairs from one another. These MNs contain dendritic arbors as well as truncated axons. The axon terminals exit the CNS and form NMJ onto muscles, so they are not part of CATMAID reconstructions.