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

dendrite subtypes handling #70

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

arnaudon
Copy link
Contributor

@arnaudon arnaudon commented Jun 3, 2021

For various project, it is convenient to have a way to assign sub sectiontypes to morphologies, based on a particular point (apical point, or 'axon point'). This is an attempt to provide such a little tool via the SectionType.custom[number] of morphio.
One set the subtypes, then use the provided dict to access specific section via names (trunk, oblique) instead of custom[number], then can unset them to return to original morphology (for example after some manipulations, to be able to save it on disc).

It is a bit of a mix-up between neurom and morphio, I'm open to any suggestions to make this cleaner.

morph_tool/axon_point.py Outdated Show resolved Hide resolved
for section in iter_sections(neuron):
if section.type == SectionType.axon:
extended_types[section.id] = "axon"
if section.type == SectionType.basal_dendrite:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if section.type == SectionType.basal_dendrite:
elif section.type == SectionType.basal_dendrite:

extended_types[section.id] = "axon"
if section.type == SectionType.basal_dendrite:
extended_types[section.id] = "basal"
if section.type == SectionType.apical_dendrite:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if section.type == SectionType.apical_dendrite:
elif section.type == SectionType.apical_dendrite:

for section in iter_sections(neuron):
if section.type == SectionType.basal_dendrite:
extended_types[section.id] = "basal"
if section.type == SectionType.axon:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if section.type == SectionType.axon:
elif section.type == SectionType.axon:

return neuron


def _unset_subtypes(neuron, base_type):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about using a mapping of base types? So it is possible to use several custom types at the same time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, I should rather use the REV_ mapping here, so we can revert only specific custom types

def set_apical_subtypes(neuron, tuft_percent=20):
"""Set apical subtypes to a morphology.

WARNING: cannot save it to .asc file, use unset_subtype to revert
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use the .. warning:: directive?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And by the way why can't we save custom types? Is it a limitation of MorphIO?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't try all format, abut asc is based on neurites, which can have only specific names via morphio. I'm not sure with new code of @eleftherioszisis in neurom how this can be better handled

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants