Fixed two critical bugs in get_joint_graph#44
Conversation
1.) When clustering two repertoires with two chains, CDR3b edges between-repertoire got deleted due to typo in helper function get_ix() 2.) Duplicated edges removal with which_multiple removed also the CDR3b edge of double edges between-repertoire clones - added test-multi-chain-clustering to testthat
|
Caution Review failedThe pull request is closed. WalkthroughBug fixes are applied to graph processing functions handling multi-chain CDR3 clustering, alongside new test cases validating the corrections and updates to release notes documenting the issues. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@R/graph.R`:
- Around line 224-232: The deduplication step using duplicated() misses reversed
pairs (A,B vs B,A) when knn=TRUE; normalize edge direction before deduplication
by creating ordered endpoints (e.g., v1 = pmin(from, to), v2 = pmax(from, to)),
use those columns (plus "chain" if present) to remove duplicates from df_e, then
drop the temporary columns before calling graph_from_data_frame; update the
block that references df_e and duplicated() and ensure compatibility with
get_ix/knn behavior.
I don't get this point. Please explain in more detail. At the end of the graph joining we want to have a single edge (per chain) between two nodes. No? |
This is a good point! |
Yes, one edge per connected chain. What I noticed (and wanted to say) is: I noticed this because the tests I wrote still failed for this case after the 1. point was corrected (see tests/testthat/test-multi-chain-clustering.R) |
1.) When clustering two repertoires with two chains, CDR3b edges between-repertoire got deleted due to typo in helper function get_ix()
2.) Duplicated edges removal with which_multiple removed also the CDR3b edge of double edges between-repertoire clones
Also, added test-multi-chain-clustering to testthat
Summary by CodeRabbit
Bug Fixes
Tests