#gc%含量为横坐标,depth为纵坐标,从基因组中取一个窗口(如每1000bp,计算gc%和depth的平均值),上侧和右侧的直方图是单独的gc%和depth直方图#
#有污染序列的GC depth图#
> m <- read.table("GC-depth.txt")
> head(m)
V1 V2
1 48.0 54.30
2 39.0 75.90
3 42.2 83.64
4 40.8 82.28
5 50.8 97.73
6 42.6 84.11
> nf <- layout(matrix(c(0,2,0,0,1,3),2,3,byrow = T),c(0,5,3,1),c(1,3,0,5),TRUE);
> layout.show(3
> par("mar")#mar边界#
[1] 5.1 4.1 4.1 2.1
> par(mar = c(5,5,0.5,0.5))
> x <- m[,1]
> y <- m[,2]
> xhist <- hist(x,breaks = 100,plot = F)
> yhist <- hist(y,breaks = floor(max(y)-0),plot = F)
> xhist$counts #每个条目的频数值#
[1] 1 0 0 1 0 0 1 0 0 1 3 0 3 0 6
[16] 3 7 4 4 12 14 10 15 21 33 12 27 30 43 46
[31] 62 62 122 84 138 121 225 160 314 272 451 311 512 385 656
[46] 460 711 497 710 506 664 440 584 309 413 201 218 123 111 64
[61] 52 25 29 10 13 5 5 2 1
> plot(x,y,xlab = "GC Content(%)",ylab = "Depth",pch=16,col="red",xlim = c(0,100),ylim = c(0,max(y)))
> par(mar=c(0,5,1,1))
> barplot(xhist$counts,space = 0,xlim = c(0,100)
> par(mar=c(5,0,1,1))
> barplot(yhist$counts,space = 0,horiz = T,ylim = c(0,max(y))
链接:https://pan.baidu.com/s/1rdeXj67dqgQwk_Nj7I1IxQ
提取码:jd6v
复制这段内容后打开百度网盘手机App,操作更方便哦
《R语言与生物信息绘图》课程笔记