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

Allow axon-carrying-denrite with fork axon subtrees #1127

Merged
merged 3 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions neurom/core/morphology.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,10 @@ def subtree_types(self):
subtree_types = [next(it).to_morphio().type]

for section in it:
if section.type != section.parent.type:
subtree_types.append(NeuriteType(section.to_morphio().type))
# A subtree can start from a single branch or as a fork of the same type from a parent
# with different type.
if section.type not in (section.parent.type, subtree_types[-1]):
subtree_types.append(section.to_morphio().type)

return subtree_types

Expand Down
23 changes: 23 additions & 0 deletions tests/test_mixed.py
Original file line number Diff line number Diff line change
Expand Up @@ -1140,3 +1140,26 @@ def test_sholl_frequency_pop(mixed_morph):
2,
0,
]


def test_axon_fork_as_axon_carrying_dendrite():
"""Test that a axon subtree starting as a fork is considered an AcD."""
m = neurom.load_morphology(
"""
1 1 0 0 0 0.5 -1
2 3 0 1 0 0.1 1
3 3 1 2 0 0.1 2
4 2 1 4 0 0.1 3
5 2 1 4 1 0.1 4
6 2 1 4 -1 0.1 4
7 2 2 3 0 0.1 3
8 2 2 4 0 0.1 7
9 2 3 3 0 0.1 7
10 2 3 3 1 0.1 9
11 2 3 3 -1 0.1 9
""",
reader="swc",
process_subtrees=True,
)
neurite = m.neurites[0]
assert neurite.type is NeuriteType.axon_carrying_dendrite
Loading