Extract asset anatomy from HERD ontology links in NWB files
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
調査の方向性
Start in pynwb_utils and trace the existing anatomy extraction from #1807, including how it fills wasDerivedFrom[BioSample].anatomy and handles a synthetic brain-region-sample. Then inspect how NWB exposes external_resources and HERD entity IDs, URIs, and keys; implement ontology filtering, Subject exclusions, labels, deduplication, and HERD precedence with tests for the DANDI:001888 example. Done when HERD anatomy is used across species and string matching remains the fallback for files without HERD.
索引モデルが issue の本文から書いたものです。
説明
Summary
Follow-up to #1806. NWB files can carry a HERD table (/general/external_resources) that links values in the file to ontology terms. When a HERD row links a value to an anatomy term (UBERON, Allen MBA, ...), dandi should use that term for the asset's anatomy. The author asserted these links, so they should take precedence over the string matching added in #1807 (and extended in #1825).
In #1806 we agreed to put a BioSample with .anatomy into each asset's wasDerivedFrom, then aggregate across assets in dandischema. This issue feeds that same slot from HERD.
Example: DANDI:001888
https://dandiarchive.org/dandiset/001888/draft holds rat EEG/EMG, 23 files. Each file has a HERD table. For sub-GRIN2B-129/sub-GRIN2B-129_ses-2021-03-26_ecephys.nwb:
| Object | Key (value in file) | Entity |
|---|---|---|
electrodes.location |
S1_Tr, S1Hl_S1Fl |
UBERON:0008933 (primary somatosensory cortex) |
electrodes.location |
M1_anterior |
UBERON:0001384 (primary motor cortex) |
electrodes.location |
M2_Fra, M2_anterior |
UBERON:0016634 (premotor cortex) |
electrodes.location |
V1_M |
UBERON:0002436 (primary visual cortex) |
electrodes.location |
V2_ML |
UBERON:0022232 (secondary visual cortex) |
electrodes.location |
EMG |
UBERON:0002380 (trapezius muscle) |
ElectrodeGroup EEGArray.location |
cortex |
UBERON:0000956 (cerebral cortex) |
ElectrodeGroup EMGArray.location |
trapezius muscle |
UBERON:0002380 |
The same table also links Subject.species, Subject.strain and Subject.genotype (NCBITaxon:10116, RRID:RGD_2308852, RRID:RGD_14394515). This issue covers anatomy only, but the HERD reader could also cover strain RRIDs, which #1724 proposed getting from HERD and which aren't extracted yet (#1716 added the strain text only).
The current asset metadata for these files (uploaded with dandi-cli 0.76.8) has no wasDerivedFrom, so no anatomy. String matching would not help here: the subject is a rat, which #1807 skips, and lab abbreviations like S1_Tr and M2_Fra would not match UBERON labels or synonyms even with #1825. HERD already holds the answer.
Proposed behavior
- In
pynwb_utils, if the file hasnwb.external_resources, collect every HERD entity whose ID uses an anatomy ontology prefix (UBERON:,MBA:, and other atlas prefixes we recognize), whatever object or field it is linked from. - Skip entities linked from
Subjectobjects. UBERON also contains life-stage terms (e.g.UBERON:0000113"post-juvenile adult stage") that a converter could link fromSubject.age. Species, strain and genotype are handled separately anyway. - Turn each remaining entity into
models.Anatomy(identifier=<entity_uri>, name=<label>)and dedupe by identifier. - Put the result in the same place #1807 does:
wasDerivedFrom[BioSample].anatomy, on the deepest real BioSample, or on the syntheticbrain-region-samplewhen there is none. - Precedence: if HERD gives anatomy for a file, use it and skip string matching. String matching stays as the fallback for files without HERD.
- Apply to all species. HERD needs no species check.
Why filter by ontology rather than by source field: anatomy is often linked from fields outside the standard location attributes and columns, such as a brain_area column on the units table, a custom region column, or an injection site in an extension type. A list of allowed fields would miss these and keep growing.
Open questions
- Labels. HERD stores
entity_idandentity_uribut no label, andAnatomy.nameis required and, since dandi/dandi-schema#444, must be non-empty. Options: look up the label in the UBERON table bundled by #1825 (nervous system only, so it would misstrapezius muscle); query OLS at upload time; or fall back to the HERD key (S1_Tr), which is a poor display name. My suggestion: bundled table first, then the key. - Non-brain anatomy.
EMG→ trapezius muscle is a real recording site but not a brain area. I think it belongs inanatomy, since the field is anatomy rather than brain area, but #1807 is framed around brain areas. - Redundant ancestors.
cortex(group level) is an ancestor of every electrode-level term. Keep both, or drop terms that have a more specific descendant in the same file? - Body parts that aren't recording sites. A stimulus table could link a column like "whisker touched" to UBERON. Under the rule above it would count as anatomy. This seems rare and arguably fits "anatomical part studied", so I'd accept it for now and add a skip list only if it turns up in practice.
Dandiset-level summary (out of scope here)
AssetsSummary has no anatomy field, and the archive computes it with dandischema's aggregate_assets_summary, so dandi-cli cannot fill it. Showing anatomy at the Dandiset level needs a dandi-schema change: add anatomy: Optional[List[Anatomy]] to AssetsSummary and collect it from wasDerivedFrom BioSamples in _add_asset_to_stats. Filed as dandi/dandi-schema#446. The Dandiset about field is curated by users, so it shouldn't be filled automatically.
- 主要言語
- Python
- スター
- 28
- フォーク
- 37
- 平均マージ
- 3日 21時間
- マージ済み PR(30日)
- 13
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dandi/dandi-cli のほかの issue
-
pynwb metadata: get neurodata types再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
UX
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
メンテナーはふだん 1 日以内に返信
-
`metadata.nwb.get_metadata()` validates the whole BIDS dataset for every NWB file, then discards the result対応中かも @CodyCBakerPhD が 22 日前に担当しました。 オープンBIDS performance
dandi/dandi-cli#1962 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
`bids_version` is always `None` since the switch to bids-validator-deno対応中かも @yarikoptic-gitmate が 1 日前に担当しました。 オープンBIDS bug
難易度 3/5 半日 初心者へのやさしさ 45/100
dandi/dandi-cli#1961 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
dandi/dandi-cli#1920 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
dandi/dandi-cli の issue をすべて見る
似ている issue
-
bug severity:low
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 2 日以内に返信
-
curriculum documentation quality
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
githubnext/gh-aw-workshop#5367 ·
メンテナーはふだん 3 日以内に返信
-
OAuth documentation for GET /api/v2/users/me/ appears inconsistent with required global read scopeオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
Create Noise Latents ignores randomize_seed and produces the same noise every run対応中かも @griptapeops が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
griptape-ai/griptape-nodes-library-diffusers#127 ·
メンテナーはふだん 1 日以内に返信
-
Jenkins capacity report: metrics history is lost when archiving a month fails対応中かも @RaphaelFakhri が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
adoptium/infrastructure#4568 ·
メンテナーはふだん 1 日以内に返信