Skip to content

Fix MOD-species edge loss: match new NCBITaxon: taxon prefix - #14

Merged
kevinschaper merged 4 commits into
mainfrom
fix/mod-gaf-ncbitaxon-prefix
Jul 8, 2026
Merged

kevinschaper merged 4 commits into
mainfrom
fix/mod-gaf-ncbitaxon-prefix

Conversation

@kevinschaper

Copy link
Copy Markdown
Member

Problem

The monarch-ingest KG build was failing an edge-count expectation: go-ingest's edge output roughly halved after the June 2026 GO annotation URL migration (#13).

Comparing the two most recent releases confirms the drop:

Release Edges Size
2026-06-01 (pre-migration URLs) 3,802,457 1.04 GB
2026-07-01 (post-migration URLs) 2,019,802 558 MB

Root cause

The June 2026 GO pipeline migration didn't just move files under /annotations/gaf/ — on the -mod GAF files it also changed the Taxon column prefix on MOD-native rows from the legacy lowercase taxon: to NCBITaxon:.

The reader's Taxon filter in src/go_annotation.yaml uses filter_code: in, an exact string match, and only listed taxon:<id> values. So every MOD-native row in the -mod files was excluded. The eight MOD-sourced species collapsed to near-zero — only residual ComplexPortal rows (still taxon:) survived; PomBase and dictyBase, which have no such rows, dropped to exactly zero. The five -uniprot species (human, dog, cow, pig, chicken) were unaffected because those files still use taxon: — human even grew slightly.

Per-species edge counts (2026-06-01 → 2026-07-01):

Species Source June July
Mouse (10090) MGI 709,827 2,436
Rat (10116) RGD 571,401 439
Zebrafish (7955) ZFIN 196,070 23
Fly (7227) FlyBase 170,725 850
Yeast (559292) SGD 138,996 2,772
Worm (6239) WormBase 103,852 488
Pombe (4896) PomBase 65,983 0
Dicty (44689) dictyBase 65,201 0
Human (9606) GOA 906,445 908,373 ✓
Dog/Pig/Cow/Chicken GOA ~874K ~1.1M ✓

The transform code itself was already robust (parse_ncbi_taxa normalizes both prefixes); only the pre-filter in the YAML broke.

Fix

Enumerate every target taxon under both taxon: and NCBITaxon: prefixes in the Taxon filter. This restores single-taxon MOD rows while preserving the existing behavior of dropping piped multi-taxon (host/pathogen) annotations. Adds a regression test asserting the filter lists both prefixes for all taxa.

Verification

Ran the transform locally against freshly downloaded YEAST-mod + SCHPO-mod GAFs:

  • Old filter (taxon: only): 2,772 edges
  • Fixed filter (both prefixes): 218,380 edges

Full test suite passes (18 tests).

https://claude.ai/code/session_01EEmWQVnmV7nFMca8LfWzYz

The June 2026 GO pipeline migration (geneontology/go-announcements#1153,
migrated in #13) reorganized annotation distribution and, on the `-mod`
GAF files, changed the Taxon column prefix on MOD-native rows from the
legacy lowercase `taxon:` to `NCBITaxon:`.

The go_annotation reader's Taxon `in` filter is an exact string match and
only enumerated `taxon:<id>` values, so every MOD-native row in the `-mod`
files was excluded. The eight MOD-sourced species collapsed to near-zero
(only residual ComplexPortal rows, which still use `taxon:`, survived; and
PomBase/dictyBase, which have no such rows, dropped to exactly zero). The
five `-uniprot` species were unaffected because those files still use
`taxon:`. Net effect in the 2026-07-01 release: 3.80M -> 2.02M edges (-47%).

Per-species drop (2026-06-01 -> 2026-07-01):
  mouse 709,827->2,436  rat 571,401->439  zebrafish 196,070->23
  fly 170,725->850  yeast 138,996->2,772  worm 103,852->488
  pombe 65,983->0  dicty 65,201->0

Enumerate every target taxon under both `taxon:` and `NCBITaxon:` prefixes
so single-taxon MOD rows match again while preserving the existing behavior
of dropping piped multi-taxon (host/pathogen) annotations. Add a regression
test asserting the filter covers both prefixes for all taxa.

Verified locally against freshly downloaded YEAST-mod + SCHPO-mod GAFs:
2,772 edges with the old filter vs 218,380 with the fix.

Claude-Session: https://claude.ai/code/session_01EEmWQVnmV7nFMca8LfWzYz
Set a whole-graph min_edge_count of 3,000,000 on the go_annotation writer.
Healthy full-species builds emit ~3.8M edges; the June 2026 GO format change
silently dropped that to ~2.0M and shipped before anyone noticed. This coarse
floor sits well above the failure and ~20% below the healthy low, so a
catastrophic drop fails the build loudly without tripping on normal
fluctuation.

Enforcement requires koza with writer count-bound checking
(monarch-initiative/koza#238); until that release is picked up the field is a
harmless no-op, matching koza's prior behavior.

Claude-Session: https://claude.ai/code/session_01EEmWQVnmV7nFMca8LfWzYz
koza 2.6.1 is the first release that enforces writer min/max count bounds
(monarch-initiative/koza#238, closing #239); on earlier versions the
min_edge_count added to go_annotation.yaml was a silent no-op. Bump the floor
and refresh the lockfile so the edge-count-collapse guard actually fails the
build.

Claude-Session: https://claude.ai/code/session_01EEmWQVnmV7nFMca8LfWzYz
Interleave each taxon id with its two prefixes and trim the comments to what a
future reader needs: the Taxon column mixes taxon:/NCBITaxon: prefixes so the
list carries both, and min_edge_count is ~20% below current output.

Claude-Session: https://claude.ai/code/session_01EEmWQVnmV7nFMca8LfWzYz
@kevinschaper
kevinschaper merged commit d600258 into main Jul 8, 2026
3 checks passed
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.

1 participant