Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eleftherioszisis committed Jun 17, 2024
1 parent 96f0936 commit 0219970
Show file tree
Hide file tree
Showing 9 changed files with 60,791 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/blue_cwl/wrappers/cell_composition_manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import click
import pandas as pd
import voxcell
from entity_management import nexus
from entity_management.atlas import CellComposition
from entity_management.config import BrainRegionSelectorConfig, CellCompositionConfig

# pylint: disable=no-name-in-module
from entity_management.core import Entity
from entity_management.nexus import load_by_id
from entity_management.util import get_entity

from blue_cwl import density_manipulation, registering, staging, statistics, utils
Expand Down Expand Up @@ -256,9 +256,7 @@ def register(
cell_composition_summary_file: Summary file to create the new CellComposition from.
output_dir: Output directory to write outputs.
"""
base_cell_composition = get_entity(
base_cell_composition_id, cls=CellComposition, resolve_context=True
)
base_cell_composition = get_entity(base_cell_composition_id, cls=CellComposition)

atlas_release = base_cell_composition.atlasRelease

Expand All @@ -281,7 +279,7 @@ def register(
_validate_cell_composition_schemas(cell_composition)

utils.write_json(
data=load_by_id(cell_composition.get_id()),
data=nexus.load_by_id(cell_composition.get_id()),
filepath=Path(output_dir, "resource.json"),
)

Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"version": 1,
"unitCode": {
"density": "mm^-3"
},
"hasPart": {
"http://api.brain-map.org/api/v2/data/Structure/614454292": {
"label": "Primary somatosensory area, barrel field, layer 2",
"about": "BrainRegion",
"hasPart": {
"http://uri.interlex.org/base/ilx_0381367": {
"label": "L2_TPC:B",
"about": "MType",
"hasPart": {
"http://bbp.epfl.ch/neurosciencegraph/ontologies/etypes/cADpyr": {
"label": "cADpyr",
"about": "EType",
"composition": {
"neuron": {
"density": 41061.716478599694,
"count": 8059
}
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"hasPart": [
{
"@id": "http://uri.interlex.org/base/ilx_0381367",
"label": "L2_TPC:B",
"about": [
"https://neuroshapes.org/MType"
],
"hasPart": [
{
"@id": "http://bbp.epfl.ch/neurosciencegraph/ontologies/etypes/cADpyr",
"label": "cADpyr",
"about": [
"https://neuroshapes.org/EType"
],
"hasPart": [
{
"@id": "nrrd-id",
"@type": [
"METypeDensity",
"NeuronDensity",
"VolumetricDataLayer",
"CellDensityDataLayer"
],
"_rev": 2
}
]
}
]
}
]
}
Binary file not shown.
47 changes: 47 additions & 0 deletions tests/unit/cell_composition/data/configuration_distribution.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"version": 1,
"unitCode": {
"density": "mm^-3"
},
"overrides": {
"http://api.brain-map.org/api/v2/data/Structure/614454292": {
"label": "Primary somatosensory area, barrel field, layer 2",
"about": "BrainRegion",
"hasPart": {
"http://uri.interlex.org/base/ilx_0381367": {
"label": "L2_TPC:B",
"about": "MType",
"hasPart": {
"http://bbp.epfl.ch/neurosciencegraph/ontologies/etypes/cADpyr": {
"label": "cADpyr",
"about": "EType",
"composition": {
"neuron": {
"density": 203.9132207910741,
"count": 8059
}
},
"density": 203.9132207910741
}
},
"composition": {
"neuron": {
"density": 203.91322079107408
},
"glia": {
"density": 0
}
}
}
},
"composition": {
"neuron": {
"density": 203.91322079107408
},
"glia": {
"density": 0
}
}
}
}
}
Loading

0 comments on commit 0219970

Please sign in to comment.