Fix deprecated Plotly API calls in anoph (Mapbox and Trace methods)#889
Open
NgangaKamau3 wants to merge 2 commits intomalariagen:masterfrom
Open
Fix deprecated Plotly API calls in anoph (Mapbox and Trace methods)#889NgangaKamau3 wants to merge 2 commits intomalariagen:masterfrom
NgangaKamau3 wants to merge 2 commits intomalariagen:masterfrom
Conversation
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.
Description
This PR resolves the DeprecationWarning failures currently blocking the anoph test suite under recent Plotly versions. By migrating to the modern Plotly API, this PR keeps the test suite to a stable state while ensuring compliance with upcoming library removals.
Changes
API Migration (scatter_mapbox → scatter_map): Updated visualization calls in malariagen_data/anoph/sample_metadata.py.
Trace Handling (append_trace → add_trace): Migrated trace addition logic in dipclust.py to resolve deprecated warnings in test_dipclust.py.
if isinstance(figure, go.Figure): # This is a figure, access the traces within it. for trace in range(len(figure["data"])): - fig.append_trace(figure["data"][trace], row=i + 1, col=1) + fig.add_trace(figure["data"][trace], row=i + 1, col=1) else: # Assume this is a trace, add directly. - fig.append_trace(figure, row=i + 1, col=1) + fig.add_trace(figure, row=i + 1, col=1)Impact
Fixes deprecation warnings in test_dipclust.py and other visualization-dependent tests.
Future-proofs the codebase against Plotly 6.0+ removals.
No breaking changes to underlying data processing logic.
All existing local tests pass (873 total).
Legacy Tests: Pending validation via GitHub Actions CI due to remote data dependencies.