Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[query/plot] removes "chr" prefix for manhattan plot x-axis labels #13966

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

iris-garden
Copy link
Contributor

Fixes #13952.

@iris-garden iris-garden added the WIP label Nov 2, 2023
@@ -1573,7 +1573,7 @@ def manhattan(pvals: 'Float64Expression',
source_pd['_contig'] = [locus.split(":")[0] for locus in source_pd['locus']]

observed_contigs = [
contig for contig in ref.contigs.copy()
contig.replace("chr", "") for contig in ref.contigs.copy()
if contig in set(source_pd['_contig'])
]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this next line is gonna fail b/c the contains aren't valid anymore. I think you'll have to replace this at the very latest moment: when you construct the major_label_overrides.

@iris-garden
Copy link
Contributor Author

tested the latest version of the change by copying and running the plotting tutorial notebook; verified that the code as is generates a visually identical manhattan plot, and then added this line before the manhattan plot is displayed:

gwas = gwas.key_by(locus = hl.locus("chr" + gwas.locus.contig, hl.int(gwas.locus.position / 2), reference_genome="GRCh38"))

and the output looked like this (the big gaps between the points for each chromosome come from dividing by 2 above, which is a quick-and-dirty trick to make sure none of the loci have position values that are too large for GRCh38):

Screenshot 2023-11-03 at 15 01 17

danking
danking previously requested changes Nov 6, 2023
Copy link
Contributor

@danking danking left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you have unpushed changes?

This fails:

In [4]: gwas = hl.balding_nichols_model(1,100, 1, reference_genome='GRCh38').rows().annotate(p_value=10 **
   ...: -hl.rand_int32(1, 8))
   ...: hl.plot.manhattan(gwas.p_value, gwas.locus).show()

@iris-garden iris-garden force-pushed the query/plot/manhattan-axis branch 2 times, most recently from b9135a9 to ad26447 Compare November 7, 2023 23:39
@iris-garden
Copy link
Contributor Author

@danking oh yep, sorry! github was down but it said the changes had pushed from the command line, now it's fixed

@iris-garden iris-garden removed the WIP label Nov 8, 2023
@danking danking merged commit a3252d6 into hail-is:main Nov 21, 2023
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[query] In GRCh38, the Manhattan plot x axis is unreadable
2 participants