Fix figure build failures (M2, M3, M4, MS7) - #550
Merged
Conversation
- 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
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.
Summary
check_arraycompat patch fromclustering.pyintoddmc/__init__.py.figureM2.pyimportedfancyimputebefore..clustering, so the patch that swapsforce_all_finiteforensure_all_finite(removed in scikit-learn 1.9) was applied too late, andIterativeSVD.fit_transformcrashed withTypeError. Package__init__.pyalways runs before any submodule's own imports, so the fix is now import-order independent.get_pssms(clusters=...)misuse infigureM3.py/figureMS7.py: both stripped the cluster axis with a trailing[0], which causedplot_cluster_kinase_distancesincommon.pyto 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-boundsIndexError. Removed the erroneous[0]and corrected the corresponding indexing incommon.pytopssms[i, :, 5](position-5 column across amino acids).X/yto ndarrays at the top ofplot_rocinlogistic_regression.pyso positional CV-fold indexing (X[train]) works whether the caller passes an ndarray or a pandasSerieswith a non-integer index —figureM4.pypassed aSeriesand newer pandas raisesKeyErrorinstead 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, MS7uv run pytest -q— 21 passeduv run ruff check ddmc/uv run ruff format --checkclean on touched filesuv run ty check ddmcpasses🤖 Generated with Claude Code
https://claude.ai/code/session_014sHWCv3yz7DGDVDKra9KUo