-
Notifications
You must be signed in to change notification settings - Fork 24
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
Feature Request: Option to treat subsequent points with different SWC tags as fork points #469
Comments
I think I noticed something similar just recently; let me create an example file, and we can check that we're on the same page. |
Conceptually a series of SWC samples with the following tags:
gets converted in MorphIO to a single Section with type 1:
more equivalent to this SWC:
I'd like an option to parse this as 3 Sections with their respective types:
|
Yup, we're on the same page:
should have I will take a look when I have moment. I have a rewrite of the SWC parser in progress, that covers this case, afaik. I need to finish it though. |
@Helveg I have implemented a change that should fix this. I'd really appreciate it if you could try with your code, because I think: The branch w/ my new reader is: https://github.com/BlueBrain/MorphIO/compare/efficient-swc-build |
Hmm, my version is
for this SWC file, which looks good:
I'm on WSL2, my files might have weird line endings and other fun cross-platform freakiness |
Cool, thanks for the example; I will have a look. |
I tried loading the above snippet, and it seemed to work. I will try some variations on it though. I don't have a WSL2 machine at my disposal, though. |
It's the line endings, I believe. After running >>> import morphio
>>> morphio.Morphology("git/arborize/tests/data/morphologies/multitagged.swc")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
morphio._morphio.RawDataError:
git/arborize/tests/data/morphologies/multitagged.swc:1:error
Unable to parse this line
>>> import morphio
>>> morphio.Morphology("git/arborize/tests/data/morphologies/multitagged.swc")
<morphio._morphio.Morphology object at 0x7f6ff26c2a70> |
Yup, thanks for catching that. |
Any status updates? :) |
Sorry, I was away, and haven't had a single stitch of time to look since I got back. I think it's a quick fix, though, so I can maybe find time today. |
I have added handling of windows end of line here: Could you try it, and see if it fixes this problem? |
Parses into 1 soma and 3 sections! 🎉 |
I hope that's what you expected! |
It is, thanks :) |
When would this land in release? It's a blocker for me. If you can sneak it in in the next few days I would not have to fix a whole series of pesky bugs with my own SWC parser ;) |
I'm super busy with other things at the moment. There are a couple tests that fail, and I think it might be a semantic decision that needs to be made. For that, I will need to discuss with others what the right decision is. |
@Helveg you're input would be helpful: do you think the following is a valid (but small) SWC file:
|
Nitpick: the sample identifiers (first column) need to be unique. I'd say since SWC points from the child to the parent, the inferred segment should have the child's properties all the way up to the parent. The resulting output of:
should then be a disc shaped soma segment of length 0, and a dendritic segment of length 1, just like:
would intuitively create a soma and 2 dendrites, not a Y shaped soma. |
I'd say it's a design choice of MorphIO to allow for 0 length segments or not, but I don't see the harm in allowing it. I'd find it needlessly restrictive for valid edge cases, and would leave these kinds of quality checks to dedicated morphology auditing/repairing tools that one can build on top of MorphIO. |
Yeah, that was a typo; sorry.
Okay, makes sense. Currently, we're also transforming:
Into:
Which seems wrong: ie now the soma has two children instead of one. Thoughts? |
I don't understand? Why add a point? |
Yeah, that's my confusion too; I don't in the "new" parser, and that's what I have to work out. Thanks for your input. |
Consider a morphology with an axon consisting of a single branch, but with 3 different SWC tags: 2 for axon, 6 for axon hillock, and 7 for axon initial segment. With the current MorphIO parser this gets reduced into 1 Section with 1 type, depending on the SWC tag of the first point of the branch.
I'd like to request a new option to split this branch into 3 Sections, wherever there is an SWC tag transition (taking into account the
no_duplicates
option)The text was updated successfully, but these errors were encountered: