Fix API naming/consistency quirks in Flow and Fit - #4
Merged
Merged
Conversation
Standardizes coords -> coordinates across distances.py and graph_construction.py, lets Flow accept plain arrays/Series (not just DataFrame/named-Series) for scores and distances, de-duplicates the fit-failure bookkeeping shared by the three saturation Fit subclasses, fixes _calculate_fraction_not_converged's missing return values, and renames Flow.flow()'s `measures` parameter to `score_names` so it stops being conflated with compute_centrality_measures's fixed centrality vocabulary (it actually accepts arbitrary score-column names). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Merged
2 tasks
Merged
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
coords->coordinatesacrossdistances.py/graph_construction.pyFlownow accepts plain arrays/pd.Seriesforscores/distances, not onlyDataFrame/named-SeriesFitsubclasses via a newFit._finalize_fit()_calculate_fraction_not_converged's missingreturn(previously always returnedNonedespite its-> floatannotation)Flow.flow()'smeasuresparameter toscore_names, since it accepts arbitrary score-column names (e.g.log1p_total_counts, gene names), not the fixed centrality vocabulary thatcompute_centrality_measurescorrectly callsmeasuresCLAUDE.mdclaims (networkx fallback, missingdistance_to_alpha_shapeentry)Test plan
pytest tests/— 111 passed, 1 skippedFlow.from_distances_and_scoreswith plainnp.ndarrayscores/distancesmeasures=keyword now correctly raisesTypeErroronFlow.flow()Note: no consuming code outside this repo passes
coords=/measures=as keywords for the renamed functions (verified via grep acrosstruncated_graphs); the one exception,Flow.flow(measures=...), is being updated in a companion PR ontruncated_graphs.🤖 Generated with Claude Code