全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
12211 0
2016-04-30
原文网址:https://cran.r-project.org/web/p ... ignettes/qqman.html
注意:最新版的qqman程序包是基于R 3.2.5版本开发的,所以使用该程序包之前注意更新R软件到最新版本,同时安装最新版的qqman程序包。虽然以前版本的R也能运行相关程序,但是部分功能显示不够完善。

以下内容因为格式问题将源网页内容稍加调整
Intro to the qqman package

The qqman package includes functions for creating manhattan plots and q-q plots from GWAS results. ThegwasResults data.frame included with the package has simulated results for 16,470 SNPs on 22 chromosomes. Take a look at the data:

复制代码

How many SNPs on each chromosome?

复制代码
Creating manhattan plots

Now, let's make a basic manhattan plot.

复制代码

1.png

We can also pass in other graphical parameters. Let's add a title (main=), increase the y-axis limit (ylim=), reduce the point size to 60% (cex=), and reduce the font size of the axis labels to 90% (cex.axis=). While we're at it, let's change the colors (col=), remove the suggestive and genome-wide significance lines, and supply our own labels for the chromosomes:

复制代码

2.png

Now, let's look at a single chromosome:

复制代码

3.png

Let's highlight some SNPs of interest on chromosome 3. The 100 SNPs we're highlighting here are in a character vector called snpsOfInterest. You'll get a warning if you try to highlight SNPs that don't exist.

复制代码

4.png

We can combine highlighting and limiting to a single chromosome, and use the xlim graphical parameter to zoom in on a region of interest (between position 200-500):

复制代码

5.png

Finally, the manhattan function can be used to plot any value, not just p-values. Here, we'll simply call the function passing to the p= argument the name of the column we want to plot instead of the default “P” column. In this example, let's create a test statistic (“zscore”), plot that instead of p-values, change the y-axis label, and remove the default log transformation. We'll also remove the genomewide and suggestive lines because these are only meaningful if you're plotting -log10(p-values).

复制代码

6.png

A few notes on creating manhattan plots:

  • Run str(gwasResults). Notice that the gwasResults data.frame has SNP, chromosome, position, and p-value columns named SNP, CHR, BP, and P. If you're creating a manhattan plot and your column names are different, you'll have to pass the column names to the chr=, bp=, p=, and snp= arguments. See help(manhattan) for details.
  • The chromosome column must be numeric. If you have “X,” “Y,” or “MT” chromosomes, you'll need to rename these 23, 24, 25, etc. You can modify the source code (e.g., fix(manhattan)) to change the line designating the axis tick labels (labs <- unique(d$CHR)) to set this to whatever you'd like it to be.
  • If you'd like to change the color of the highlight or the suggestive/genomewide lines, you'll need to modify the source code. Search for col="blue", col="red", or col="green3" to modify the suggestive line, genomewide line, and highlight colors, respectively.
Creating Q-Q plots

Creating Q-Q plots is straightforward - simply supply a vector of p-values to the qq() function.

复制代码

7.png

We can otionally supply many other graphical parameters.

复制代码

8.png




二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群