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
46 stars 13 forks source link

Missing R2 values #61

Closed frahimov closed 3 months ago

frahimov commented 6 months ago

Hi Thorhildur, Thank you for the R package. This is really nice! When I run the locuszoom function I get this message "removed 74 rows containing missing values (geom_point())". Does this mean SNPs with no r2 data are excluded from the plot? I intentionally kept "NA" in the R2 column so I can plot SNPs with no LD information. I would like to keep them in the plot, but in a gray color. Is there an argument for that?

I guess, I am talking about something like this

set_lz_colors <- function(dat){ for(i in seq_along(dat)){ df <- dat[[i]] df$color <- "darkblue" df$color <- ifelse(df$R2 == 1, "purple", df$color) df$color <- ifelse(df$R2 != 1 & df$R2 > 0.8, "red", df$color) df$color <- ifelse(df$R2 < 0.8 & df$R2 > 0.6, "orange", df$color) df$color <- ifelse(df$R2 < 0.6 & df$R2 > 0.4, "green", df$color) df$color <- ifelse(df$R2 < 0.4 & df$R2 > 0.2, "turquoise", df$color) df$color <- ifelse(is.na(df$R2), "darkgrey", df$color) dat[[i]] <- df } return(dat) }

The rationale is that you may accidentally exclude an independent, genome-wide significant variant with no LD information with the lead SNP.

totajuliusd commented 6 months ago

Thank you for your message!

You are right, markers missing r2 values are excluded from the plot. I agree that it would be nice and make more sense to keep them in the plot in a gray color. Unfortunately there is no argument for that at the moment, but I will fix this in the next topr release.

mvab commented 5 months ago

Hi @totajuliusd , just wanted to second that this functionality is much needed!

totajuliusd commented 3 months ago

This functionality has been added to the latest topr release (v 2.0.2)