在 circlize 中添加基因组特征轨迹时出错
Errors adding genomic feature track in circlize
我正在尝试使用 BED 文件中的简单基因组符号生成 circos 图。但是,当我使用 circos.genomeRect
时,这会导致错误,或者在不绘制矩形但绘制半圆的轨道中,如下所示。
考虑以下可重现的示例:
library("circlize")
library("tidyverse")
circos.par(start.degree = 90,
cell.padding = c(0, 0, 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,1),
panel.fun = function(region, value, ...) {
circos.genomicRect(region, value, ytop.column = 1, ybottom = 0, col="blue")
})
circos.clear()
这returns一个错误:
Error in if (sum(l) && circos.par("points.overflow.warning")) { :
missing value where TRUE/FALSE needed
In addition: Warning message:
In is.na(x) | is.na(y) :
Error in if (sum(l) && circos.par("points.overflow.warning")) { :
missing value where TRUE/FALSE needed
此时,如果在上面的circos.par
中设置了points.overflow.warning=FALSE
,则错误消失,但一定是出现了其他错误,即不绘制矩形:
我错过了什么吗?这个简单的例子有什么问题?谢谢
编辑
我刚刚注意到我绘制的特征数据框有一个坐标错误,因为它比染色体的实际大小延伸得更长。但是,如果这是固定的,例如:feature <- tibble(chr = c("chr1", "chr1"), start = c(2500, 4500000), end = c(4150000, 5350000))
,则会出现新的错误!!
Warning message:
In is.na(x) | is.na(y) :
longer object length is not a multiple of shorter object length
它似乎适用于 data.frame
s 而不是 tibble
s:
library("circlize")
circos.par(start.degree = 90,
cell.padding = c(0, 0, 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,1),
panel.fun = function(region, value, ...) {
circos.genomicRect(region, value, col="blue")
})
circos.clear()
由 reprex package (v0.3.0)
于 2020-08-11 创建
我正在尝试使用 BED 文件中的简单基因组符号生成 circos 图。但是,当我使用 circos.genomeRect
时,这会导致错误,或者在不绘制矩形但绘制半圆的轨道中,如下所示。
考虑以下可重现的示例:
library("circlize")
library("tidyverse")
circos.par(start.degree = 90,
cell.padding = c(0, 0, 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,1),
panel.fun = function(region, value, ...) {
circos.genomicRect(region, value, ytop.column = 1, ybottom = 0, col="blue")
})
circos.clear()
这returns一个错误:
Error in if (sum(l) && circos.par("points.overflow.warning")) { : missing value where TRUE/FALSE needed
In addition: Warning message: In is.na(x) | is.na(y) : Error in if (sum(l) && circos.par("points.overflow.warning")) { : missing value where TRUE/FALSE needed
此时,如果在上面的circos.par
中设置了points.overflow.warning=FALSE
,则错误消失,但一定是出现了其他错误,即不绘制矩形:
我错过了什么吗?这个简单的例子有什么问题?谢谢
编辑
我刚刚注意到我绘制的特征数据框有一个坐标错误,因为它比染色体的实际大小延伸得更长。但是,如果这是固定的,例如:feature <- tibble(chr = c("chr1", "chr1"), start = c(2500, 4500000), end = c(4150000, 5350000))
,则会出现新的错误!!
Warning message: In is.na(x) | is.na(y) : longer object length is not a multiple of shorter object length
它似乎适用于 data.frame
s 而不是 tibble
s:
library("circlize")
circos.par(start.degree = 90,
cell.padding = c(0, 0, 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,1),
panel.fun = function(region, value, ...) {
circos.genomicRect(region, value, col="blue")
})
circos.clear()
由 reprex package (v0.3.0)
于 2020-08-11 创建