Skip to content

Commit

Permalink
Allow axon-carrying-denrite with fork axon subtrees (#1127)
Browse files Browse the repository at this point in the history
  • Loading branch information
eleftherioszisis authored May 31, 2024
1 parent 94951b8 commit d505439
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
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

0 comments on commit d505439

Please sign in to comment.