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

saving plots #15

Closed zhannabalkhiyarova closed 1 year ago

zhannabalkhiyarova commented 1 year ago

Hi,

How you recommend to save the Manhattan plots? pdf("..") dev.off() method is too slow.

Many thanks, Zhanna

zhannabalkhiyarova commented 1 year ago

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

totajuliusd commented 1 year ago

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

zhannabalkhiyarova commented 1 year ago

Dear Tota,

Please see attached one of my plots. rs7663362 located on chromosome 2 (position 620297).

Best regards, Zhanna

On Sat, 26 Aug 2023 at 18:50, totajuliusd @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/totajuliusd/topr/issues/15#issuecomment-1694422082, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4ZAVYBLTYRVRYCQF7HJJ7LXXIZMRANCNFSM6AAAAAA22UJ2YU . You are receiving this because you authored the thread.Message ID: @.***>

totajuliusd commented 1 year ago

Dear Zhanna,

I cant see the attached plot. Can you please re-send?

Bw, Tota

On Mon, 28 Aug 2023 at 13:34, zhannabalkhiyarova @.***> wrote:

Dear Tota,

Please see attached one of my plots. rs7663362 located on chromosome 2 (position 620297).

Best regards, Zhanna

On Sat, 26 Aug 2023 at 18:50, totajuliusd @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/totajuliusd/topr/issues/15#issuecomment-1694422082,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/A4ZAVYBLTYRVRYCQF7HJJ7LXXIZMRANCNFSM6AAAAAA22UJ2YU>

. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/totajuliusd/topr/issues/15#issuecomment-1695711602, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZMXPZRULFFCNVHD3ZBXHFDXXSM5DANCNFSM6AAAAAA22UJ2YU . You are receiving this because you commented.Message ID: @.***>

zhannabalkhiyarova commented 1 year ago

Hi Tota,

I hope this time you receive the attachment. Is there a flag to highlight the locus with different colours?

Many thanks, Zhanna

On Mon, 28 Aug 2023 at 15:35, totajuliusd @.***> wrote:

Dear Zhanna,

I cant see the attached plot. Can you please re-send?

Bw, Tota

On Mon, 28 Aug 2023 at 13:34, zhannabalkhiyarova @.***> wrote:

Dear Tota,

Please see attached one of my plots. rs7663362 located on chromosome 2 (position 620297).

Best regards, Zhanna

On Sat, 26 Aug 2023 at 18:50, totajuliusd @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/totajuliusd/topr/issues/15#issuecomment-1694422082,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/A4ZAVYBLTYRVRYCQF7HJJ7LXXIZMRANCNFSM6AAAAAA22UJ2YU>

. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/totajuliusd/topr/issues/15#issuecomment-1695711602,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/AZMXPZRULFFCNVHD3ZBXHFDXXSM5DANCNFSM6AAAAAA22UJ2YU>

. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/totajuliusd/topr/issues/15#issuecomment-1695813910, or unsubscribe https://github.com/notifications/unsubscribe-auth/A4ZAVYDARHCG3JO3RGIQVNDXXSUC7ANCNFSM6AAAAAA22UJ2YU . You are receiving this because you authored the thread.Message ID: @.***>

totajuliusd commented 1 year ago

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.

totajuliusd commented 1 year ago

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