Skip to content
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
3 changes: 2 additions & 1 deletion emannotationschemas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
DigitalTwinPropertiesBCM,
)
from emannotationschemas.schemas.glia_contact import GliaContact
from emannotationschemas.schemas.groups import SimpleGroup
from emannotationschemas.schemas.groups import SimpleGroup, SimpleGroupIndexed
from emannotationschemas.schemas.neuropil import FlyNeuropil
from emannotationschemas.schemas.nucleus_detection import NucleusDetection
from emannotationschemas.schemas.postsynaptic_compartment import PostsynapticCompartment
Expand Down Expand Up @@ -124,6 +124,7 @@
"representative_point": RepresentativePoint,
"reference_synapse_valid": ValidSynapse,
"reference_simple_group": SimpleGroup,
"reference_simple_group_indexed": SimpleGroupIndexed,
"fly_cell_type": FlyCellType,
"fly_cell_type_ext": FlyCellTypeExt,
"braincircuits_annotation_user": BrainCircuitsBoundTagAnnotationUser,
Expand Down
7 changes: 7 additions & 0 deletions emannotationschemas/schemas/groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,10 @@ class SimpleGroup(ReferenceAnnotation):
required=True,
description="group id",
)

class SimpleGroupIndexed(ReferenceAnnotation):
group_id = mm.fields.Int(
required=True,
description="group id",
index=True,
)
27 changes: 27 additions & 0 deletions tests/test_simple_group.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from emannotationschemas.schemas.groups import SimpleGroup, SimpleGroupIndexed

good_simple_group = {
"pt": {"position": [31, 32, 33]},
"group_id": 42,
"target_id": 456,
}

good_simple_group_indexed = {
"pt": {"position": [10, 20, 30]},
"group_id": 123,
"target_id": 456,
}


def test_simple_group_schema():
schema = SimpleGroup()
result = schema.load(good_simple_group)
assert result["group_id"] == 42
assert result["pt"]["position"] == [31, 32, 33]


def test_simple_group_indexed_schema():
schema = SimpleGroupIndexed()
result = schema.load(good_simple_group_indexed)
assert result["group_id"] == 123
assert result["pt"]["position"] == [10, 20, 30]