You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2025. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 26, 2025. It is now read-only.
Persistence diagram failed/empty list for some neurons #60
I'm using this TMD method for SWC file classification for basal dendrites, it yields pretty good results. But for some SWCs, when using get_ph_neuron(), some neurons failed with an error "key error", and some neurons have nothing in the persistence diagram list. Could you please shed some light on what's causing the issue?
I've figured out the 0-length issue (some neurites are stored as type=0 in the SWCs so they are not read correctly when I specify dendrite_type = 'basal_dendrite'), so we're good with that. But unfortunately there are still some files that have "key error" issue.
Please see the attached example. I converted it to .txt format since .swc is not supported by Github, you may need to change it back.
By looking into this example, the get_ph_neuron() method first get a dictionary called ‘parents’, which is a dictionary of {children:parent} pairs, and use birth and death time to get the p-diagram, after the first round of iteration over the active nodes, a parent node is added to the active list, which is not a key in the ‘parents’ dictionary, thus throw the key error.
For example, for the 5th dendrite:
The parent dictionary of the 5th dendrite extracted is: {1: 0, 4: 1, 10: 4, 33: 10, 92: 10, 131: 4, 139: 1, 195: 139, 202: 140}
The active nodes in the first iteration are: [33, 92, 131, 195, 202], they all have keys in the parent dictionary
The active nodes in the second iteration are: [4, 139, 140], while 140 is not a key in the parent dictionary, which creates the error
Please let me know if you have any thoughts on this. Thank you very much!
Activity
eleftherioszisis commentedon Oct 11, 2022
Hi and thanks for opening an issue. Could you please provide an SWC file example to reproduce the error?
yanyanming77 commentedon Oct 14, 2022
Hi:
Thanks for the response!
I've figured out the 0-length issue (some neurites are stored as type=0 in the SWCs so they are not read correctly when I specify dendrite_type = 'basal_dendrite'), so we're good with that. But unfortunately there are still some files that have "key error" issue.
Please see the attached example. I converted it to .txt format since .swc is not supported by Github, you may need to change it back.
By looking into this example, the get_ph_neuron() method first get a dictionary called ‘parents’, which is a dictionary of {children:parent} pairs, and use birth and death time to get the p-diagram, after the first round of iteration over the active nodes, a parent node is added to the active list, which is not a key in the ‘parents’ dictionary, thus throw the key error.
For example, for the 5th dendrite:
Please let me know if you have any thoughts on this. Thank you very much!
Best,
Ming
example_swc_failed_getPH_neuron.txt
lidakanari commentedon Oct 19, 2022
Hi Ming,
Thanks for reporting this issue.
I checked your data and I see where it breaks. It looks like one of the sections connects to the wrong place.
I suggest that you use the following way to load your files and I will check again later what goes wrong in the main loader.
neuron = tmd.io.load_neuron_from_morphio('example_swc_failed_getPH_neuron.swc')This extracts the persistence diagrams correctly