-
Notifications
You must be signed in to change notification settings - Fork 55
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
Axon metrics at zero for some files #975
Comments
Hello! You need to 'sanitize' your morphologies first with this: https://github.com/BlueBrain/NeuroR/blob/master/neuror/sanitize.py. BBP tools assume some minimal standard to deal with morphologies, and it seems (from the warning) that they don't meet that standard. This tool in NeuroR is fixing some issues and warning you about some. The point of our MCAR workflow will be to ensure all our morphologies are 'good enough. If sanitize does not do the trick, we can look closer. My guess is: your neurite is disconnected, so it is not taken into account (likely to be the axon). |
also, how do I dl your morphs? Can't find the button on the atlas UI |
I can share in private |
Please share w/ @eleftherioszisis too, thanks. |
Yes, done. There are multiple ways to address this:
Not sure yet what is best but if a tool is developed to modify the structure, it could be part of NeuroR/sanitize. Maybe @eleftherioszisis can give more info about the implications those workaround would have. |
Another way to address this situation is to make NeuroM compatible with branching change of type, but this seems complex to introduce and there would probably be a lot of backward compatibility tests to perform. |
For this
We'll have to look at this, but so far we've held off b/c (afaik) most examples of this have been an error - however, I'm not a neuroscientist, and I believe we know that heterogenous dendrite/axons exist, so it's something we should look into handling. However, this would mean that these sorts of errors (if it is indeed an error) would not be uncovered, and I think they would cause problems down the toolchain. |
Reason & ExampleWhen a morphology file is loaded,
NeuroM/neurom/core/morphology.py Lines 346 to 349 in 5a48859
This works well for most neurites, but it breaks down for neurites in which an axon starts from a basal dendrite. I have created a test cell with one tree and two different subtree types import neurom
n = neurom.load_morphology(
"""
1 1 7397.3 3283.1 3618.8 1.0 -1
2 1 7397.3 3282.1 3618.8 1.0 1
3 1 7397.3 3284.1 3618.8 1.0 1
4 3 7397.2 3283.0 3615.9 2.2 1
5 3 7397.3 3282.3 3614.3 2.2 4
6 3 7398.1 3281.4 3612.8 2.2 5
7 3 7398.6 3280.5 3611.4 2.2 6
8 3 7398.8 3280.0 3609.6 2.2 7
9 3 7399.4 3279.5 3608.9 2.2 8
10 3 7399.5 3279.5 3608.8 2.2 9
11 2 7400.3 3278.9 3607.2 1.0 7
12 2 7400.2 3277.6 3605.7 1.0 11
13 2 7400.3 3277.6 3605.7 1.0 12
""",
reader="swc")
print(n.neurites)
print(n.sections) which outputs:
When a feature,
outputs:
And of course:
outputs:
Therefore, @jonathanlurie this is the expected behavior with Solution Proposals1. Adapt NeuroM to handle correctly the calculation of features on mixed type trees Change how the tree/section representations and filtering are handled by the morph/neurite/section iterators. Certain features would require handling special cases so that they are calculated correctly if the starting point is not the soma. Pros:
Cons:
2. Connect axon to the soma and remove it from the basal Pros:
Cons
3. Clone shared branches and generate two different trees with an overlapping initial part A new sanitization function will be added to Pros:
Cons:
IMHO the third solution looks like the most promising one as we would not need to change/break NeuroM for taking into account these not-so-frequent types of trees. Thoughts? Suggestions? Concerns? |
I don't see much difference between 2 and 3, apart from adding a straight line to connect to soma, or a curly line. It will have the same cons. Imo, from the science point of view:
|
Here are some comments on this...
|
Thanks @eleftherioszisis for outlining possible solutions. Thanks @lidakanari; that's valuable input. I agree 100% with I lean heavily to option 1; I looked through the features:
I'm sure I've missed other impacts of the heterogeneous change, so if you can think of them, please list them. With respect to this being a breaking change; we could jump to version 4 to signal that people need to be aware of this. |
+1 and it could help here as well: BlueBrain/morph-tool#70 |
imo the
Are there any other cases of mixed subtypes, or is the axon starting from a basal dendrite the only known exception? |
I know these sub_neurite_types: apical_oblique, apical_tuft, apical_trunk, axon_ais, axon_collaterals, axon_main |
How are these annotated in the morphology file? Is there a specification with their identifiers? |
they are not, the PR above tries to assign them (apical can be split if one knows apical point for example). So if a proper subtype option is available, handling these would be less hacky, which could be convenient! (but this is not a priority at all!) |
@arnaudon, this discussion is mainly about existing section types and neurites that may have mixed combinations of existing section types. Therefore, we should discuss that use-case in a different thread. I would like to also share the following ideas:
An alternative route, which is still vague in my mind would be to introduce a @dataclass
class NeuriteType:
subtypes: Optional[set] = None
|
Sure, but it does not make sense to have a super-neurite which contains an axon and a basal imo. An axon is an axon, regardless if it is attached to the soma, or any other sections of basal. I would rather relax the root_section to be something else than the soma, if possible. |
NeuroM is not designed for introducing mutations. Therefore, breaking trees and making intermediate containers that store subtrees is not the way to go imho, as we should stay as close as possible to the biological data. Essentially, we are talking about the same thing with the only difference being that the distinction/processing is made while traversing the data as opposed to changing the data so that we can do the classical processing. If the latter was to be done I would suggest (as I did in the first set of suggestions), to do it before NeuroM and pass the curated data to NeuroM for classical analysis. |
Funny enough, I just bumped into that issue now. So I looked at neurom a bit more, and found that in core/morphology.py
where |
Creating a neurite with a different section than |
Use a self.is_root here to stop when you want?
|
Not sure I follow the "Use a self.is_root here to stop when you want?". |
instead of asking morphio if a section is root (which would be True only for root_sections), set an attribute is_root for neurom sections (which is == morphio_section.is_root for most of the cases), which we can set to the 'custom' root_section to stop the ipustream before you jump into another dendrite. This is the possible issue you were referring to, no? |
Ah, I see. I am afraid we cannot bypass the graph representation just to serve a specific use case. That's a hack and I am sure there is a better way to do this without breaking the neurom/morphio integration. |
How would be break morphio/neurom? Morphio does not know about neurites, and this is only about neurite? |
The integration of morphio into neurom, not morphio itself. On the neurom side we would have a state that is not present on the morphio side. |
yes, I mean neuron Section, it has an is_root which is not doing much, we can add a .is_initial or something. Why is it an issue to add a new property in neurom section? Anyway, I'm curious about this stuff now, I'll play with the code a little next week. Have a good week end! |
Attempt here:#977 |
A check for the heterogeneity of trees has been added to Before going deeper into the implementation details, however, we need to first pin down the behavior of this feature from the user side:
|
* A heterogeneous morphology consists of zero or more homogeneous and at least one heterogeneous neurite trees extending from the soma; * 'heterogeneous neurite trees ' is called a 'mixed subtree' for brevity * this is a breaking change with how NeuroM<=3.x works * this will fix #975
* A heterogeneous morphology consists of zero or more homogeneous and at least one heterogeneous neurite trees extending from the soma; * 'heterogeneous neurite trees ' is called a 'mixed subtree' for brevity * this is a breaking change with how NeuroM<=3.x works * this will fix #975
Hello,
I am using NeuroM to compute some morph metrics on the soma, axon, basal dendrites and apical dendrite. In some cases, the axon metrics are all zeros even though there is an axon. From what we could gather, it seems that this issue is occuring in about 25% of cases among the ~200 morphs we processed. Note that things are working well for basal dendrite, apical dendrite (when present) and general morphology metrics.
Here is a short version of the code we use to compute the metrics:
You can find below three examples of morphologies that are experiencing this issue. At first, this issue seemed related to the soma warning, though some morphologies to which the axon metrics are properly computed seem to also have a soma warning (so I just left it, just in case). I'll share the file provately so that you have a chance to rerun it.
18454_00126.swc
see it in the atlasFor this morph, NeuroM show the following message:
17302_00120.swc
see it in the atlasFor this morph, NeuroM show the following message:
17302_00039.swc
see it in the atlasFor this morph, NeuroM shows the following message:
The text was updated successfully, but these errors were encountered: