BlueBrain / morph-tool

https://morph-tool.readthedocs.org/
GNU Lesser General Public License v3.0
8 stars 7 forks source link

issue in soma converter form swc #117

Closed arnaudon closed 10 months ago

arnaudon commented 1 year ago

The attached morphology has the first and last point of the soma at the same x-y coordinates, hence the from_swc code creates a soma with Nan values and neuron stalls trying to import the .asc file with lots of Nan values in the soma. I am not familiar enough with this converter from swc to know how to fix it. @lidakanari, would you know what's wrong?

mgeplf commented 1 year ago

Where does that attached morphology come from? It sounds like it's a contour, even though SWC should be using stacked cylinders, afaik.

arnaudon commented 1 year ago

@lidakanari gave it to me, I think allen data. I also had the same feeling it was not encoding the expected soma format for swc.

mgeplf commented 1 year ago

It looks like it was converted by MorphIO, but perhaps the soma wasn't properly defined? It would be nice to find the original, I think.

arnaudon commented 1 year ago

I have a similar issu with a soma like

# index     type         X            Y            Z       radius       parent
1           1  0.000000000  0.000000000  0.000000000  9.090999603          -1
2           1  0.000000000  0.000000000 -9.090000153  9.090999603           1
3           1  0.000000000  0.000000000  9.090000153  9.090999603           2

provided by @alTeska , in this case the orthogonal /= np.linalg.norm(orthogonal) breaks and the code stalls forever.

mgeplf commented 1 year ago

That one looks like a neuromorpho 3 point soma - are we not handling that case @eleftherioszisis - @arnaudon what are you trying to convert it to?

mgeplf commented 1 year ago

Ah; this is a fake neuromorpho 3 point soma; they are varying the Z direction instead of the Y:

1 1 xs ys zs rs -1
2 1 xs (ys-rs) zs rs 1
3 1 xs (ys+rs) zs rs 1

@alTeska where did this morph come from? Are there any hints at what produced it?

arnaudon commented 1 year ago

yes, it is from neuromorpho. @alTeska could tell you more. We were converting to both asc and h5 to make a morph release, but it does not matter, it is the same converter

arnaudon commented 1 year ago

we could do something like: https://github.com/BlueBrain/morph-tool/pull/121 ?

mgeplf commented 1 year ago

If only they followed their own "standards", :(.

we could do something like: https://github.com/BlueBrain/morph-tool/pull/121 ?

We may have to, but it seems that outside of getting ppl to clean up their data correctly, we'll have to add this as a potential 3 point soma, and then we should handle that case correctly in the conversion step.

Before that, I'd like to know how widespread the practice is.

alTeska commented 1 year ago

I am trying to include as many morphologies from neuromorpho in my analysis and circuit.

We used a quick fix Alexis made to run the morphology repair, but I will perform further inspection on the morphologies. I can report back on what I find :)

arnaudon commented 1 year ago

Ah, I didn't know there were 'standards' on neuromorpho!

mgeplf commented 1 year ago

@arnaudon > Ah, I didn't know there were 'standards' on neuromorpho!

There's a description of what they do when converting reconstructions into their SWC Morphology File (Standardized) link:

https://neuromorpho.org/SomaFormat.html

mgeplf commented 1 year ago

@alTeska > I am trying to include as many morphologies from neuromorpho in my analysis and circuit.

If you could point me at the neuromorpho URL for the morphology that had this weird soma, that would be helpful for when I add a test to handle it better in code. Thanks.

alTeska commented 1 year ago

I believe this one: https://neuromorpho.org/neuron_info.jsp?neuron_name=06050180003

mgeplf commented 1 year ago

I believe this one:

Yup, looks like the one; I'll email them about it. Thanks.

mgeplf commented 1 year ago

Ok; we have a response directly from Prof. Ascoli: "I think that any 3 point soma would do as long as it represents a symmetric cylinder, and all trees stem from the central one of the 3 points. I hope this helps!"

IMO, this means that we need the fix (it's not a hack, imo :)) in #121; @arnaudon can you add a test for it, and when that's done, @eleftherioszisis can review and merge - I'll likely be on vacation.

Thanks for finding this, and pushing me to get to a heuristic.

mgeplf commented 10 months ago

Is this solved with #121 or is #118 needed as well?