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

Region plot 'a' in the legend plot #58

Closed karpat90 closed 6 months ago

karpat90 commented 6 months ago

Hello!

Thank you for a great package!

When I am using region_plot(), if the second dataset has no genome-wide significant hits, a red 'a' appears in the plot legend.

Could you help me with this

Thank you

totajuliusd commented 6 months ago

Hello,

Can you please show me the command you are using and maybe a screenshot of the plot? I tried to reproduce this using the test data, but everything looks ok when I do:

regionplot(list(CD_UKBB, UC_UKBB %>% dplyr::filter(P>1e-5)), gene="IL23R")

Tota

karpat90 commented 6 months ago

I have used this command

regionplot(list(df2,df), region="chr6:106053916-107309327", sign_thresh = 0.01, annotate_with_vline = 5e-03, build = 37, legend_labels = c("ph1", "ph2"), protein_coding_only = TRUE, tst legend_text_size = 15, axis_text_size = 15, axis_title_size = 15, label_size = 4)

totajuliusd commented 6 months ago

Hmmm... that is odd, and something I havent seen before.

What happens if you do:

regionplot(list(df2%>% select(CHROM,POS,P) %>% na.omit(),df %>% select(CHROM,POS,P) %>% na.omit()), region="chr6:106053916-107309327",
         sign_thresh = 0.01,
         annotate_with_vline = 5e-03, build = 37,
         legend_labels = c("ph1", "ph2"),
          protein_coding_only = TRUE,legend_text_size = 15, axis_text_size = 15, axis_title_size = 15, label_size = 4)
karpat90 commented 6 months ago

It's still produces the same figure with 'a'

totajuliusd commented 6 months ago

What happens if you replace your dataframes with the test data?

regionplot(list(CD_UKBB,CD_FINNGEN), region="chr6:106053916-107309327",
         sign_thresh = 0.01,
         annotate_with_vline = 5e-03, build = 37,
         legend_labels = c("ph1", "ph2"),
          protein_coding_only = TRUE,legend_text_size = 15, axis_text_size = 15, axis_title_size = 15, label_size = 4)

And which version of topr are you using?

karpat90 commented 6 months ago

tst2 When I use the command you have suggested I also get plot with NA

totajuliusd commented 6 months ago

Which version of topr are you using? You can use sessionInfo()or ?toprto see the version.

karpat90 commented 6 months ago

I am using topr_2.0.0

totajuliusd commented 6 months ago

Which version of ggplot2 are you using? It looks fine for me and Im using ggplot2_3.4.4. Can you show me the output from the sessionInfo() command?

karpat90 commented 6 months ago

I am using ggplot2_3.5.0, the latest one

totajuliusd commented 6 months ago

That is strange - wich operating system are you on?

karpat90 commented 6 months ago

I ma using Mac

totajuliusd commented 6 months ago

I get the same error after upgrading ggplot2 to version 3.5.0. So this is an error that comes with using the most recent version of ggplot2 with topr, and something I need to fix asap.

Until then, you can use topr with an older ggplot version, by doing for example:

install.packages(" http://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_3.4.4.tar.gz", repos=NULL, type="source")

Thank you for bringing this to my attention!

karpat90 commented 6 months ago

Unfortunately, when I use ggplot2 version you have suggested, I get 'a' strings elsewhere: New test

totajuliusd commented 6 months ago

Can you move the legend tvo the right by adding this argument:

legend_position=“right”

Im not sure what is causing this and going to have to look into this properly, but wont have time to do it until later this week.

totajuliusd commented 6 months ago

Hi again, The code causing the problem has been identified and fixed in topr v2.0.1 which will be submitted to CRAN today, so it should become publicly available within the next few days!

totajuliusd commented 6 months ago

topr v2.0.1 is now available on CRAN and downloadable via install.packages