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

Unsupported section type: 0 #1110

Open
superwhat1 opened this issue Mar 29, 2024 · 4 comments
Open

Unsupported section type: 0 #1110

superwhat1 opened this issue Mar 29, 2024 · 4 comments

Comments

@superwhat1
Copy link

When I attempt to open a swc file from neuromorpho.org with the NEURON standard.
this is what the file looks like.
image

import neurom as nm

m = nm.load_morphology("C:\Users\David\Documents\NeuroComp\project\Soma_in_tectum_653519\3_mod_T_160621_F2M2_loom_02.swc")

Traceback (most recent call last):

File ~\anaconda3\envs\neurom\lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
exec(code, globals, locals)

File c:\users\david\documents\neurocomp\project\morphology_function_clustering_project.py:10
m = nm.load_morphology("C:\Users\David\Documents\NeuroComp\project\Soma_in_tectum_653519\3_mod_T_160621_F2M2_loom_02.swc")

File ~\anaconda3\envs\neurom\lib\site-packages\neurom\io\utils.py:165 in load_morphology
return Morphology(morph, Path(morph).name)

File ~\anaconda3\envs\neurom\lib\site-packages\neurom\core\morphology.py:435 in init
super().init(filename)

RawDataError:
C:\Users\David\Documents\NeuroComp\project\Soma_in_tectum_653519\3_mod_T_160621_F2M2_loom_02.swc:2:error
Unsupported section type: 0

@eleftherioszisis
Copy link
Contributor

To reproduce the error, could you please attach or provide a link to the morphology? Thanks.

@xiuliren
Copy link

xiuliren commented Jul 26, 2024

I got the same error for several swc files.

File ~/anaconda3/envs/napari/lib/python3.11/site-packages/neurom/io/utils.py:172, in load_morphology(morph, reader, mutable, process_subtrees)
    [170](https://file+.vscode-resource.vscode-cdn.net/Users/jingpengw/projects/63_high-content-screening/~/anaconda3/envs/napari/lib/python3.11/site-packages/neurom/io/utils.py:170)     filepath = _get_file(morph, reader) if reader else morph
    [171](https://file+.vscode-resource.vscode-cdn.net/Users/jingpengw/projects/63_high-content-screening/~/anaconda3/envs/napari/lib/python3.11/site-packages/neurom/io/utils.py:171)     name = os.path.basename(filepath)
--> [172](https://file+.vscode-resource.vscode-cdn.net/Users/jingpengw/projects/63_high-content-screening/~/anaconda3/envs/napari/lib/python3.11/site-packages/neurom/io/utils.py:172)     morphio_morph = morphio.Morphology(filepath)
    [174](https://file+.vscode-resource.vscode-cdn.net/Users/jingpengw/projects/63_high-content-screening/~/anaconda3/envs/napari/lib/python3.11/site-packages/neurom/io/utils.py:174) # None does not modify existing mutability
    [175](https://file+.vscode-resource.vscode-cdn.net/Users/jingpengw/projects/63_high-content-screening/~/anaconda3/envs/napari/lib/python3.11/site-packages/neurom/io/utils.py:175) if mutable is not None:

RawDataError: 
46.swc:16:error

Unsupported section type: 0

I have attached a file.
3.swc.zip

@xiuliren
Copy link

xiuliren commented Jul 29, 2024

I downloaded the example swc file and tested. It also has this error since the node type could be 0.

fname = os.path.expanduser('~/Downloads/undefined_type.swc')
nm.io.utils.load_morphology(fname)

It looks like this behavior is expected...

def test_undefined_type():

I changed my undefined type from 0 to 4, and it works.

@eleftherioszisis
Copy link
Contributor

eleftherioszisis commented Jul 29, 2024

Thank you @xiuliren for the detailed example, which allowed me to reproduce the error with the following minimal example extracted from your data:

from morphio import Morphology
m = Morphology(
"""
1 1 0.000000 1317316.000000 0.000000 188.000000 -1
2 0 188.000000 1317504.000000 0.000000 188.000000 1
3 0 188.000000 1317692.000000 0.000000 188.000000 2
"""
, "swc")

MorphIO SWC reader explicitly checks for "0" point type and raises if present:
https://github.com/BlueBrain/MorphIO/blob/e58dd9965e6d7de4c75eb091346dbea15b61a2bc/src/readers/morphologySWC.cpp#L136

Concerning whether the behavior is expected or not, it's unclear from the specification's point of view. After a closer look, I opened an issue describing the conflict in the definition of the field "Type" and its allowed values:
INCF/swc-specification#10

I suggest we wait until an official clarification is given and then I can send a change to allow 0 types in the SWC reader.

Is a 0 type produced automatically by a reconstruction tool or do you create these morphologies on your side, having control over the types that are assigned to the points?

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