This is a test version of Biostars. For the public version, visit https://www.biostars.org.
circos plot for genomic features

Hi there,

I'm working on a Circos visualization of two haplotypes for a human sample.

So, far I could get the basic frame of the plot but I don't understand neither how to add genomic features (genes and other annotations and/or regions of the genome), nor the exact format... from the manual it appears everything should be a BED but genes GFF should be fine provided only the columns with chromosomes and coordinates are retained?

Also, it would be interesting to compare the syntenic regions between the two haplotypes; does this require a specific tool to generate such files plotted as circos.genomicLink; I'm aware SyRI does so but the output is not a standard BED and needs to be heavily edited. Below the code I'm using, thanks in advance!

library(circlize)

h9_1 <- data.frame(chr=c("chr1", "chr2", "chr3", "chr4", "chr5", "chr6", "chr7", "chr8", "chr9", "chr10", "chr11", 
                                        "chr12", "chr13", "chr14", "chr15", "chr16", "chr17", "chr18", "chr19", "chr20", "chr21", "chr22", "chrX"), 
                                  start=c(rep(1, time=23)), 
                                  end=c(250382078, 242438398, 200940782, 193253728, 186212366, 173051588, 161716607, 145465483, 135918162, 134385439, 133922055, 
                                        133376810, 107377685, 102710047, 96346030, 96215701, 86176721, 77553665, 69461520, 66775821, 44404722, 47079544, 155153153))
h9_1[ ,1] = paste0("hap1_", h9_1[, 1])
h9_2 <- data.frame(chr=c("chr1", "chr2", "chr3", "chr4", "chr5", "chr6", "chr7", "chr8", "chr9", "chr10", "chr11", 
                                             "chr12", "chr13", "chr14", "chr15", "chr16", "chr17", "chr18", "chr19", "chr20", "chr21", "chr22", "chrX"), 
                                       start=c(rep(1, time=23)), 
                                       end=c(243198671, 242142825, 202683022, 191171759, 182409348, 172871300, 161232845, 145868755, 135032811, 135648429, 136138868, 
                                             134127282, 112572639, 101767573, 96851046, 87971686, 83829559, 80564282, 61548830, 65603693, 42759301, 48623973, 153704768))
h9_2[ ,1] = paste0("hap2_", h9_2[, 1])
h9_comb <- rbind(h9_1, h9_2)

circos.clear()
circos.par("start.degree" = 90)
chromosome.index = c(paste0("hap1_chr", c(1:22, "X")), 
                     rev(paste0("hap2_chr", c(1:22, "X"))))
#circos.genomicInitialize(h9_comb, plotType = c("axis", "labels"), 
#                         major.by = 200000000, labels.cex = 0.5, chromosome.index = chromosome.index)
circos.initializeWithIdeogram(h9_comb, plotType = c("axis"), chromosome.index = chromosome.index,
                              major.by = 200000000, labels.cex = .5)


circos.track(ylim = c(0, 1), panel.fun = function(x, y) {
  chr = CELL_META$sector.index
  xlim = CELL_META$xlim
  ylim = CELL_META$ylim
  circos.rect(xlim[1], 0, xlim[2], 1, col = "white")
  circos.text(CELL_META$xcenter, CELL_META$ylim[1] + 3 + mm_y(2), 
              gsub("hap[1-2]_", "", CELL_META$sector.index), cex = .5, niceFacing = TRUE)
}, track.height = .05, bg.border = NA)
bed r plot track circos

Why not use something like Jbrowse2 instead ? https://jbrowse.org/jb2/gallery/

You can load both haplotypes, use minimap2 to create a paf file to draw syntenic lines between them, and load annotations very easily without all this custom work. Also, I don't think circos plots are very effective for comparing linear haplotypes.

Another great option is clinker - https://github.com/gamcil/clinker

colindaven thanks a lot! clinker also seems to be a nice/effective tool to do so. It happens we stuble across a work where they used Circos and we thought to reproduce the analysis but it's not trivial for the lac of documentation from one side, and the poor description in the work from the other...

0 answers

No answers yet.

Log in to answer this question.