circlize
circlize copied to clipboard
circos.lines within the circos.genomicTrack command does not draw lines in all tracks
Hi,
I am using your R package, which is quite nice, but I am facing a small issue. I want to draw a genome with tracks. For this I was using the circos.genomicTrack
command. As Input I have a bed file:
chr start end value1 value2 value3
1 chr5 8.50e+07 8.50e+07 0.005 0 0
2 chr2 8.80e+07 8.80e+07 0.010 0 0
3 chr1 9.60e+07 9.60e+07 0.005 0 0
4 chr2 1.17e+08 1.17e+08 0.010 0 0
6 chr1 1.19e+08 1.19e+08 0.005 0 0
7 chr6 1.20e+08 1.20e+08 0.005 0 0
circos.genomicTrack(bedfiles, ylim = c(0, 1),
panel.fun = function(region, value, ...) {
circos.genomicPoints(region, value, pch = 16, cex = 1, col = c("#5CC863","#FDE725","#440154"), ...)
circos.lines(CELL_META$cell.xlim, c(0, 0), lty = 3, col = "#888888",lwd=0.5)
for(h in seq(0, 1, by = 0.2)) {
circos.lines(CELL_META$cell.xlim, c(h, h), lty = 3, col = "#AAAAAA",lwd=0.5)
}
}, track.height = 0.10)
I am using the code from above, but obviously it is not drawing dotted lines (within the circos.lines
function) for values that do not show up in the bed file. But I want the dotted lines to be drawn for every track and not only for the tracks with values from the bed file in it. I have also attached a file with the issue I am facing (so for example in track 3 and 4 there are no dotted lines). I hope you could help me with that.
Yes, you are right, circos.genomicTrack()
only adds graphics in chromsomes that are in bedfiles
.
Anyway, you can first construct the track with circos.track()
and draw lines in it. Laster in the same track, you use circos.genomicTrack()
:
circos.track(ylim = c(0, 1), panel.fun = function(x, y) {
circos.lines(CELL_META$cell.xlim, c(0, 0), lty = 3, col = "#888888",lwd=0.5)
for(h in seq(0, 1, by = 0.2)) {
circos.lines(CELL_META$cell.xlim, c(h, h), lty = 3, col = "#AAAAAA",lwd=0.5)
}
})
circos.genomicTrack(bedfiles,
panel.fun = function(region, value, ...) {
circos.genomicPoints(region, value, pch = 16, cex = 1, col = c("#5CC863","#FDE725","#440154"), ...)
}, track.height = 0.10, track.index = get.current.track.index())
Thank you very much for the provided code and sorry for opening again this issue. But now, with the new provided code I can draw a yaxis but not with a "0", even though I specified it in the argument:
circos.yaxis(side = "right", at = c(0,0.5,1),
sector.index = get.all.sector.index()[1], labels.cex = 0.6)
When I change the zero into a 0.1 it works, but obviously not with a zero. Is this a bug? I used the code you provided above. With my old code, it worked with setting the axis to c(0,0.5,1)
(see attached pictures).
circos.yaxis(side = "right", at = c(0.1,0.5,1),
sector.index = get.all.sector.index()[1], labels.cex = 0.6)