Skip to content

[ENH] BEP032: Require anatomical_reference_point when stereotaxic coordinates are given - #2482

Open
bendichter wants to merge 1 commit into
bids-standard:bep032-reviewfrom
bendichter:bep032-anatomical-reference-point
Open

[ENH] BEP032: Require anatomical_reference_point when stereotaxic coordinates are given#2482
bendichter wants to merge 1 commit into
bids-standard:bep032-reviewfrom
bendichter:bep032-anatomical-reference-point

Conversation

@bendichter

Copy link
Copy Markdown
Contributor

Implements the decision we reached in the working group meeting on 2026-07-29 about anatomical_reference_point, addressing #2307 (comment) and following up on #2307 (comment). This targets bep032-review, so it merges into #2307 rather than into master.

The Change

The column previously said that Bregma is assumed for rodents and that the reference point MUST be defined for species other than rodents. It is now required whenever any of the AP, ML, or DV columns are present, for every species, and the Bregma default is dropped.

As @effigies pointed out, the species conditional came with no check and could not be enforced. The validator context exposes only participant_id from participants.tsv, so a rule evaluating probes.tsv cannot read the species column at all; species is itself only RECOMMENDED and is assumed to be homo sapiens when absent; and deciding rodent versus non-rodent would require taxonomic reasoning rather than string comparison. The condition on the coordinates is both the one that actually matters, since stereotaxic coordinates cannot be interpreted without knowing the point they are measured from, and one that can be checked.

Dropping the default follows from the same change: with the coordinates present the column is required, so there is no case left for a default to cover.

Implementation

MicroephysRequiredAnatomicalReferencePoint in rules/checks/microephys.yaml selects on the presence of any of the three coordinate columns and checks for the reference point. It follows the form of the existing RequiredTemplateX and RequiredComponent checks in rules/checks/nirs.yaml, which condition one column's requirement on another's contents.

In the columns rule the level stays OPTIONAL with a level_addendum of "required if AP, ML, or DV are present", so the rendered table reads "OPTIONAL, but REQUIRED if AP, ML, or DV are present" rather than understating the requirement. The description in objects/columns.yaml and the corresponding sentence in the surgical coordinates appendix are updated to match.

I also added the reference point to the intracellular probes example, which gives stereotaxic coordinates and would otherwise stop being valid under the new check.

Verification

bidsschematools tests pass (81 passed, 1 skipped), as do pre-commit on the changed files and npm run remark. I parsed both new check expressions with bidsschematools.expressions to confirm they are well formed, and confirmed the rendered probes table shows the conditional requirement. Both probes examples in the specification now satisfy the check.

Note on Ordering

This touches the intracellular probes example, which #2481 also edits, so whichever merges second will need a trivial rebase on that one row. Everything else is independent. Happy to rebase whenever it is useful.

@lzehl, this is the third item from the meeting. The first two are #2480 and #2481.

Replace the species-conditional requirement on anatomical_reference_point
with one conditioned on the presence of stereotaxic coordinates, following
the working group discussion on 2026-07-29.

The column previously stated that Bregma is assumed for rodents and that the
reference point MUST be defined for other species. That requirement could not
be enforced. The validator context exposes only participant_id from
participants.tsv, so a rule evaluating probes.tsv cannot read the species
column at all, species is itself only recommended and defaults to homo
sapiens when absent, and deciding rodent versus non-rodent would require
taxonomic reasoning that the expression language does not have.

The column is now required whenever any of AP, ML, or DV are present, for
every species, which is the condition that actually matters, since those
coordinates cannot be interpreted without knowing the point they are measured
from. This is expressible as a check and one is added. The Bregma default is
dropped, since with the coordinates present the column is required and there
is no case left for a default to cover.

Add the reference point to the intracellular probes example, which gives
stereotaxic coordinates and would otherwise no longer be valid.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@bendichter
bendichter requested a review from erdalkaraca as a code owner July 29, 2026 17:17
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.09%. Comparing base (3f661db) to head (cffa26b).

Additional details and impacted files
@@              Coverage Diff               @@
##           bep032-review    #2482   +/-   ##
==============================================
  Coverage          83.09%   83.09%           
==============================================
  Files                 22       22           
  Lines               1698     1698           
==============================================
  Hits                1411     1411           
  Misses               287      287           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@effigies effigies left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This LGTM.

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