Skip to content

Fix figure build failures (M2, M3, M4, MS7) - #550

Merged
aarmey merged 1 commit into
mainfrom
fix/figure-build-errors
Aug 21, 2026
Merged

Fix figure build failures (M2, M3, M4, MS7)#550
aarmey merged 1 commit into
mainfrom
fix/figure-build-errors

Conversation

@aarmey

@aarmey aarmey commented Aug 21, 2026

Copy link
Copy Markdown
Member

Summary

  • Move the fancyimpute/scikit-learn check_array compat patch from clustering.py into ddmc/__init__.py. figureM2.py imported fancyimpute before ..clustering, so the patch that swaps force_all_finite for ensure_all_finite (removed in scikit-learn 1.9) was applied too late, and IterativeSVD.fit_transform crashed with TypeError. Package __init__.py always runs before any submodule's own imports, so the fix is now import-order independent.
  • Fix get_pssms(clusters=...) misuse in figureM3.py / figureMS7.py: both stripped the cluster axis with a trailing [0], which caused plot_cluster_kinase_distances in common.py to misread the pssm array, pick the wrong "most frequent phosphoacceptor" (falling back to 'A'), filter out all candidate kinases, and crash with an out-of-bounds IndexError. Removed the erroneous [0] and corrected the corresponding indexing in common.py to pssms[i, :, 5] (position-5 column across amino acids).
  • Coerce X/y to ndarrays at the top of plot_roc in logistic_regression.py so positional CV-fold indexing (X[train]) works whether the caller passes an ndarray or a pandas Series with a non-integer index — figureM4.py passed a Series and newer pandas raises KeyError instead of silently falling back to positional indexing.

Test plan

  • uv run fbuild <name> succeeds for all 11 figures: M2, M3, M4, M5, M6, M7, MS2, MS3, MS4, MS5, MS7
  • uv run pytest -q — 21 passed
  • uv run ruff check ddmc / uv run ruff format --check clean on touched files
  • uv run ty check ddmc passes

🤖 Generated with Claude Code

https://claude.ai/code/session_014sHWCv3yz7DGDVDKra9KUo

- Move the fancyimpute/scikit-learn check_array compat patch from
  clustering.py into ddmc/__init__.py, which always runs before any
  submodule's own imports. figureM2.py imported fancyimpute before
  ..clustering, so the patch was applied too late and IterativeSVD
  crashed with TypeError: unexpected keyword 'force_all_finite'.
- Fix get_pssms(clusters=...) misuse in figureM3.py/figureMS7.py: both
  stripped the cluster axis with a trailing [0], causing
  plot_cluster_kinase_distances to silently pick the wrong
  phosphoacceptor and then crash with an out-of-bounds IndexError.
  Correct the corresponding indexing in common.py to select down the
  position-5 column across amino acids.
- Coerce X/y to ndarrays in plot_roc so positional CV-fold indexing
  works regardless of whether the caller passes a pandas Series with a
  non-integer index (figureM4 crashed with a pandas KeyError under
  newer pandas).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014sHWCv3yz7DGDVDKra9KUo
@aarmey
aarmey merged commit 807e6e9 into main Aug 21, 2026
0 of 2 checks passed
@aarmey
aarmey deleted the fix/figure-build-errors branch August 21, 2026 16:03
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.

1 participant