使用devtools下载linkagemapview包
install.packages("devtools")
library(devtools)
devtools:: install_github("louellette/LinkageMapView",build_vignettes=TRUE)
载入
library(LinkageMapView)
数据类型类型介绍
mapthis
主要的文件类型(必须的),至少为三列,第一列为群组,第二列为位置,第三列为标记名称,同样你也可以在第四列加上颜色的标签
group position locus
2170LG3 0.000 BSSR-094
2170LG3 7.039 ESSR86
2170LG3 11.123 F3H
2170LG3 11.123 FLS1
2170LG3 13.079 ESNP32
2170LG3 13.079 ESNP31
conndf
这个是你要在染色体之间划线的文件(非必须),分为四列,第一列为划线开始的群组,第二列为开始群组中标记的名称,第三列为划线结束的群组,第四列为结束群组中标记的名称
fromchr fromlocus tochr tolocus
2170LG3 BSSR-094 70349LG3 K1562
2170LG3 K0593 70349LG3 K1323
70349LG3 K1562 10117LG3 ESSR-087
70349LG3 K1323 10117LG3 P1
markerformatlist
这个文件是要对一些标记进行特殊的处理(非必须),如加颜色,斜体等,这个文件时list,标记的名称为必须的,颜色,标签和字体是非必须的
locus
col
cex
font
qtldf
这个好像是在图中标记出你的qtl的,是个data.fram
chr qtl so si ei ei col
70349LG3 RTPE-Q1 36.6 37 37 38 red
sectcoldf
这个没有用过
上面提到的这些文件格式,都可以自己先创建好,然后倒入到R中去
几个重要参数的使用说明
autoconnadj:染色体中名字一样的标记是否使用线连接起来,默认是TRUE
posonleft:正常的图中(默认是TRUE),位置是在染色体的左边的,如果改为FALSE,就会把位置画在右边,同样,标记的名称在另一边
revthese:后面接的是群组的名称,这个参数可以把这个群组的顺序倒过来
ruler:默认是FALSE,如果改为TRUE,那么图中就不会标出位置的信息
showonly:只显示这些标记的名称
dupnbr:当一个位置的标记比较多时,将默认参数FALSE改为TRUE,可以只显示一个标记的名称
还有好多参数,那些参数大多是对图形的一些修改,以及对pdf的修改
################现在开始练习#######################
这个包主要有一个函数——lmv.linkage.plot
#这个包带的练习的数据
data(carrot)
head(carrot)
练习1
lmv.linkage.plot(carrot,outfile = "carrot1.pdf")
lmv.linkage.plot(carrot,outfile = "carrot2.pdf",revthese = "70349LG3")
lmv.linkage.plot(carrot,outfile = "carrot3.pdf",autoconnadj = FALSE)
lmv.linkage.plot(carrot,outfile = "carrot4.pdf",posonleft = FALSE, mapthese = c("10117LG3"))
lmv.linkage.plot(carrot,outfile = "carrot5.pdf",mapthese = c("10117LG3"))
lmv.linkage.plot(carrot,outfile = "carrot6.pdf",ruler = TRUE)
练习2
#使用qtl包中的数据,和carrot实际上效果一样
library(qtl)
data(hyper)
lmv.linkage.plot(hyper,"carrot7.pdf",mapthese=c(1,4,6,15),
lcol="green",
lcex=2,
lfont=2,
rcol="red",
rcex=2,rfont=3,
showonly=c("D1Mit123","D4Mit80","D6Mit135","D15Mit156"))
lmv.linkage.plot(hyper,"carrot8.pdf",mapthese=c(1,4,6,15),
col.lgtitle = "blue",
cex.lgtitle=2,
col.main = "red",
main="Overall Title for the Output Map")
练习3
#make a df to pass qtl info
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"))
#make a list to pass label options
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)
lmv.linkage.plot(carrot, outfile = "carrot9.pdf",
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)
练习4
qtldf <- data.frame(fromchr = character(),
fromlocus = character(),
tochr = character(),
tolocus = character(),
stringsAsFactors = FALSE)
qtldf <- rbind(qtldf, data.frame(fromchr = c("2170LG3","2170LG3","70349LG3","70349LG3"),
fromlocus = c("BSSR-094", "P3", "K1562", "K2227"),
tochr = c("70349LG3", "70349LG3", "10117LG3", "10117LG3"),
tolocus = c("K1562", "K2227", "ESSR-087", "P1")))
lmv.linkage.plot(carrot,"carrot10.pdf",ruler = TRUE,autoconnadj = F,conndf = qtldf)
练习5
data(oat)
# draw tickmarks at 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 labels on ruler at every 10 cM
axlab <- vector()
for (lab in 0:maxpos) {
if (!lab %% 10) {
axlab <- c(axlab, lab)
}
else {
axlab <- c(axlab, NA)
}
}
lmv.linkage.plot(oat,"oat.pdf",mapthese=c("Mrg01","Mrg02"),denmap=TRUE, cex.axis = 1, at.axis = at.axis, labels.axis = axlab)
carrot1.pdf
carrot2.pdf
carrot3.pdf
carrot4.pdf
carrot5.pdf
carrot6.pdf
carrot7.pdf
carrot8.pdf
carrot9.pdf
carrot10.pdf
oat.png
网友评论