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 ...
随机推荐
- 3. Dubbo原理解析-Dubbo内核实现之动态编译 (转)
转载自 斩秋的专栏 http://blog.csdn.net/quhongwei_zhanqiu/article/details/41577159 我们运行的Java代码,一般都是编译之后的字节码 ...
- python之路——模块和包
阅读目录 一 模块 3.1 import 3.2 from ... import... 3.3 把模块当做脚本执行 3.4 模块搜索路径 3.5 编译python文件 二 包 2.2 import 2 ...
- 分布式系列 - dubbo服务telnet命令
dubbo服务发布之后,我们可以利用telnet命令进行调试.管理.Dubbo2.0.5以上版本服务提供端口支持telnet命令,下面我以通过实例抛砖引玉一下: 1.连接服务 测试对应IP和端口下的d ...
- (转)Awesome Human Pose Estimation
Awesome Human Pose Estimation 2018-10-08 11:02:35 Copied from: https://github.com/cbsudux/awesome-hu ...
- 如何在基于Bytom开发过程中使用Bigchaindb
上期我们讲了在基于比原开发过程中链外存储可以用分布式存储IPFS,这期我们还给大家介绍另外一种链外存储的解决方案.bigchaindb:https://www.bigchaindb.com,下面我们讲 ...
- [原][OSG]OSG例子程序简介
1.example_osganimate一)演示了路径动画的使用(AnimationPath.AnimationPathCallback),路径动画回调可以作用在Camera.CameraView.M ...
- [原][算法][earth]三段smooth,传入时间,返回距离。仿谷歌视角飞跃处理
算法需求: 传入[0~1]的时间time,返回[0~1]的路程. 整个路程distance[0~1]分为三段路径: 第一段:在0.25time的时间里,速度从0,位置从distance:0加速移动到距 ...
- Hive数据导入导出
Hive三种不同的数据导出的方式 (1) 导出到本地文件系统 insert overwrite local directory '/home/anjianbing/soft/export_data/ ...
- POJ-3294 Life Forms n个字符串中出现超过n/2次的最长子串(按字典序依次输出)
按照以前两个字符串找两者的最长公共子串的思路类似,可以把所有串拼接到一起,这里为了避免讨论LCP跨越多个串需需要特别处理的问题用不同的字符把所有串隔开(因为char只有128位,和可能不够用,更推荐设 ...
- 『TensorFlow』网络操作API_中_损失函数及分类器
一.误差值 度量两个张量或者一个张量和零之间的损失误差,这个可用于在一个回归任务或者用于正则的目的(权重衰减). l2_loss tf.nn.l2_loss(t, name=None) 解释:这个函数 ...