manhattan plots in qqplot2
###manhattan plots in qqplot2
library(ggplot2)
setwd("~/ncbi/zm/XPCLR/")
read.table("LW.gene.xpclr.position.txt",header=F,sep=',')->IL
head(IL)
#V1 V2 V3 V4
#1 GRMZM2G059865 1.159389 1 4854
#2 GRMZM5G888250 1.159389 1 9882
ILp<-data.frame(ID=1:dim(IL)[1], chr=factor(IL[,3]), coord=IL[,4], p=IL[,2])
head(ILp)
#ID chr coord p
#1 1 1 4854 1.159389
#2 2 1 9882 1.159389
##Position is defined as position on chromosome. Need to add largest position from last marker on previous chr so that markers are ordered correctly along x-axis
chrNum=10
for(i in 1:chrNum){
ndx<-which(ILp[,2]==i)
lstMrk<-max(ILp[ndx,3])
if (i < chrNum) ndx2 <- which(ILp[, 2]==i+1)
if (i < chrNum) ILp[ndx2, 3] <- ILp[ndx2,3] + lstMrk
}
##Use this little loop to find the midposition of every chromosome so nice chr labels can be added to the plot
bpMidVec <- vector(length=chrNum)
for (i in 1:chrNum){
ndx <- which(ILp[, 2]==i)
posSub <- ILp[ndx, 3]
bpMidVec[i] <- ((max(posSub) - min(posSub))/2) + min(posSub)
}
##Use qplot function in ggplot2 to create Manhattan plot
cbPalette <- c("darkgrey", "#000000","#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7","red")
tiff(filename = "LW.tif",width = 36,height = 18,units ="cm",compression="lzw",bg="white",res=300)
ggplot(ILp) + geom_point(aes(x=coord, y=p,colour=chr),show.legend = FALSE) + scale_color_manual(values=cbPalette)+#brewer(type="seq",palette="Set5")+
scale_x_continuous(labels=as.character(1:chrNum),breaks=bpMidVec)+theme_bw(base_size=15)+labs(x="Chromosomes",y="XP-CLR score of Landraces and Wild")+ylim(0,152)
dev.off()
manhattan plots in qqplot2的更多相关文章
- R语言画全基因组关联分析中的曼哈顿图(manhattan plot)
1.在linux中安装好R 2.准备好画曼哈顿图的R脚本即manhattan.r,manhattan.r内容如下: #!/usr/bin/Rscript #example : Rscript plot ...
- Manhattan distance(for lab)
Input four integer x1, y1, x2, y2, which is mean that the coordinates of two points A(x1, y1), B(x2, ...
- bzoj 3170 manhattan距离
首先将坐标系顺时针旋转45度,得到一个新的坐标系,这个坐标系 对应的坐标的manhattan距离就是原图中的距离,然后快排,利用前缀和 数组O(N)求所有的答案,然后找最小值就行了,总时间O(Nlog ...
- GWAS: 曼哈顿图,QQ plot 图,膨胀系数( manhattan、Genomic Inflation Factor)
画曼哈顿图和QQ plot 首推R包“qqman”,简约方便.下面具体介绍以下. 一.画曼哈顿图 install.packages("qqman") library(qqman) ...
- pytorch visdom可视化工具学习—1—详细使用-3-Generic Plots和Others
4)Generic Plots 注意,服务器API遵循数据和布局对象的规则,这样您就可以生成自己的任意Plotly可视化: # Arbitrary visdom content trace = dic ...
- matplotlib 入门之Sample plots in Matplotlib
文章目录 Line Plot One figure, a set of subplots Image 展示图片 展示二元正态分布 A sample image Interpolating images ...
- 基于Manhattan最小生成树的莫队算法
点u,v的Manhattan距离:distance(u,v)= |x2-x1|+|y2-y1| Manhattan最小生成树:边权值为两个点Manhattan距离的最小生成树. 普通算法:prim复杂 ...
- RLE Plots: relative log expression
RLE Plots: Visualising Unwanted Variation in High Dimensional Data 参考:RLE Plots: Visualising Unwante ...
- Intermediate Python for Data Science learning 1 - Basic plots with matplotlib
Basic plots with matplotlib from:https://campus.datacamp.com/courses/intermediate-python-for-data-sc ...
随机推荐
- Oracle 参数文件spfile
pfile和spfile 概念 ORACLE中的参数文件是一个包含一系列参数以及参数对应值的操作系统文件,可以分为两种类型.它们是在数据库实例启动时候加载的,决定了数据库的物理结构.内存.数据库的限制 ...
- mysql 热备份
xtrabackup mysql 的备份和恢复 1.准备 安装依赖 yum install perl-DBD-MySQL perl-Time-HiRes libaio libaio-devel -y ...
- Codeforces 333E Summer Earnings - bitset
题目传送门 传送门I 传送门II 传送门III 题目大意 给定平面上的$n$个点,以三个不同点为圆心画圆,使得圆两两没有公共部分(相切不算),问最大的半径. 显然答案是三点间任意两点之间的距离的最小值 ...
- IIS 设备未就绪。
看看Web.config 是否指向的磁盘在本机上不存在此磁盘
- NOI 2017 整数(线段树)
题意 https://loj.ac/problem/2302 思路 拆分成每个二进制位的加减来考虑,维护那个整数的二进制位.不难发现,进位就是找右边第一个 \(0\) 的位置,并将其赋值为 \(1\) ...
- Mac OS X 显示和隐藏文件
参考: mac系统如何显示和隐藏文件 Mac OSX系统 显示和隐藏文件 1.显示隐藏文件: 打开Terminal,并输入以下命令: defaults write com.apple.finder A ...
- 剑指offer 04:重构二叉树
题目描述 输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树.假设输入的前序遍历和中序遍历的结果中都不含重复的数字.例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7, ...
- eclipse 运行 mapreduce程序报错 No job jar file set. User classes may not be found. See JobConf(Class) or JobConf#setJar(String).
报错信息 17/07/06 17:00:27 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Ap ...
- 『Python CoolBook』C扩展库_其四_结构体操作与Capsule
点击进入项目 一.Python生成C语言结构体 C语言中的结构体传给Python时会被封装为胶囊(Capsule), 我们想要一个如下结构体进行运算,则需要Python传入x.y两个浮点数, type ...
- C++将十进制数转化为二进制
#include<iostream> using namespace std; void main() { ; ]; cin>>n; i=n; while(i) { a[j]= ...