totajuliusd / topr

topr is a collection of plotting functions for visualizing and exploring genetic association results. Association results from multiple phenotypes can be viewed simultaneously, over the entire genome (Manhattan plot) or in the more detailed regional view.
Other
45 stars 13 forks source link

SNPs points can not fill the whole plot (I am plotting rice not human data) #26

Closed qj009 closed 1 year ago

qj009 commented 1 year ago

Hello, I am plotting rice data and data points can not fill the whole plot. It contains a big empty gap between chromsomes. When I plot one chromsome, it looks ok. But It does not show legend for multiple phenotypes.

totajuliusd commented 1 year ago

Hi, this is most likely because you are plotting rice data. The manhattan plot assumes there are 22 or 23 chromosomes of a certain length in the input datasets.

This however does not explain why it doesnt show a legend for multiple phenotypes. Can you please show me the command you are using to call the manhattan plot function and a screenshot of your plot?

qj009 commented 1 year ago

Hi, it can plot 12 chrosome. It just contain big gap between chrosomes, like the picture attached below. The code is: manhattan(list(hap_plot, hapi_plot,snp), legend_labels = c("pheno1", "pheno2","pheno3"),sign_thresh = 5e-06)

Screen Shot 2023-09-07 at 9 35 27 AM

Besides, it can not show the legend when I only plot one chromsome. And one chromsome plot looks ok to me since it can fill the whole plot. code: manhattan(list(hap_plot, hapi_plot,snp), legend_labels = c("pheno1", "pheno2","pheno3"),sign_thresh = 5e-06, chr="chr12")

Screen Shot 2023-09-07 at 9 41 34 AM
totajuliusd commented 1 year ago

The gaps on the Manhattan plot are there because the human chromosomes are larger than the rice chromosomes. There is a relatively easy fix to this which I will implement in topr version 1.1.10.

The missing legend when plotting one chromosome only, is a bug introduced in version 1.1.9. This will be fixed in version 1.1.10 as well. Until then, you can add the use_shades argument as a temporary fix:

manhattan(list(hap_plot, hapi_plot,snp), legend_labels = c("pheno1", "pheno2","pheno3"),sign_thresh = 5e-06, chr="chr12", use_shades=T)

I will let you know when version 1.1.10 is released - it should be within the next couple of days, or at the weekend.

qj009 commented 1 year ago

Sounds great! I am looking forward to it!

totajuliusd commented 1 year ago

Hi again,

topr_v.1.1.10 is now available from CRAN. Now you can make Manhattan plots from datasets with varying number of chromosomes and chromosome lengths by including the argument get_chr_lengths_from_data = T in your manhattan function call.

Example: > manhattan(CD_UKBB %>% filter(POS < 80000000))

image

Example of how to plot without the gaps: > manhattan(CD_UKBB %>% filter(POS < 80000000), get_chr_lengths_from_data = T)

image

Please let me know if something doesnt work as expected!

qj009 commented 1 year ago

Hello, it works perfectly! Thank you!