Stage ME-model e-type in SONATA nodes - #260
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests.
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
| f"morphologies/{Path(morph_file).stem}" | ||
| ) | ||
| group_0.create_dataset("mtype", (1,), dtype=h5py.string_dtype())[0] = mtype | ||
| group_0.create_dataset("etype", (1,), dtype=h5py.string_dtype())[0] = etype |
There was a problem hiding this comment.
Is it acceptable if etype = "" to write that?
There was a problem hiding this comment.
You are right, an empty string could cause failures downstream. In principle, an me-model should always have an etype but since the schema does not enforce this, it is safer to fail early. I will make staging raise StagingError when the associated me-model has no etype.
| etypes = memodel.emodel.etypes or [] | ||
| if not etypes or not etypes[0].pref_label.strip(): | ||
| raise StagingError(f"MEModel {memodel.id} has no e-type on its associated E-model.") | ||
| etype = etypes[0].pref_label.strip() |
There was a problem hiding this comment.
Given that pref_label is in the db I would not normalize its value with strip. It should always be correct and the data considered correct or in need of correction to be dealt with somewhere else.
| etypes = memodel.emodel.etypes or [] | |
| if not etypes or not etypes[0].pref_label.strip(): | |
| raise StagingError(f"MEModel {memodel.id} has no e-type on its associated E-model.") | |
| etype = etypes[0].pref_label.strip() | |
| if etypes := memodel.emodel.etypes: | |
| etype = etypes[0].pref_label | |
| else: | |
| raise StagingError(f"MEModel {memodel.id} has no e-type on its associated E-model.") |
There was a problem hiding this comment.
I would also do exactly the same for mtype before downloading below so that it fails early.
| mtype: str = "", | ||
| etype: str = "", |
There was a problem hiding this comment.
I suppose these should not be set as ""
This reverts commit 4a547cb.
|
After discussing this further with @darshanmandge, we concluded that etype needs to remain optional as well. Ion channel models are also staged as SONATA circuits but do not have mtype or etype classifications. The current BlueCelluLab execution path does not require these properties so I propose writing them when available and omitting the datasets otherwise rather than failing staging or writing empty strings. One additional consideration is that Neurodamus currently reads mtype unconditionally during normal loading while missing etype is tolerated. Its dry-run path reads both properties unconditionally. We will therefore need to update those paths before migrating the execution backend to Neurodamus. |
The node files generated should conform to the SONATA spec, where mtype and etype are mandatory. See: https://sonata-extension.readthedocs.io/en/latest/sonata_tech.html Parsers are implemented according to the spec, therefore the spec should determine what should be there, not BlueCelluLab. |
I think we could make them optional under certain conditions. In the longer term, the plan was to refine the validation and specs w.r.t. the properties that are really mandatory depending on the different types of circuits (like regular circuit, EM circuits, etc.). There is a ticket for it already: https://github.com/openbraininstitute/prod-build-circuit/issues/49 (but not yet worked on). But for the time being you could skip SNAP validation when registering the circuit. There is a flag for this and this is already skipped in the EM synapse mapping task as well until we have a better solution: |
Thanks, that sounds like a good temporary solution. I understand this means the generated circuits won’t fully conform to the current sonata spec but we need to support these circuit types now. I have updated this PR to only write mtype and etype when available. I will use |
Adds the missing etype to staged single-cell SONATA nodes, sourced from the ME-model’s E-model classification. This satisfies the BluePySnap biophysical-node requirement. Missing mtype and etype classifications are omitted instead of being written as empty strings.