Skip to content

Fix solution edges dropped during GEFF export when not in LinkDB#263

Merged
JoOkuma merged 2 commits intoroyerlab:mainfrom
ThibautGoldsborough:fix/geff-export-missing-solution-edges
Mar 17, 2026
Merged

Fix solution edges dropped during GEFF export when not in LinkDB#263
JoOkuma merged 2 commits intoroyerlab:mainfrom
ThibautGoldsborough:fix/geff-export-missing-solution-edges

Conversation

@ThibautGoldsborough
Copy link
Copy Markdown
Contributor

Bug

to_geff_from_database silently drops solution edges that exist in NodeDB.parent_id but have no corresponding entry in the LinkDB (links) table.

This happens because the export collects solution edges from NodeDB.parent_id, then merges them onto the LinkDB edges using a left join on (source_id, target_id). Since the left join is anchored on LinkDB, any solution edge without a matching link row is discarded.

When it fails

This affects any workflow where an annotator manually creates a parent-child connection that wasn't in the original candidate edge set. The most common case is cell divisions: when an annotator connects a mother cell to a second daughter, this new edge exists only in NodeDB.parent_id and not in LinkDB. The exported GEFF file will be missing that edge, so the division is lost or appears as a regular track.

Fix

Change the merge from how="left" to how="outer" so that solution edges not present in LinkDB are preserved in the output. The weight column is filled with 0.0 for these added edges since they have no candidate link weight.

# Before
edge_df = edge_df.merge(sol_links_df, on=["source_id", "target_id"], how="left")
...
edge_df["weight"] = edge_df["weight"].astype(np.float64)

# After
edge_df = edge_df.merge(sol_links_df, on=["source_id", "target_id"], how="outer")
...
edge_df["weight"] = edge_df["weight"].fillna(0.0).astype(np.float64)

ThibautGoldsborough and others added 2 commits March 16, 2026 19:00
The left join on LinkDB silently discards solution edges (from
NodeDB.parent_id) that have no corresponding entry in the links table.
This happens when annotators manually create parent-child connections
(e.g. cell divisions) that weren't in the original candidate edge set.

Changed the merge from "left" to "outer" so these edges are preserved,
with weight filled to 0.0 for the newly added rows.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@9a7084d). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #263   +/-   ##
=======================================
  Coverage        ?   83.07%           
=======================================
  Files           ?       97           
  Lines           ?     6221           
  Branches        ?        0           
=======================================
  Hits            ?     5168           
  Misses          ?     1053           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 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.

@JoOkuma JoOkuma merged commit d15bf43 into royerlab:main Mar 17, 2026
5 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.

2 participants