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

Mark target SNP in locuszoomplot #86

Closed paulandroide closed 3 months ago

paulandroide commented 3 months ago

Hi! I like topr a lot and hopefully will be using it in future manuscrips!

Right now I am struggling with locuszoom, because as many SNPs besides my "target" are in perfect LD with this target, they all appear as purple triangles, which makes more difficult to see which one is the SNP where LD is being calculated. Is there a way to mark the variant of interest somehow so it has another shape or something similar?

My lines: locuszoom(snps.ld, annotate = 1e-8,
rsids = "rs1052553", variant= "rs1052553", rsids_with_vline = "rs1052553", protein_coding_only = TRUE, show_overview = TRUE, show_genes = FALSE, show_gene_legend = FALSE, title = "LD with SNP rs1052553")

Screen Shot 2024-06-19 at 16 25 57

Thanks a lot!

totajuliusd commented 3 months ago

Hi and thank you for submitting this problem.

You cant specifically change the shape of the variant of interest, but you can display it with a different size or transparency if you provide it as a separate dataframe to the locuszoom plot. For example:

#extract the top snp
top_snp <- R2_CD_UKBB %>% filter(ID == "rs11576518")

#create a list containing your data and the top snp 
dat <- list(R2_CD_UKBB,top_snp)

# create the plot
locuszoom(dat, 
annotate=c(1e-100, 1e-08), 
size=c(1.5,  3),  
alpha=c(0.5, 1) , 
nudge_y=2, 
ymax=22, 
show_legend = F, 
show_gene_legend = F)

In the above code, I set annotate to 1e-100 for variants in the first dataframe so nothing gets annotated there. I then set the size to 1.5 for variants in the first dataframe and the size of the top variant to 3. I set alpha to 0.5 and 1 to set different transparencies. I then set nudge_y to 2 to create a line between the top variant and its label.

I hope that helps.

image

paulandroide commented 3 months ago

Thanks a lot! This is very helpful.