问题描述
我正在尝试从BED文件生成具有简单基因组符号的杂技表演图。但是,当我使用circos.genomeRect
时,会导致错误,或者出现的轨迹没有绘制矩形,而是绘制半圆,如下所示。
考虑以下可重现的示例:
library("circlize")
library("tidyverse")
circos.par(start.degree = 90,cell.padding = c(0,0),#points.overflow.warning=FALSE,track.height = 0.10
)
# Initialize genome (bed file with genome sizes)
genome <- tibble(chr=c("chr1","chr2"),start = c(1,1),end = c(6000000,3000000))
circos.genomicInitialize(genome,plotType = c("axis"),major.by = 1000000)
# Add track with annotation
feature <- tibble(chr = c("chr1","chr1"),start = c(2500,4500000),end = c(4150000,6350000))
circos.genomicTrack(feature,ylim=c(0,panel.fun = function(region,value,...) {
circos.genomicRect(region,ytop.column = 1,ybottom = 0,col="blue")
})
circos.clear()
这将返回错误:
if(sum(l)&& circos.par(“ points.overflow.warning”))中的错误{ 缺少需要TRUE / FALSE的值
此外:警告消息: 在is.na(x)| is.na(y): if(sum(l)&& circos.par(“ points.overflow.warning”)){中的错误 缺少需要TRUE / FALSE的值
在这一点上,如果在上面的points.overflow.warning=FALSE
中设置了circos.par
,则错误消失了,但是还必须发生其他错误,这不会绘制矩形:
我错过了什么吗?这个简单的例子怎么了?谢谢
编辑
我刚刚注意到,我绘制的特征数据框有一个坐标错误,因为它的延伸长度超过了染色体的实际大小。但是,如果此问题已解决,例如:feature <- tibble(chr = c("chr1",5350000))
,则会出现一个新错误!
警告信息: 在is.na(x)| is.na(y): 较长的物体长度不是较短的物体长度的倍数
解决方法
它似乎适用于data.frame
而不是tibble
:
library("circlize")
circos.par(start.degree = 90,cell.padding = c(0,0),#points.overflow.warning=FALSE,track.height = 0.10
)
# Initialize genome (bed file with genome sizes)
genome <- data.frame(chr=c("chr1","chr2"),start = c(1,1),end = c(6000000,3000000))
circos.genomicInitialize(genome,plotType = c("axis"),major.by = 1000000)
# Add track with annotation
feature <- data.frame(chr = c("chr1","chr1"),start = c(2500,4500000),end = c(4150000,5350000))
circos.genomicTrack(feature,ylim=c(0,panel.fun = function(region,value,...) {
circos.genomicRect(region,col="blue")
})
circos.clear()
由reprex package(v0.3.0)于2020-08-11创建