Skip to content

Add Laterality enum and region_coverage to ProjectionMeasurementMatrix#2

Open
reneyagmur wants to merge 5 commits intomainfrom
feat/projection-regions-laterality
Open

Add Laterality enum and region_coverage to ProjectionMeasurementMatrix#2
reneyagmur wants to merge 5 commits intomainfrom
feat/projection-regions-laterality

Conversation

@reneyagmur
Copy link
Copy Markdown
Collaborator

Motivation

Projection matrices can be split into ipsilateral/contralateral by naming convention (e.g., wnm_exc_proj_ipsi), but laterality is not captured in the schema, making it unqueryable.

Similarly, determining which CCF regions a dataset has projection data in requires loading the full cells × regions matrix and checking for non-zero columns. This is a common cross-dataset query that should be precomputed.

Changes

schemas/base_schema.yaml

  • New Laterality enum: IPSILATERAL, CONTRALATERAL, BILATERAL, UNKNOWN
  • New laterality slot with range: Laterality

schemas/projection_schema.yaml

  • laterality: required field on ProjectionMeasurementMatrix
  • region_coverage: optional multivalued BrainRegion list on ProjectionMeasurementMatrix — precomputed subset of region_index where at least one data item has a non-zero value

src/connects_common_connectivity/models.py

  • Regenerated via bash scripts/generate_models.sh

tests/test_basic.py

  • test_laterality_enum — all four enum values exist
  • test_projection_measurement_matrix_laterality — required enforcement, valid/invalid enum validation
  • test_region_coverage_on_pmm — optional field, list type, subset of region_index

src/connects_common_connectivity/io/

  • New module with io_plans.md specifying two planned utility functions:
    • populate_region_coverage(pmm, matrix) — auto-populate region_coverage from a dense values array
    • compare_region_coverage(pmms) — shared regions, shared coverage, and exclusive coverage across datasets
    • io utils will be a separate PR

.devcontainer/

  • Added local Docker dev container config (CodeOcean setup unchanged)

environment/postInstall

  • Added CCC package installation

Testing

9 tests pass (uv run pytest -q).

Copy link
Copy Markdown

@danielsf danielsf left a comment

Choose a reason for hiding this comment

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

Just some changes to the unit tests. Other than that, looks good.

Comment thread tests/test_basic.py Outdated
Comment thread tests/test_basic.py Outdated
Comment thread tests/test_basic.py Outdated
@reneyagmur
Copy link
Copy Markdown
Collaborator Author

@danielsf ready for re-review

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