From dd2a15dbc4983cbdd9343d258c98bdb755b43ba3 Mon Sep 17 00:00:00 2001 From: Ben Pedigo Date: Mon, 23 Feb 2026 11:23:33 -0800 Subject: [PATCH 1/6] Add Spine class with volume attribute --- emannotationschemas/schemas/postsynaptic_compartment.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/emannotationschemas/schemas/postsynaptic_compartment.py b/emannotationschemas/schemas/postsynaptic_compartment.py index a7abc0a..9ff2129 100644 --- a/emannotationschemas/schemas/postsynaptic_compartment.py +++ b/emannotationschemas/schemas/postsynaptic_compartment.py @@ -30,3 +30,7 @@ class PostsynapticCompartment(ReferenceAnnotation): validate=OneOf(allowed_dendrite_classes), description="Type of dendritic branch, e.g. basal or apical", ) + + +class Spine(BoundSpatialPoint): + volume = mm.fields.Float(required=False, description="Estimated volume of the spine") From 8656e194ee0fad524628ec128dd7d3d724eca341 Mon Sep 17 00:00:00 2001 From: Ben Pedigo Date: Mon, 23 Feb 2026 11:39:24 -0800 Subject: [PATCH 2/6] fix import --- emannotationschemas/schemas/postsynaptic_compartment.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/emannotationschemas/schemas/postsynaptic_compartment.py b/emannotationschemas/schemas/postsynaptic_compartment.py index 9ff2129..bfe93d4 100644 --- a/emannotationschemas/schemas/postsynaptic_compartment.py +++ b/emannotationschemas/schemas/postsynaptic_compartment.py @@ -1,7 +1,8 @@ import marshmallow as mm -from emannotationschemas.schemas.base import ReferenceAnnotation from marshmallow.validate import OneOf +from emannotationschemas.schemas.base import BoundSpatialPoint, ReferenceAnnotation + allowed_compartments = [ "soma", "dendrite", @@ -12,7 +13,6 @@ class PostsynapticCompartment(ReferenceAnnotation): - compartment = mm.fields.Str( required=True, validate=OneOf(allowed_compartments), @@ -33,4 +33,6 @@ class PostsynapticCompartment(ReferenceAnnotation): class Spine(BoundSpatialPoint): - volume = mm.fields.Float(required=False, description="Estimated volume of the spine") + volume = mm.fields.Float( + required=False, description="Estimated volume of the spine" + ) From 8ba2ba69718967416a7d91a2a2cacf6ea1023106 Mon Sep 17 00:00:00 2001 From: Ben Pedigo Date: Mon, 23 Feb 2026 11:48:31 -0800 Subject: [PATCH 3/6] add n_inputs --- emannotationschemas/schemas/postsynaptic_compartment.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/emannotationschemas/schemas/postsynaptic_compartment.py b/emannotationschemas/schemas/postsynaptic_compartment.py index bfe93d4..04f21f7 100644 --- a/emannotationschemas/schemas/postsynaptic_compartment.py +++ b/emannotationschemas/schemas/postsynaptic_compartment.py @@ -36,3 +36,8 @@ class Spine(BoundSpatialPoint): volume = mm.fields.Float( required=False, description="Estimated volume of the spine" ) + + n_inputs = mm.fields.Int( + required=False, + description="Number of synaptic inputs (unique root IDs) onto the spine", + ) From 385b7371bfb58ed9308f742bf8da171b52075fa5 Mon Sep 17 00:00:00 2001 From: Ben Pedigo Date: Mon, 23 Feb 2026 12:14:10 -0800 Subject: [PATCH 4/6] change name --- emannotationschemas/schemas/postsynaptic_compartment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emannotationschemas/schemas/postsynaptic_compartment.py b/emannotationschemas/schemas/postsynaptic_compartment.py index 04f21f7..97168af 100644 --- a/emannotationschemas/schemas/postsynaptic_compartment.py +++ b/emannotationschemas/schemas/postsynaptic_compartment.py @@ -32,7 +32,7 @@ class PostsynapticCompartment(ReferenceAnnotation): ) -class Spine(BoundSpatialPoint): +class SpineWithInfo(BoundSpatialPoint): volume = mm.fields.Float( required=False, description="Estimated volume of the spine" ) From 1d6ed9b1dbb81c1500ba7fb5e57cef68a523e5f8 Mon Sep 17 00:00:00 2001 From: Ben Pedigo Date: Mon, 23 Feb 2026 12:15:14 -0800 Subject: [PATCH 5/6] add to imports --- emannotationschemas/__init__.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/emannotationschemas/__init__.py b/emannotationschemas/__init__.py index 56c8343..ffce7a3 100644 --- a/emannotationschemas/__init__.py +++ b/emannotationschemas/__init__.py @@ -48,14 +48,22 @@ V1DDFunctionalUnitCoregistration, ) from emannotationschemas.schemas.functional_props import ( - FunctionalPropertiesBCM, DigitalTwinPropertiesBCM, + FunctionalPropertiesBCM, ) from emannotationschemas.schemas.glia_contact import GliaContact from emannotationschemas.schemas.groups import SimpleGroup +from emannotationschemas.schemas.matching import ( + CellMatch, + CellMatchReference, + CellSimilarity, +) from emannotationschemas.schemas.neuropil import FlyNeuropil from emannotationschemas.schemas.nucleus_detection import NucleusDetection -from emannotationschemas.schemas.postsynaptic_compartment import PostsynapticCompartment +from emannotationschemas.schemas.postsynaptic_compartment import ( + PostsynapticCompartment, + SpineWithInfo, +) from emannotationschemas.schemas.presynaptic_bouton_type import PresynapticBoutonType from emannotationschemas.schemas.proofreading import ( CompartmentProofreadStatus, @@ -66,11 +74,6 @@ from emannotationschemas.schemas.reference_text_float import ( ReferenceTagFloat, ) -from emannotationschemas.schemas.matching import ( - CellMatch, - CellSimilarity, - CellMatchReference, -) from emannotationschemas.schemas.synapse import ( BuhmannEcksteinSynapseSchema, BuhmannSynapseSchema, @@ -92,6 +95,7 @@ "bouton_shape": BoutonShape, "presynaptic_bouton_type": PresynapticBoutonType, "postsynaptic_compartment": PostsynapticCompartment, + "spine_with_info": SpineWithInfo, "microns_func_coreg": FunctionalCoregistration, "microns_func_unit_coreg": FunctionalUnitCoregistration, "v1dd_func_unit_coreg": V1DDFunctionalUnitCoregistration, From 88dd4dc84c24d6890aab65de4633683de9826de5 Mon Sep 17 00:00:00 2001 From: Ben Pedigo Date: Mon, 23 Feb 2026 12:42:18 -0800 Subject: [PATCH 6/6] add test --- tests/test_spine.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 tests/test_spine.py diff --git a/tests/test_spine.py b/tests/test_spine.py new file mode 100644 index 0000000..c5b445b --- /dev/null +++ b/tests/test_spine.py @@ -0,0 +1,35 @@ +from emannotationschemas.schemas.postsynaptic_compartment import SpineWithInfo + +good_spine_with_info = { + "position": [100, 200, 300], + "supervoxel_id": 50, + "root_id": 10, + "volume": 1.5, + "n_inputs": 3, +} + + +def test_spine_with_info_schema(): + schema = SpineWithInfo() + result = schema.load(good_spine_with_info) + assert result["position"] == [100, 200, 300] + assert result["supervoxel_id"] == 50 + assert result["root_id"] == 10 + assert result["volume"] == 1.5 + assert result["n_inputs"] == 3 + + +def test_spine_with_info_optional(): + schema = SpineWithInfo() + result = schema.load( + { + "position": [100, 200, 300], + "supervoxel_id": 50, + "root_id": 10, + } + ) + assert result["position"] == [100, 200, 300] + assert result["supervoxel_id"] == 50 + assert result["root_id"] == 10 + assert "volume" not in result + assert "n_inputs" not in result