feat: add generic Manhattan/QQ plotting helpers for association results#1017
feat: add generic Manhattan/QQ plotting helpers for association results#1017Sharon-codes wants to merge 10 commits into
Conversation
|
@jonbrenas Hey please look into this , i hope this addresses your question also which was there in the comment of the issue , if you need me to add anything do let me or else please check and allow it , thanks alot !!! |
|
Thanks @Sharon-codes! I don't think calling the module containing the code for the Manhattan and QQ plots 'phenotypes' makes a lot of sense (but feel free to prove me wrong). I don't think there is (currently) any function that would generate the type of input that these functions need, which reduces their usefulness quite significantly. It would also be great if the tests followed the same general approach that is used for other modules. |
- move generic plotting helpers out of anoph/phenotypes.py into anoph/association.py\n- add snp_phenotype_association() and association_results() to generate plot-ready inputs\n- wire new mixin into AnophelesDataResource\n- replace tests/anoph/test_phenotypes_plotting.py with tests/anoph/test_association.py
|
Thanks @jonbrenas — I’ve reworked this based on your comments. (totally agreed on your comment, lol wont be able to prove you wrong) Changes made:
Please review commit 148c84c. |
|
hey @jonbrenas please accept this pr , thanks !!! |
|
Thanks @Sharon-codes. This looks great! Could you create a short notebook (with dummy phenotypic data as we are short on real data) showing how the functions are used, what the plots look like, ... |
|
@jonbrenas Heyyyy added , please check !! Thanks for the input and close the PR if happy with the new file !! |
|
Heyy @jonbrenas If everything is as per your liking , please close this PR thanksss |
|
Heyyy @jonbrenas added all the changes as you asked , if all good , please accept and close the PR , thanksss !! |
|
Heyyy @jonbrenas I have created the notebook as requested , please check and if all good , close the PR , thanksss !! |
|
Thanks @Sharon-codes. Would it be possible to create the phenotypic data as part of |
|
Heyyyy @jonbrenas Implemented this in commit f72b8c6.
This keeps the association tests aligned with the existing anoph test structure. If this sounds good , please merge and close the PR !! |
|
heyyy @jonbrenas i have added the changes you asked for , if everything seems good , please close the PR , thanksss !! |
|
Heyy @jonbrenas if all good , please accept it , thanks |
| self, | ||
| data: xr.Dataset, | ||
| *, | ||
| genotype_col: str = "call_genotype", |
There was a problem hiding this comment.
Quite a few of these should be defined as params in a separate file for consistency, maybe base_params.field is enough.
Summary
Adds Manhattan and QQ plotting helpers to the API for association-style results, designed to work directly in Python workflows (including GWAS notebooks) without requiring R or Dash-specific tooling.
Design choices (addressing issue discussion)
pandas.DataFrame(e.g. PLINK-exported tables loaded in pandas)xarray.Dataset(aligned with sgkit-style workflows)Changes
malariagen_data/anoph/phenotypes.pyplot_manhattan(...)plot_qq(...)contig_order,contig_spacing, and threshold line.tests/anoph/test_phenotypes_plotting.pyValidation
poetry run pytest tests/anoph/test_phenotypes_plotting.py -q(5 passed)poetry run mypy malariagen_data/anoph/phenotypes.py tests/anoph/test_phenotypes_plotting.py --ignore-missing-importspoetry run ruff check malariagen_data/anoph/phenotypes.py tests/anoph/test_phenotypes_plotting.pyCloses #772