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

Color GWAS peaks #21

Closed bridgetrileygillis closed 1 year ago

bridgetrileygillis commented 1 year ago

Hello, Is it possible to color specified peaks (ex. novel loci) in a different color in topr manhattanplot? For example, I have 8 novel loci detected in a meta-analysis and would like to highlight those peaks, similar to this example (one highlight color is sufficient):

Screen Shot 2023-08-28 at 5 20 47 PM

Additionally, can I specify to only label the nearest genes for the 8 novel loci, instead of all peaks p < 5e-08?

totajuliusd commented 1 year ago

Hi, yes you can do this by passing your peaks as an additional dataframe to the manhattan function. So for example, this can be done using the inbuilt CD_UKBB dataset as follows:

#start by annotating the variants with their nearest gene CD_ANNOT <- CD_UKBB %>% annotate_with_nearest_gene() #extract variants of interest from the dataset based on their nearest gene annotation. genes <- CD_ANNOT %>% filter(Gene_Symbol %in% c("TTC33", "JAK2", "NOD2", "NKD1")

#Now create the plot with your input dataset and the extracted variants (genes) - display them in red and annotate peaks with p<1e-8 manhattan(list(CD_UKBB, genes), color=c("grey","red"), annotate=c(1e-100, 1e-8), legend_labels=c("Crohn's Disease", "Novel loci"), shades_alpha = 0.35)

This will result in a plot like this:

image

Is this what you were after?

bridgetrileygillis commented 1 year ago

Yes, thank you for the code and guidance!