manhattan plot for different colorw
1
0
Entering edit mode
3.1 years ago
mag ▴ 20

Hi everyone,

I try to draw a Manhattan plot via the R programming language, but every chromosome has two different colors. Look at the example below, input, and expected output, please.

# this is just an example of manhattan plot

library(qqman)

manhattan(gwasResults, chr="CHR", bp="BP", snp="SNP", p="P" )


# this is my data set looks like

     SNP CHR  BP            P   SNP CHR  BP           P
1     rs1   1   1 0.9148060435 rs751   1 751 0.244920995
2     rs2   1   2 0.9370754133 rs752   1 752 0.087635909
3     rs3   1   3 0.2861395348 rs753   1 753 0.391108497
4     rs4   1   4 0.8304476261 rs754   1 754 0.182561425
5     rs5   1   5 0.6417455189 rs755   1 755 0.133624785
6     rs6   1   6 0.5190959491 rs756   1 756 0.257462913
7     rs7   1   7 0.7365883146 rs757   1 757 0.553247048


and the expected output will be

genome R • 1.5k views
0
Entering edit mode

I will appreciate for any comment

0
Entering edit mode

I don't know much about qqman, but this is strange, I think. Are there also squares and circles? or is it an effect of image compression? In any case, if you want to use another package to plot the manhattan, you can take a look at the karyoploteR tutorial on how to plot manhattan plots ([https://bernatgel.github.io/karyoploter_tutorial//Tutorial/PlotManhattan/PlotManhattan.html]). It is quite flexible regarding colors, shapes, etc... and you can include other data types (genes, for example) to the plot.

0
Entering edit mode
3.1 years ago
Corentin ▴ 550

Hi Mag,

If you look at the "manhattan" function help, you can see that there is a "col" parameter. (https://rdrr.io/cran/qqman/man/manhattan.html)

col: A character vector indicating which colors to alternate.

So you can try to add this parameter to your function call with the color (or colors) you want, like so:

library(qqman)
# Single color
manhattan(gwasResults, chr="CHR", bp="BP", snp="SNP", p="P", col = c("chartreuse4"))
# Three colors
manhattan(gwasResults, chr="CHR", bp="BP", snp="SNP", p="P", col = c("chartreuse4", "coral4", "dodgerblue3"))


Let me know if this works.

0
Entering edit mode

No this shows separated colors