Skip to content

Make uei_count optional - #434

Closed
johandahlberg wants to merge 2 commits into
devfrom
feature/pna-3264
Closed

Make uei_count optional#434
johandahlberg wants to merge 2 commits into
devfrom
feature/pna-3264

Conversation

@johandahlberg

@johandahlberg johandahlberg commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Description

Make uei_count optional.

Fixes: pna-3264

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce it when relevant.

PR checklist:

  • This comment contains a description of changes (with reason).
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • If a new tool or package is included, I have updated dependencies in pyproject.toml and cited it properly
  • I have checked my code and documentation and corrected any misspellings
  • I have documented any significant changes to the code in CHANGELOG.md

Note

Medium Risk
Touches graph statistics and sample-calling SQL paths; absent uei_count will report zero molecules, which could mislead downstream metrics if callers expect real molecule counts.

Overview
uei_count is now optional on PNA edgelists in sample calling and the graph component recovery path, so pipelines can run when that column is missing.

Shared helpers has_uei_count and n_molecules_sql detect the column via DuckDB DESCRIBE and either sum molecules or treat counts as 0. Graph recovery uses this for molecule totals and for create_working_edgelist (synthetic uei_count = 0 when absent). Sample calling omits uei_count from exported edgelists when it was not on the input.

CHANGELOG documents the behavior. Tests cover stats, working edgelist shaping, and end-to-end sample calling without uei_count.

Reviewed by Cursor Bugbot for commit 51eaa3e. Bugbot is set up for automated code reviews on this repo. Configure here.

@johandahlberg
johandahlberg requested a review from ptajvar August 4, 2026 15:24
@johandahlberg
johandahlberg marked this pull request as ready for review August 4, 2026 15:24

@ptajvar ptajvar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you for the fix Johan!

Comment thread src/pixelator/pna/graph/component_recovery.py
johandahlberg and others added 2 commits August 5, 2026 08:11
- Only select the uei column when it is present so sample
  calling works also without it.
- Make uei_count optional in graph component recovery. Treat
  missing uei_count as 0 for molecule stats and working
  edgelists so the graph step accepts the new edgelist format.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 51eaa3e. Configure here.


def n_molecules_sql(has_uei_count: bool) -> str:
"""SQL expression for molecule count; defaults to 0 when ``uei_count`` is absent."""
return "SUM(uei_count)" if has_uei_count else "0"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Non-aggregate molecule SQL fallback

Medium Severity

The n_molecules_sql helper returns a non-aggregate 0 when uei_count is missing. In component_recovery, using this directly in SELECT can cause an index error for empty edgelists or yield a column of zeros instead of a single total. get_count_statistics correctly embeds it within an aggregate query.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 51eaa3e. Configure here.

@johandahlberg

Copy link
Copy Markdown
Contributor Author

I will close this and open a new one, since for some reason I can't get GH to rebase this properly.

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