Skip to content

Enforce pVACvector pathfinder preconditions#1380

Open
maksimf wants to merge 2 commits intogriffithlab:stagingfrom
maksimf:fix-pvacvector-single-peptide-no-edge-staging
Open

Enforce pVACvector pathfinder preconditions#1380
maksimf wants to merge 2 commits intogriffithlab:stagingfrom
maksimf:fix-pvacvector-single-peptide-no-edge-staging

Conversation

@maksimf
Copy link
Copy Markdown

@maksimf maksimf commented Mar 18, 2026

Summary

  • Add a fail-fast precondition check in find_optimal_path to ensure it is only called with a graph that passes check_graph_valid.
  • Raise a clear exception when find_optimal_path is invoked with an invalid graph state.
  • Update the regression test to validate the expected exception for this out-of-contract invocation.

Handle single-peptide runs without junction edges by emitting stable NA score metadata instead of dividing by zero, and add a regression test to prevent future crashes.
@susannasiebert
Copy link
Copy Markdown
Contributor

susannasiebert commented Mar 18, 2026

find_optimal_path should only be called if check_graph_valid returns True for its first return value, as you can see in main method. If anything the case that you are trying to test here should result in a fatal error at the beginning of find_optimal_path as this method should only be called if the graph contains nodes for all desired peptides. So something like:

if sorted(list(graph.nodes())) != sorted(list(seq_dict.keys()))
  raise Exception("Graph doesn't contain nodes for all peptides")

Make find_optimal_path fail fast when called with an invalid graph and update the regression test to assert the expected exception for out-of-contract invocation.
@maksimf maksimf changed the title Fix pVACvector crash for single-peptide no-edge paths Enforce pVACvector pathfinder preconditions Mar 18, 2026
@maksimf
Copy link
Copy Markdown
Author

maksimf commented Mar 19, 2026

@susannasiebert Thank you Susanna, is this better?

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