--Hi,
i use circlize library to create circos but i need help to modify scale on the chromosome (ideogram), some size in Mb are missing.
Also i need to add space or margin between connector because some values (value1) are overlapped.
df<- read.table("circos.bed", header=T, sep="\t",dec = ".")
bed <- data.frame(df)
library("circlize")
circos.clear()
mini=min(as.numeric(bed$value1))-1
maxi=max(as.numeric(bed$value1))+1
chr_bg_color = rand_color(19, transparency = 0.8)
names(chr_bg_color) = paste0("chr", c(1,2,5,6,7,8,9,10,11,14,15,16,17,18,19,20,21,22,"X"))
circos.par("gap.degree" = c(rep(4,19)),track.margin=c(0,0.02))
circos.initializeWithIdeogram(species = "hg38", chromosome.index = paste0("chr", c(1,2,5,6,7,8,9,10,11,14,15,16,17,18,19,20,21,22,"X")), plotType = c("ideogram", "axis", "labels"),track.height = NULL,ideogram.height = convert_height(3, "mm"))
text(0, 0, "CNV regions", cex = 2)
circos.genomicTrack(bed,ylim = c(mini, maxi),
panel.fun=function(region, value, ...) {
for(h in seq(mini, maxi, by = 0.5)) {
circos.lines(CELL_META$cell.xlim, c(h, h), lty = 3, col = "#AAAAAA")
}
circos.lines(CELL_META$cell.xlim, c(2, 2), lty = 1, col = "green")
circos.genomicPoints(region, value, pch = 16, cex = 0.5, col = ifelse(value[[1]] > 2, "red", "blue"))
}, bg.col = chr_bg_color[bed$chr], track.margin = c(0.02, 0))
circos.yaxis(side = "left", at = seq(mini, maxi, by = 0.5),
sector.index = get.all.sector.index()[1], labels.cex = 0.4)
circos.genomicLabels(bed, labels.column = 4, side = "inside",
cex = 0.5,
padding = 0.001, connection_height = 0.05,
labels_height = min(c(convert_height(0.5, "cm"))),
col = ifelse(as.numeric(bed$value1) > 2, "red", "blue"))
Thank you --
circos.bed:
|chr|start|end|value1|
|chr15|65219031|65622910|1.81|
|chr17|61889342|62489659|1.74|
|chrX|24069367|24667815|1.79|
|chr1|39465088|39897570|1.77|
|chr11|32932566|32933289|1.84|
|chr22|10510507|12954787|2.29|
|chr21|43095719|43684466|1.68|
|chr9|66173048|68949283|1.76|
|chr21|27675683|28074990|1.8|
|chr17|8210761|18944769|1.77|
|chrX|89066024|92075449|1.77|
|chr16|18123057|28700807|1.83|
|chr1|120065510|121263538|1.76|
|chr15|28219754|28823470|1.74|
|chrX|155305578|156001678|1.44|
|chr18|65850841|66549846|1.55|
|chr10|47530323|48105261|1.77|
|chr7|72329218|73130912|1.75|
|chr17|21549019|22427964|1.14|
|chr5|69330893|71431293|1.74|
|chr18|10502|160409|1.75|
|chr22|23241976|23537689|1.8|
|chr9|38920188|40800078|1.78|
|chr20|25507447|26256532|1.77|
|chr7|143530257|144218441|1.46|
|chr7|142428613|142928851|1.38|
|chr14|21747309|22747601|1.21|
|chr2|95514537|132145779|1.58|
|chr11|4086914|4389298|1.77|
|chr15|20027024|23423530|1.79|
|chr19|22005847|22201734|1.82|
|chr2|87085343|88189761|1.79|
|chr14|18173525|20252385|3.29|
|chr16|14523866|15418157|1.84|
|chr6|31306856|31615377|1.73|
|chr8|6989985|8298012|1.81|
|chr9|10502|418649|1.79|
|chr5|34107688|34457298|1.66|
|chr22|20997231|21540660|1.75|
|chr17|46279725|46680125|2.70|
|chr6|57407390|58106117|1.77|
|chr20|1309312|1906559|1.14|
|chr15|29920921|30827717|1.77|
|chr18|14264732|15359022|1.81|
|chr14|73338295|73847884|1.82|
|chr14|105697562|106347694|3.18|