library(OmicCircos)
options(stringsAsFactors=FALSE)
x <- c(29289779, 36374806, 33710802, 23020739, 31606955, 25473135,
26383534, 29603939, 33717675, 33391235, 35299535, 31678690,
34719086, 29158859, 47181002, 20664393, 24923725, 1348170000)
#scale chrs to 1Mbps
x <- x/1000000
set.seed(2017)
mdm1 <- rep(paste0("MDP", 1), each = 29.28978)
mdm2 <- rep(paste0("MDP", 2), each = 36.37481)
mdm3 <- rep(paste0("MDP", 3), each = 33.71080)
mdm4 <- rep(paste0("MDP", 4), each = 23.02074)
mdm5 <- rep(paste0("MDP", 5), each = 31.60695)
mdm6 <- rep(paste0("MDP", 6), each = 25.47313)
mdm7 <- rep(paste0("MDP", 7), each = 26.38353)
mdm8 <- rep(paste0("MDP", 8), each = 29.60394)
mdm9 <- rep(paste0("MDP", 9), each = 33.71767)
mdm10 <- rep(paste0("MDP", 10), each = 33.39124)
mdm11 <- rep(paste0("MDP", 11), each = 35.29953)
mdm12 <- rep(paste0("MDP", 12), each = 31.67869)
mdm13 <- rep(paste0("MDP", 13), each = 34.71909)
mdm14 <- rep(paste0("MDP", 14), each = 29.15886)
mdm15 <- rep(paste0("MDP", 15), each = 47.18100)
mdm16 <- rep(paste0("MDP", 16), each = 20.66439)
mdm17 <- rep(paste0("MDP", 17), each = 24.92373)
mdmUn <- rep(paste0("MDP", "Un"), each = 1348.17000)
seg1 <- c(mdm1, mdm2, mdm3, mdm4, mdm5, mdm6, mdm7,
mdm8, mdm9, mdm10, mdm11, mdm12, mdm13, mdm14, mdm15,
mdm16, mdm17, mdmUn)
repMd1 <- rep(1:x[1]); repMd2 <- rep(1:x[2]); repMd3 <- rep(1:x[3]); repMd4 <- rep(1:x[4])
repMd5 <- rep(1:x[5]); repMd6 <- rep(1:x[6]); repMd7 <- rep(1:x[7]); repMd8 <- rep(1:x[8])
repMd9 <- rep(1:x[9]); repMd10 <- rep(1:x[10]); repMd11 <- rep(1:x[11]); repMd12 <- rep(1:x[12])
repMd13 <- rep(1:x[13]); repMd14 <- rep(1:x[14]); repMd15 <- rep(1:x[15]); repMd16 <- rep(1:x[16])
repMd17 <- rep(1:x[17]); repMdUn <- rep(1:x[18])
end1 <- c(repMd1, repMd2, repMd3, repMd4, repMd5, repMd6, repMd7, repMd8,
repMd9, repMd10, repMd11, repMd12, repMd13, repMd14, repMd15, repMd16,
repMd17, repMdUn)
de1 <- rep(paste0("CHR", 1), each = 29.28978)
de2 <- rep(paste0("CHR", 2), each = 36.37481)
de3 <- rep(paste0("CHR", 3), each = 33.71080)
de4 <- rep(paste0("CHR", 4), each = 23.02074)
de5 <- rep(paste0("CHR", 5), each = 31.60695)
de6 <- rep(paste0("CHR", 6), each = 25.47313)
de7 <- rep(paste0("CHR", 7), each = 26.38353)
de8 <- rep(paste0("CHR", 8), each = 29.60394)
de9 <- rep(paste0("CHR", 9), each = 33.71767)
de10 <- rep(paste0("CHR", 10), each = 33.39124)
de11 <- rep(paste0("CHR", 11), each = 35.29953)
de12 <- rep(paste0("CHR", 12), each = 31.67869)
de13 <- rep(paste0("CHR", 13), each = 34.71909)
de14 <- rep(paste0("CHR", 14), each = 29.15886)
de15 <- rep(paste0("CHR", 15), each = 47.18100)
de16 <- rep(paste0("CHR", 16), each = 20.66439)
de17 <- rep(paste0("CHR", 17), each = 24.92373)
deUn <- rep(paste0("CHR", "Un"), each = 1348.17000)
seg2 <- c(de1, de2, de3, de4, de5, de6, de7, de8,
de9, de10, de11, de12, de13, de14, de15, de16, de17, deUn)
repDE1 <- rep(1:x[1]); repDE2 <- rep(1:x[2]); repDE3 <- rep(1:x[3]); repDE4 <- rep(1:x[4])
repDE5 <- rep(1:x[5]); repDE6 <- rep(1:x[6]); repDE7 <- rep(1:x[7]); repDE8 <- rep(1:x[8])
repDE9 <- rep(1:x[9]); repDE10 <- rep(1:x[10]); repDE11 <- rep(1:x[11]); repDE12 <- rep(1:x[12]);
repDE13 <- rep(1:x[13]); repDE14 <- rep(1:x[14]); repDE15 <- rep(1:x[15]); repDE16 <- rep(1:x[16]);
repDE17 <- rep(1:x[17]); repDEUn <- rep(1:x[18])
end2 <- c(repDE1, repDE2, repDE3, repDE4, repDE5, repDE6, repDE7, repDE8,
repDE9, repDE10, repDE11, repDE12, repDE13, repDE14, repDE15, repDE16,
repDE17, repDEUn)
link.num = 100
link.i = sample(1:length(seg1), link.num, replace = TRUE)
de1 <- length(seg1) +1
link.j = sample(de1:length(end), link.num, replace = TRUE)
link.df <- cbind(seg.f[link.i, c(1,2,5)], seg.f[link.j, c(1,2,5)])
link.n <- gsub("MDP", "", link.df[,1])
link.n <- gsub("Un", "18", link.n)
link.c <- col2[as.numeric(link.n)]
end <- c(end1, end2)
segs <- c(seg1, seg2)
start <- end - 1
seg.f <- data.frame ( seg.name = segs, seg.Start = start, seg.End = end, the.v=runif(length(end)),
Note = sample(LETTERS, length(end), replace = TRUE))
db <- segAnglePo(seg.f, seg=unique(segs))
col1 <- rainbow(18)
col2 <- rainbow(18)
chr.c <- c(col1, rep("black", 18))
#pdf("CIRCOS.pdf", 8, 8)
par(mar=c(2,2,2,2))
plot(c(1,800), c(1,800), type="n", axes=FALSE, xlab="XLAB", ylab="YLAB", main="@THEOBROMA22")
circos(R=360, cir=db, type="chr", col=chr.c, print.chr.lab=TRUE, W=40, scale = F)
circos(R=350, cir=db, W=40, mapping=link.df, type="link", lwd=1, col=link.c)
#dev.off()
Does this help you?
You can copy and paste the above code into the R terminal and it should make a completed circos plot.
Hi,theobroma22: It seems that not helpful,when I run db <- segAnglePo(seg.f, seg=unique(segs)),the class length and names length different
Alex
When you paste the above code for seg.f do you have a '(' after data.frame? It should be
This happens from time to time when pasting into biostars and I don't know why...?
I updated the code above so you can get the '('
can you send the code to my gmail,maybe it will clearly to me,the maile is :
Thanks
Alex
Please keep all discussion on the forum and open.