标签:
分享一个制作弦图的R包:ggbio. 效果图和代码如下。稍后解释具体用法...
library(GenomicRanges) set.seed(1) N <- 100 gr <- GRanges(seqnames = sample(c("chr1", "chr2", "chr3"), size = N, replace = TRUE), IRanges(start = sample(1:300, size = N, replace = TRUE), width = sample(70:75,size = N, replace = TRUE)), strand = sample(c("+", "-", "*"),size = N,replace = TRUE), value = rnorm(N, 10, 3), score = rnorm(N, 100, 30),sample = sample(c("Normal", "Tumor"), size = N, replace = TRUE), pair = sample(letters,size = N, replace = TRUE)) library(ggbio) seqlengths(gr) <- c(400, 500, 700) values(gr)$to.gr <- gr[sample(1:length(gr), size = length(gr))] idx <- sample(1:length(gr), size = 50) gr <- gr[idx] ggplot() + layout_circle(gr, geom = "ideo", fill = "gray70", radius = 7, trackWidth = 3) +layout_circle(gr, geom = "bar", radius = 10, trackWidth = 4,aes(fill = score, y = score)) +layout_circle(gr, geom = "point", color = "red", radius = 14,trackWidth = 3, grid = TRUE, aes(y = score)) +layout_circle(gr, geom = "link", linked.to = "to.gr", radius = 6, trackWidth= 1)
ggbio包还可以制作其他复杂的图表(如下),具体使用方法可参考该包的帮助文档:
标签:
原文地址:http://www.cnblogs.com/1zhk/p/4762061.html