使用R
语言进行CIRCOS
图形的绘制,使用较为方便,但是
数据的格式的准备非常重要!
此次代码在github上寻找到的,非常感谢作者的分享。
#
# The Long Intergenic Noncoding RNA (LincRNA) Landscape of the Soybean Genome文章中Fig.1E##
BiocManager::install("OmicCircos") #安装OmicCircos
library("OmicCircos")
add.alpha <- function(col, alpha=1){
if(missing(col))
stop("Please provide a vector of colours.")
apply(sapply(col, col2rgb)/255, 2,
function(x)
rgb(x[1], x[2], x[3], alpha=alpha))
}
options(stringsAsFactors=FALSE)
seg.frame<-read.csv("chr.length",header=F,sep="\t")
names(seg.frame)<-c("seg.name","seg.Start","seg.End")
seg.frame$the.v<-rep(NA,20)
seg.frame$NO<-rep(NA,20)
seg.name<-seg.frame$seg.name
colors<-rainbow(20,alpha=0.5)
db<-segAnglePo(seg.frame, seg=seg.name)
t<-read.csv("circos.table",sep="\t",header=F)
names(t)<-c("CHR","START","END","BIN","CODING","TOTAL","nonTE","TE")
coding<-data.frame(seg.name=t$CHR, seg.po=t$START+250000, name1=t$CODING)
all<-data.frame(seg.name=t$CHR, seg.po=t$START+250000, name1=t$TOTAL)
nte<-data.frame(seg.name=t$CHR, seg.po=t$START+250000, name1=t$nonTE)
te<-data.frame(seg.name=t$CHR, seg.po=t$START+250000, name1=t$TE)
t2<-read.csv("centromere.locations",sep="\t",header=F)
cent<-data.frame(seg.name=t2$V1, start=t2$V2, end=t2$V3)
pdf("1E.pdf")
par(mar=c(2,2,2,2))
plot(c(-200,1000),c(-200,1000),type="n",axes=FALSE,xlab="",ylab="",main="")
circos(R=400,cir=db,type="chr",col="grey",print.chr.lab=TRUE,W=4)
circos(R=405, W=2, cir=db, mapping=cent, type="arc2", B=FALSE, col="black", lwd=2, cutoff=0)
c=brewer.pal(12, 'Paired')
circos(R=360, W=40, cir=db, mapping=coding, col.v=3, type="l", B=FALSE, col=c[1], lwd=0.5)
circos(R=320, W=40, cir=db, mapping=all, col.v=3, type="l", B=FALSE, col=c[2], lwd=0.5)
circos(R=280, W=40, cir=db, mapping=nte, col.v=3, type="l", B=FALSE, col=c[[3]], lwd=0.5)
circos(R=240, W=40, cir=db, mapping=te, col.v=3, type="l", B=FALSE, col=c[[4]], lwd=0.5)
dev.off()
这是完整的代码,希望对大家有用,但是数据准备自己现在是在是没有能力分享,如果对该图绘制熟悉的大神可以投稿分享,非常感谢!