saving plots
zhannabalkhiyarova opened this issue · 7 comments
Hi,
How you recommend to save the Manhattan plots? pdf("..") dev.off() method is too slow.
Many thanks,
Zhanna
Hi Tota,
I have an issue with the chromosome colors. When a locus, such as TMEM18, is located at the start of chromosome 2, it appears to be partially colored as chromosome 1 and partially as chromosome 2.
Do you have any suggestions on how to resolve this? Additionally, could you please provide the default names for the light and dark blue colors used in the visualisation?
Many thanks,
Zhanna
HIi Zhanna,
Can you please send me a screenshot of your plot? Can you also tell me what the position of the last variant on chr1 in your dataset is? And the first one on chr2?
Regarding the colors, you can see the colors used in topr by running:
topr::get_topr_colors()
[1] "darkblue" "#E69F00" "#00AFBB" "#999999" "#FC4E07" "darkorange1" "darkgreen"
[8] "blue" "red" "magenta" "skyblue" "grey40" "grey60" "yellow"
[15] "black" "purple" "orange" "pink" "green" "cyan"
So for the dark blue color, the color name "darkblue" is used and the lighter blue is the same colour with a white-coloured semi-transparent shade/rectangle on top of it which makes it appear light blue. You can see this by altering the transparency/color of the rectangles using the shades_alpha (the default value is 0.5) and shades_color (the default is "white") arguments:
For example, try this to see the effect:
manhattan(CD_UKBB, shades_alpha = 0.2)
manhattan(CD_UKBB, shades_alpha = 0.8)
manhattan(CD_UKBB, shades_alpha = 0.1, shades_color = "black")
Bw,
Tota
Thank you. I can see the problem and what is causing it. Unfortunately I do not have a quick fix for this, but will work on getting this fixed as soon as possible. Hopefully within a week or so.
Regarding your question about flagging a locus in different colors, you can do that as follows:
snp <- data.frame(CHROM="chr2", POS=620297, ID="rs7663362", P=1e-12, gene="TMEM18")
manhattan(list(CD_UKBB,snp), color=c("darkblue", "red"), annotate = c(1e-100, 1e-9),size=c(1,2))
Note that Im using the size argument to make the datapoint representing the snp larger than the other datapoints.
In this example the snp dataframe only contains one snp, but it can contain as many as you like. Please see my answer to the latest issue Color GWAS peaks posted by Bridget.
Hi again, the problem with the chromosome colors has been fixed in the latest release of topr (version 1.1.9) available from CRAN.
Also regarding flagging locus in different colors, see how-to-color-specific-peaks-on-the-manhattan-plot and use-the-same-color-of-red-and-blue-for-all-the-peaks