Fix slide_cells edge cases in region_extract (#60) - #61
Merged
Conversation
Two edge-case bugs in scf.tl.slide_cells reported in #60: 1. When the first principal point already exceeds the window, inds[0] is 0 and the pps_region slice [:0] returns an empty window, producing a NaN pt_cur that breaks the recursion. Keep at least that point. 2. In the two-branch case, a branch may run out of cells for the current pseudotime, making its pt_cur NaN and crashing the recursive call. Only recurse into branches that still have cells to extract. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0152pVAvAhGXQuWepi4YbWYn
Newer pandas makes pd.Series(dtype=str) a strict StringDtype that rejects the integer milestone ids assigned to it, breaking test_pipeline. Use dtype=object (values are cast to str later anyway). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…rogram Assign str(pos_idx) instead of int into the string-typed seg_pos column; it is cast back to int right after. Fixes test_pipeline under newer pandas. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- milestones plot: drop removed dtype kwarg from sc.AnnData() - get_activation: use label access (x["start"]/x["end"]) instead of positional x[0]/x[1], which no longer falls back on a labeled Series - slide_cors: fill diagonal on a writable numpy copy since DataFrame.values is now read-only Reproduced against a fresh env (pandas 3.0.3, anndata 0.13.1); full test suite passes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #61 +/- ##
==========================================
- Coverage 80.75% 80.73% -0.02%
==========================================
Files 40 40
Lines 4078 4085 +7
Branches 512 514 +2
==========================================
+ Hits 3293 3298 +5
Misses 529 529
- Partials 256 258 +2
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two edge-case bugs in scf.tl.slide_cells reported in #60:
When the first principal point already exceeds the window, inds[0]
is 0 and the pps_region slice [:0] returns an empty window, producing
a NaN pt_cur that breaks the recursion. Keep at least that point.
In the two-branch case, a branch may run out of cells for the current
pseudotime, making its pt_cur NaN and crashing the recursive call.
Only recurse into branches that still have cells to extract.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_0152pVAvAhGXQuWepi4YbWYn