Feat: add interactive map to plasmodium#1177
Open
Kaustubh2k5 wants to merge 5 commits intomalariagen:masterfrom
Open
Feat: add interactive map to plasmodium#1177Kaustubh2k5 wants to merge 5 commits intomalariagen:masterfrom
Kaustubh2k5 wants to merge 5 commits intomalariagen:masterfrom
Conversation
Author
|
this feature brings the plasmodium APIs more inline with the core mosquito related ones. |
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.
Add plot_samples_interactive_map() to plasmodium API
What problem does this solve?
The plasmodium APIs (Pf8, Pf7, Pv4) had no inbuilt way to visualise sample collection locations. Users had to manually write matplotlib/cartopy code in notebooks to produce a static map. The mosquito API (Ag3, Af1, etc.) has had plot_samples_interactive_map() for some time. so i added a feature in plasmodium class to be able to plot maps
How does it solve it?
Two changes to PlasmodiumDataResource in plasmodium.py:
Coordinates are GADM admin level 1 centroids (Admin level 1 latitude/longitude) rather than per-sample coordinates, since plasmodium metadata has no finer granularity
count_by defaults to "Population" instead of "taxon"
Tooltip includes an explicit Total samples count (improvement over mosquito version)
Since all three parasite classes inherit directly from PlasmodiumDataResource with no overrides, both methods are immediately available on Pf8, Pf7, and Pv4.
Testing done
Tested on Pf8:
sample_query="QC pass== True"filters correctly, reduces marker countsample_query="Country == 'Ghana'"shows single-country viewsample_metadata()returns full dataset after a filtered callcount_by="Year"produces correct year-breakdown tooltipsmin_samplesthreshold correctly suppresses low-count locationsIssues closed:
#1175