Skip to content

Fix slide_cells edge cases in region_extract (#60) - #61

Merged
LouisFaure merged 4 commits into
masterfrom
claude/latest-issue-assessment-xpd6g3
Jul 9, 2026
Merged

Fix slide_cells edge cases in region_extract (#60)#61
LouisFaure merged 4 commits into
masterfrom
claude/latest-issue-assessment-xpd6g3

Conversation

@LouisFaure

Copy link
Copy Markdown
Owner

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

claude and others added 4 commits July 9, 2026 14:56
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

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.73%. Comparing base (c4c9f88) to head (f40e388).

Files with missing lines Patch % Lines
scFates/tools/slide_cors.py 83.33% 0 Missing and 2 partials ⚠️
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     
Files with missing lines Coverage Δ
scFates/plot/milestones.py 80.43% <ø> (ø)
scFates/tools/bifurcation_tools.py 93.00% <ø> (ø)
scFates/tools/dendrogram.py 91.41% <100.00%> (ø)
scFates/tools/pseudotime.py 76.66% <100.00%> (ø)
scFates/tools/slide_cors.py 85.53% <83.33%> (-0.65%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@LouisFaure
LouisFaure merged commit dab4e45 into master Jul 9, 2026
4 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