Identifying the x,y coordinates of dots in a manhattan plot

时间:2015-05-24 21:45:08

标签: r plot coordinates scatter-plot

I would like to identify the x and y positions of specific dots in my manhattan plot.

library(qqman)
manhattan(gwasResults)

With head(gwasResults) you will get:

  SNP CHR BP         P
1 rs1   1  1 0.9148060
2 rs2   1  2 0.9370754
3 rs3   1  3 0.2861395
4 rs4   1  4 0.8304476
5 rs5   1  5 0.6417455
6 rs6   1  6 0.5190959

I want to know the x and y coordinates in my plot, which corresponds to the dot at row == 6 in gwasResults.

Any idea how to extract this inf as one object?

1 个答案:

答案 0 :(得分:0)

要突出显示图上的点,请使用highlight和SNP值。例如:

manhattan(gwasResults, highlight = "rs6")

您可以在图片中看到绿点(第1行,左图)。

第6行的y坐标是

-log10(gwasResults[6, "P"])

(= 0.2847524)

x坐标取决于CHR,BP定义染色体内的位置。

enter image description here