今天给大家介绍一个连锁图谱和数量性状位点(quantitative trait loci,QTL)图谱数据的可视化展示的包LinkageMapView。首先看下包的安装:
代码语言:javascript复制install.packages('LinkageMapView')
我们直接通过实例来给大家演示下这个包的使用:
代码语言:javascript复制library(LinkageMapView)
data(carrot)
head(carrot)
代码语言:javascript复制##简单的展示结果
lmv.linkage.plot(mapthis= carrot,outfile = 'g.pdf')
代码语言:javascript复制###为不同的标签增加颜色
flist <-list()
locus <-c("BSSR-094", "K0149", "K0627","K2161", "ESSR-087", "ESSR-057")
font <- c(2) #bold
flist[[1]]<- list(locus = locus, font = font)
locus <-c("F3H", "FLS1")
font <- c(4) #bold italic
flist[[2]]<- list(locus = locus, font = font)
locus <-c("P3", "P1", "Raa1")
font <- c(3) #italic
col <-c("red")
flist[[3]]<- list(locus = locus, font = font, col = col)
outfile = "carrot.pdf"
lmv.linkage.plot(
carrot,
outfile = outfile,
ruler = TRUE,
lgtitle = c("2170","70349", "10117"),
maxnbrcolsfordups = 2,
markerformatlist = flist,
lg.col = "lightblue1",
pdf.height = 16,
pdf.width = 10
)
代码语言:javascript复制###添加连锁反应的区域
qtldf <-data.frame(
chr = character(),
qtl = character(),
so = numeric(),
si = numeric(),
ei = numeric(),
eo = numeric(),
col = character(),
stringsAsFactors = FALSE
)
qtldf <-rbind(qtldf,
data.frame(
chr = "70349LG3",
qtl = "RTPE-Q1",
so = 36.6,
si = 37,
ei = 37,
eo = 38,
col="red"
))
代码语言:javascript复制outfile =file.path(tempdir(), "carrot.pdf")
lmv.linkage.plot(
carrot,
outfile = outfile,
ruler = TRUE,
lgtitle = c("2170","70349", "10117"),
maxnbrcolsfordups = 2,
markerformatlist = flist,
lg.col = "lightblue1",
pdf.height = 16,
pdf.width = 10,
revthese = c("70349LG3"),
qtldf=qtldf
)
代码语言:javascript复制###qtl包数据的直接导入
library(qtl)
data(hyper)
class(hyper)
summary(hyper)
代码语言:javascript复制outfile = "hyper.pdf"
lmv.linkage.plot(hyper,outfile,mapthese=c(1,4,6,15))##mapthese指的染色体的名称
代码语言:javascript复制##为可视化结果添加标题
outfile ="hyper_titles.pdf"
lmv.linkage.plot(hyper,outfile,mapthese=c(1,4,6,15),col.lgtitle= "blue",cex.lgtitle=2,
col.main = "red",main="Overall Title for the OutputMap")
代码语言:javascript复制###标记同一位点出现多个标签的情况。
outfile = "hyper_dupnbr.pdf"
lmv.linkage.plot(hyper,outfile,mapthese=c(1,4,6,15),dupnbr= TRUE)
###只输出想要展示的位置的标签,需要用到shounonly参数
outfile ="hyper_showonly.pdf"
lmv.linkage.plot(hyper,outfile,mapthese=c(1,4,6,15),lcol="green",lcex=2,lfont=2,
rcol="red",rcex=2,rfont=3,
showonly=c("D1Mit123","D4Mit80","D6Mit135","D15Mit156"))
代码语言:javascript复制###绘制位点分布的密度图
## do a densitymap with default colors and customize the axis
data(oat)
代码语言:javascript复制## draw tickmarksat each cM from 0 to largest position of linkage groups to be drawn
maxpos <-floor(max(oat$Position[oat$Group == "Mrg01" | oat$Group =="Mrg02"]))
at.axis <-seq(0, maxpos)
## put labelson ruler at every 10 cM
axlab <-vector()
for (lab in 0:maxpos) {
if (!lab %% 10) {
axlab <- c(axlab, lab)
}
else {
axlab <- c(axlab, NA)
}
}
outfile = "oat_denmap.pdf"
lmv.linkage.plot(oat,outfile,mapthese=c("Mrg01","Mrg02"),denmap=TRUE,cex.axis = 1, at.axis = at.axis, labels.axis = axlab)
欢迎大家学习交流!